Commit e8b8b816 by Rafael Cintron Committed by Commit Bot

Eliminate Program::mLinkResolved boolean

Since mLinkResolved boolean is always kept in sync with the presence of mLinkingState structure, we can remove the former and replace access with checks for the latter being nullptr. Bug: angleproject:4644 Change-Id: Ib385b5c3881946d762ad48e6534c84d15e50f673 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2209319Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
parent 651378b2
...@@ -448,7 +448,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -448,7 +448,7 @@ class Program final : angle::NonCopyable, public LabeledObject
ANGLE_INLINE rx::ProgramImpl *getImplementation() const ANGLE_INLINE rx::ProgramImpl *getImplementation() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return mProgram; return mProgram;
} }
...@@ -479,7 +479,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -479,7 +479,7 @@ class Program final : angle::NonCopyable, public LabeledObject
bool isLinked() const bool isLinked() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return mLinked; return mLinked;
} }
...@@ -518,7 +518,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -518,7 +518,7 @@ class Program final : angle::NonCopyable, public LabeledObject
const std::vector<GLenum> &getOutputVariableTypes() const; const std::vector<GLenum> &getOutputVariableTypes() const;
DrawBufferMask getActiveOutputVariables() const DrawBufferMask getActiveOutputVariables() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return mState.mActiveOutputVariables; return mState.mActiveOutputVariables;
} }
...@@ -540,13 +540,13 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -540,13 +540,13 @@ class Program final : angle::NonCopyable, public LabeledObject
const std::vector<VariableLocation> &getUniformLocations() const const std::vector<VariableLocation> &getUniformLocations() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return mState.mUniformLocations; return mState.mUniformLocations;
} }
const LinkedUniform &getUniformByIndex(GLuint index) const const LinkedUniform &getUniformByIndex(GLuint index) const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return mState.mExecutable->getUniformByIndex(index); return mState.mExecutable->getUniformByIndex(index);
} }
...@@ -624,19 +624,19 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -624,19 +624,19 @@ class Program final : angle::NonCopyable, public LabeledObject
ANGLE_INLINE GLuint getActiveUniformBlockCount() const ANGLE_INLINE GLuint getActiveUniformBlockCount() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return static_cast<GLuint>(mState.mExecutable->getActiveUniformBlockCount()); return static_cast<GLuint>(mState.mExecutable->getActiveUniformBlockCount());
} }
ANGLE_INLINE GLuint getActiveAtomicCounterBufferCount() const ANGLE_INLINE GLuint getActiveAtomicCounterBufferCount() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return static_cast<GLuint>(mState.mExecutable->getActiveAtomicCounterBufferCount()); return static_cast<GLuint>(mState.mExecutable->getActiveAtomicCounterBufferCount());
} }
ANGLE_INLINE GLuint getActiveShaderStorageBlockCount() const ANGLE_INLINE GLuint getActiveShaderStorageBlockCount() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return static_cast<GLuint>(mState.mExecutable->getActiveShaderStorageBlockCount()); return static_cast<GLuint>(mState.mExecutable->getActiveShaderStorageBlockCount());
} }
...@@ -678,13 +678,13 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -678,13 +678,13 @@ class Program final : angle::NonCopyable, public LabeledObject
ANGLE_INLINE void addRef() ANGLE_INLINE void addRef()
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
mRefCount++; mRefCount++;
} }
ANGLE_INLINE void release(const Context *context) ANGLE_INLINE void release(const Context *context)
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
mRefCount--; mRefCount--;
if (mRefCount == 0 && mDeleteStatus) if (mRefCount == 0 && mDeleteStatus)
...@@ -719,7 +719,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -719,7 +719,7 @@ class Program final : angle::NonCopyable, public LabeledObject
const std::vector<SamplerBinding> &getSamplerBindings() const; const std::vector<SamplerBinding> &getSamplerBindings() const;
const std::vector<ImageBinding> &getImageBindings() const const std::vector<ImageBinding> &getImageBindings() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return mState.mImageBindings; return mState.mImageBindings;
} }
const sh::WorkGroupSize &getComputeShaderLocalSize() const; const sh::WorkGroupSize &getComputeShaderLocalSize() const;
...@@ -730,7 +730,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -730,7 +730,7 @@ class Program final : angle::NonCopyable, public LabeledObject
const ProgramState &getState() const const ProgramState &getState() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return mState; return mState;
} }
...@@ -769,7 +769,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -769,7 +769,7 @@ class Program final : angle::NonCopyable, public LabeledObject
int getNumViews() const int getNumViews() const
{ {
ASSERT(mLinkResolved); ASSERT(!mLinkingState);
return mState.getNumViews(); return mState.getNumViews();
} }
...@@ -796,7 +796,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -796,7 +796,7 @@ class Program final : angle::NonCopyable, public LabeledObject
// Try to resolve linking. Inlined to make sure its overhead is as low as possible. // Try to resolve linking. Inlined to make sure its overhead is as low as possible.
void resolveLink(const Context *context) void resolveLink(const Context *context)
{ {
if (!mLinkResolved) if (mLinkingState)
{ {
resolveLinkImpl(context); resolveLinkImpl(context);
} }
...@@ -956,7 +956,6 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -956,7 +956,6 @@ class Program final : angle::NonCopyable, public LabeledObject
ProgramAliasedBindings mFragmentOutputIndexes; ProgramAliasedBindings mFragmentOutputIndexes;
bool mLinked; bool mLinked;
bool mLinkResolved;
std::unique_ptr<LinkingState> mLinkingState; std::unique_ptr<LinkingState> mLinkingState;
bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use
......
...@@ -178,7 +178,7 @@ std::string ProgramExecutable::getInfoLogString() const ...@@ -178,7 +178,7 @@ std::string ProgramExecutable::getInfoLogString() const
bool ProgramExecutable::isAttribLocationActive(size_t attribLocation) const bool ProgramExecutable::isAttribLocationActive(size_t attribLocation) const
{ {
// TODO(timvp): http://anglebug.com/3570: Enable this assert here somehow. // TODO(timvp): http://anglebug.com/3570: Enable this assert here somehow.
// ASSERT(mLinkResolved); // ASSERT(!mLinkingState);
ASSERT(attribLocation < mActiveAttribLocationsMask.size()); ASSERT(attribLocation < mActiveAttribLocationsMask.size());
return mActiveAttribLocationsMask[attribLocation]; return mActiveAttribLocationsMask[attribLocation];
} }
...@@ -186,7 +186,7 @@ bool ProgramExecutable::isAttribLocationActive(size_t attribLocation) const ...@@ -186,7 +186,7 @@ bool ProgramExecutable::isAttribLocationActive(size_t attribLocation) const
AttributesMask ProgramExecutable::getAttributesMask() const AttributesMask ProgramExecutable::getAttributesMask() const
{ {
// TODO(timvp): http://anglebug.com/3570: Enable this assert here somehow. // TODO(timvp): http://anglebug.com/3570: Enable this assert here somehow.
// ASSERT(mLinkResolved); // ASSERT(!mLinkingState);
return mAttributesMask; return mAttributesMask;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment