Edit

kc3-lang/angle/src/libANGLE/ContextState.h

Branch :

  • Show log

    Commit

  • Author : jchen10
    Date : 2018-07-06 13:47:01
    Hash : 7ae70d8f
    Message : ParallelCompile: Parallelize D3D linking This adds a new linking state to Program. If a Program is in linking state, on the one hand the foreground thread may continue issuing more GL calls, and on the other hand the background linking threads may be accessing Program internally too. Without a proper constraint there must be conflicts between them. For this purpose, we block any further GL calls to Program until it's actually linked. In addition, we prohibit parallel linking an active program, so that ProgramD3D does not have to worry about such similar conflicts. Also changes the WorkerThread to support limiting the number of concurrently running worker threads. BUG=chromium:849576 Change-Id: I52618647539323f8bf27201320bdf7301c4982e6 Reviewed-on: https://chromium-review.googlesource.com/1127495 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>

  • src/libANGLE/ContextState.h
  • //
    // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    // ContextState: Container class for all GL context state, caps and objects.
    
    #ifndef LIBANGLE_CONTEXTSTATE_H_
    #define LIBANGLE_CONTEXTSTATE_H_
    
    #include "common/MemoryBuffer.h"
    #include "common/angleutils.h"
    #include "libANGLE/State.h"
    #include "libANGLE/Version.h"
    #include "libANGLE/WorkerThread.h"
    #include "libANGLE/params.h"
    
    namespace gl
    {
    class BufferManager;
    class ContextState;
    class FramebufferManager;
    class PathManager;
    class ProgramPipelineManager;
    class RenderbufferManager;
    class SamplerManager;
    class ShaderProgramManager;
    class SyncManager;
    class TextureManager;
    
    static constexpr Version ES_2_0 = Version(2, 0);
    static constexpr Version ES_3_0 = Version(3, 0);
    static constexpr Version ES_3_1 = Version(3, 1);
    
    using ContextID = uintptr_t;
    
    class ContextState final : angle::NonCopyable
    {
      public:
        ContextState(ContextID context,
                     const ContextState *shareContextState,
                     TextureManager *shareTextures,
                     const Version &clientVersion,
                     State *state,
                     const Caps &caps,
                     const TextureCapsMap &textureCaps,
                     const Extensions &extensions,
                     const Limitations &limitations);
        ~ContextState();
    
        ContextID getContextID() const { return mContext; }
        GLint getClientMajorVersion() const { return mClientVersion.major; }
        GLint getClientMinorVersion() const { return mClientVersion.minor; }
        const Version &getClientVersion() const { return mClientVersion; }
        const State &getState() const { return *mState; }
        const Caps &getCaps() const { return mCaps; }
        const TextureCapsMap &getTextureCaps() const { return mTextureCaps; }
        const Extensions &getExtensions() const { return mExtensions; }
        const Limitations &getLimitations() const { return mLimitations; }
    
        const TextureCaps &getTextureCap(GLenum internalFormat) const;
    
        bool isWebGL() const;
        bool isWebGL1() const;
    
      private:
        friend class Context;
    
        Version mClientVersion;
        ContextID mContext;
        State *mState;
        const Caps &mCaps;
        const TextureCapsMap &mTextureCaps;
        const Extensions &mExtensions;
        const Limitations &mLimitations;
    
        BufferManager *mBuffers;
        ShaderProgramManager *mShaderPrograms;
        TextureManager *mTextures;
        RenderbufferManager *mRenderbuffers;
        SamplerManager *mSamplers;
        SyncManager *mSyncs;
        PathManager *mPaths;
        FramebufferManager *mFramebuffers;
        ProgramPipelineManager *mPipelines;
    };
    
    }  // namespace gl
    
    #endif  // LIBANGLE_CONTEXTSTATE_H_