Hash :
fa29f604
        
        Author :
  
        
        Date :
2025-07-02T13:23:31
        
      
Remove sharedContextLock from {Enable|Disable}VertexAttribArray
VertexArray objects are per context objects. In theory they do not need
to protected by shared context lock. The reason we are taking locks
because all these functions end up accessing Buffer object which are
shared. In prior CLs we have removed subject observer usage from
VertexArray which means VertexArray no longer accessed from other
thread. In prior CLs we also split VertexArray into two classes:
VertexArrayPrivate which has no buffer, and VertexArray which is
subclass from VertexArrayPrivate and owns buffer. In this CL,
glEnableVertexAttribArray and glDisableVertexAttribArray calls no longer
take shared context lock. ContextPrivateEnableVertexAttribArray and
ContextPrivateDisableVertexAttribArray are called from these two APIs
and they only have access to StatePrivate. State Private holds a
VertexArrayPrivate pointer, which means they do not have anyway to
access buffer objects. The main challenge I run into here is
mCachedActiveClientAttribsMask, mCachedActiveBufferedAttribsMask,
mCachedActiveDefaultAttribsMask, mCachedHasAnyEnabledClientAttrib,
mCachedNonInstancedVertexElementLimit,
mCachedInstancedVertexElementLimit. These StateCache variable needs to
be updated when these two APIs are called, and calculating these
variable needs access to buffer object. The solution here is adding a
bool mIsCachedActiveAttribMasksValid in the PrivateStateCache so that
instead of immediately update these mCached* variable, we just set
mIsCachedActiveAttribMasksValid to false. Then whenever any of these
mCached* variable is needed, we will check
mIsCachedActiveAttribMasksValid and calculate these cached variables. It
adds one if check when accessing these caches, but the other benefit is
that we may have avoided duplicated calculation when multiple states
changed.
Bug: b/433331119
Change-Id: I3227c72bc40501712db93fb3d540b835f07150b5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4514436
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Charlie Lao <cclao@google.com>
Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>