From eb205e689d944f1c455f1078c7057dca0d0b816f Mon Sep 17 00:00:00 2001 From: Shahbaz Youssefi Date: Thu, 6 Jul 2023 13:34:28 -0400 Subject: [PATCH] Make the glPatchParameteri entry point lockless This entry points only sets context-local state and thus doesn't require locking. Bug: angleproject:8224 Change-Id: I17975a97aa7f68c3ddf2ef78069b8f519fdc4c1a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4670405 Commit-Queue: Shahbaz Youssefi Reviewed-by: Charlie Lao Reviewed-by: Igor Nazarov --- .../code_generation_hashes/GL_EGL_entry_points.json | 10 +++++----- scripts/generate_entry_points.py | 1 + src/libANGLE/Context.cpp | 12 ------------ src/libANGLE/Context_gles_3_2_autogen.h | 1 - src/libANGLE/State.h | 1 - src/libANGLE/context_local_call_gles.cpp | 12 ++++++++++++ src/libANGLE/context_local_call_gles_autogen.h | 1 + src/libGLESv2/entry_points_gles_3_2_autogen.cpp | 3 +-- src/libGLESv2/entry_points_gles_ext_autogen.cpp | 3 +-- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/scripts/code_generation_hashes/GL_EGL_entry_points.json b/scripts/code_generation_hashes/GL_EGL_entry_points.json index b5a245c2f..34fdc0879 100644 --- a/scripts/code_generation_hashes/GL_EGL_entry_points.json +++ b/scripts/code_generation_hashes/GL_EGL_entry_points.json @@ -6,7 +6,7 @@ "scripts/entry_point_packed_gl_enums.json": "1c6b036918aabb9822a638fbf33f87f4", "scripts/generate_entry_points.py": - "01e764c05b0017ccc7bf5b3ff743f9ec", + "11833043e0716dc65951aa2783fc23dc", "scripts/gl_angle_ext.xml": "49a0bf469d6f44c532098ef3a9fd087f", "scripts/registry_xml.py": @@ -36,7 +36,7 @@ "src/libANGLE/Context_gles_3_1_autogen.h": "17b51301bb3edd475460e8e77ff21a1c", "src/libANGLE/Context_gles_3_2_autogen.h": - "84d3d40446ba74d0fbf84dc523cf1073", + "cf9900e0067812fc6773e8ae4664da33", "src/libANGLE/Context_gles_ext_autogen.h": "289bd74bd8002bcc2a07d54de9672a3c", "src/libANGLE/capture/capture_egl_autogen.cpp": @@ -86,7 +86,7 @@ "src/libANGLE/context_local_call_gl_autogen.h": "f4171b14eac111a51ec641e24e13af42", "src/libANGLE/context_local_call_gles_autogen.h": - "ba14981bf40a7f4a4f989b1356b035ad", + "ceafc2d77e2331e1f09033ea467de577", "src/libANGLE/validationCL_autogen.h": "0022d0cdb6a9e2ef4a59b71164f62333", "src/libANGLE/validationEGL_autogen.h": @@ -170,11 +170,11 @@ "src/libGLESv2/entry_points_gles_3_1_autogen.h": "a7327c330a91665fc31accbb78793b42", "src/libGLESv2/entry_points_gles_3_2_autogen.cpp": - "386af5a47a38b4e63a9967ed644d62de", + "54acce01e44e922d784fa61ee679e477", "src/libGLESv2/entry_points_gles_3_2_autogen.h": "647f932a299cdb4726b60bbba059f0d2", "src/libGLESv2/entry_points_gles_ext_autogen.cpp": - "7d00b1545f3d0d5621e54103675b02fe", + "449dabfdeecfd219068534c4280d390b", "src/libGLESv2/entry_points_gles_ext_autogen.h": "7bb44566362d1de21552faf427517085", "src/libGLESv2/libGLESv2_autogen.cpp": diff --git a/scripts/generate_entry_points.py b/scripts/generate_entry_points.py index 3957fa0bc..6b4dad95a 100755 --- a/scripts/generate_entry_points.py +++ b/scripts/generate_entry_points.py @@ -160,6 +160,7 @@ CONTEXT_LOCAL_LIST = [ 'glLineWidth', 'glLogicOpANGLE', 'glMinSampleShading', + 'glPatchParameteri', 'glPixelStorei', 'glPolygonMode', 'glPolygonModeNV', diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp index 056f24745..f123bf9f8 100644 --- a/src/libANGLE/Context.cpp +++ b/src/libANGLE/Context.cpp @@ -7392,18 +7392,6 @@ void Context::shaderSource(ShaderProgramID shader, shaderObject->setSource(this, count, string, length); } -void Context::patchParameteri(GLenum pname, GLint value) -{ - switch (pname) - { - case GL_PATCH_VERTICES: - mState.setPatchVertices(value); - break; - default: - break; - } -} - Program *Context::getActiveLinkedProgram() const { Program *program = mState.getLinkedProgram(this); diff --git a/src/libANGLE/Context_gles_3_2_autogen.h b/src/libANGLE/Context_gles_3_2_autogen.h index 46645d804..eb7b9fc64 100644 --- a/src/libANGLE/Context_gles_3_2_autogen.h +++ b/src/libANGLE/Context_gles_3_2_autogen.h @@ -52,7 +52,6 @@ GLsizei bufSize, GLuint *params); \ void objectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label); \ void objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label); \ - void patchParameteri(GLenum pname, GLint value); \ void popDebugGroup(); \ void pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message); \ void readnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, \ diff --git a/src/libANGLE/State.h b/src/libANGLE/State.h index f06a2933c..ce15090d8 100644 --- a/src/libANGLE/State.h +++ b/src/libANGLE/State.h @@ -1323,7 +1323,6 @@ class State : angle::NonCopyable PixelUnpackState &getUnpackState() { return mLocalState.getUnpackState(); } GLenum getCoverageModulation() const { return mLocalState.getCoverageModulation(); } bool getFramebufferSRGB() const { return mLocalState.getFramebufferSRGB(); } - void setPatchVertices(GLuint value) { mLocalState.setPatchVertices(value); } GLuint getPatchVertices() const { return mLocalState.getPatchVertices(); } void setPixelLocalStorageActivePlanes(GLsizei n) { diff --git a/src/libANGLE/context_local_call_gles.cpp b/src/libANGLE/context_local_call_gles.cpp index a94ffb75f..ad9b6cb26 100644 --- a/src/libANGLE/context_local_call_gles.cpp +++ b/src/libANGLE/context_local_call_gles.cpp @@ -580,4 +580,16 @@ GLboolean ContextLocalIsEnabledi(Context *context, GLenum target, GLuint index) { return context->getState().localState().getEnableFeatureIndexed(target, index); } + +void ContextLocalPatchParameteri(Context *context, GLenum pname, GLint value) +{ + switch (pname) + { + case GL_PATCH_VERTICES: + context->getMutableLocalState()->setPatchVertices(value); + break; + default: + break; + } +} } // namespace gl diff --git a/src/libANGLE/context_local_call_gles_autogen.h b/src/libANGLE/context_local_call_gles_autogen.h index efc418b3c..bb9cb444f 100644 --- a/src/libANGLE/context_local_call_gles_autogen.h +++ b/src/libANGLE/context_local_call_gles_autogen.h @@ -120,6 +120,7 @@ void ContextLocalDisablei(Context *context, GLenum target, GLuint index); void ContextLocalEnablei(Context *context, GLenum target, GLuint index); GLboolean ContextLocalIsEnabledi(Context *context, GLenum target, GLuint index); void ContextLocalMinSampleShading(Context *context, GLfloat value); +void ContextLocalPatchParameteri(Context *context, GLenum pname, GLint value); void ContextLocalPrimitiveBoundingBox(Context *context, GLfloat minX, GLfloat minY, diff --git a/src/libGLESv2/entry_points_gles_3_2_autogen.cpp b/src/libGLESv2/entry_points_gles_3_2_autogen.cpp index 39c9b9604..2422709f4 100644 --- a/src/libGLESv2/entry_points_gles_3_2_autogen.cpp +++ b/src/libGLESv2/entry_points_gles_3_2_autogen.cpp @@ -1009,7 +1009,6 @@ void GL_APIENTRY GL_PatchParameteri(GLenum pname, GLint value) if (context) { - SCOPED_SHARE_CONTEXT_LOCK(context); bool isCallValid = (context->skipValidation() || (ValidatePixelLocalStorageInactive(context, angle::EntryPoint::GLPatchParameteri) && @@ -1017,7 +1016,7 @@ void GL_APIENTRY GL_PatchParameteri(GLenum pname, GLint value) value))); if (isCallValid) { - context->patchParameteri(pname, value); + ContextLocalPatchParameteri(context, pname, value); } ANGLE_CAPTURE_GL(PatchParameteri, isCallValid, context, pname, value); } diff --git a/src/libGLESv2/entry_points_gles_ext_autogen.cpp b/src/libGLESv2/entry_points_gles_ext_autogen.cpp index 02cbdb5b0..3730fc7b9 100644 --- a/src/libGLESv2/entry_points_gles_ext_autogen.cpp +++ b/src/libGLESv2/entry_points_gles_ext_autogen.cpp @@ -9174,7 +9174,6 @@ void GL_APIENTRY GL_PatchParameteriEXT(GLenum pname, GLint value) if (context) { - SCOPED_SHARE_CONTEXT_LOCK(context); bool isCallValid = (context->skipValidation() || (ValidatePixelLocalStorageInactive(context, angle::EntryPoint::GLPatchParameteriEXT) && @@ -9182,7 +9181,7 @@ void GL_APIENTRY GL_PatchParameteriEXT(GLenum pname, GLint value) value))); if (isCallValid) { - context->patchParameteri(pname, value); + ContextLocalPatchParameteri(context, pname, value); } ANGLE_CAPTURE_GL(PatchParameteriEXT, isCallValid, context, pname, value); }