Mesa (master): mesa: add glInternalSetError for glthread

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Nov 21 21:21:13 UTC 2020


Module: Mesa
Branch: master
Commit: ac4dc6e139b8ed84622ba0fcdcea4ec15e60b586
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac4dc6e139b8ed84622ba0fcdcea4ec15e60b586

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Oct  3 15:19:19 2020 -0400

mesa: add glInternalSetError for glthread

glthread wants to set GL errors, but has to do it by adding the SetError
call into the queue for it to be thread-safe.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7053>

---

 src/mapi/glapi/gen/gl_API.xml           |  5 +++++
 src/mapi/glapi/gen/static_data.py       |  1 +
 src/mesa/main/errors.c                  | 10 ++++++++++
 src/mesa/main/errors.h                  |  2 ++
 src/mesa/main/tests/dispatch_sanity.cpp |  2 ++
 5 files changed, 20 insertions(+)

diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 26f9e4ffba9..15905bb029e 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -13305,6 +13305,11 @@
         <param name="named" type="GLboolean"/>
         <param name="ext_dsa" type="GLboolean"/>
     </function>
+
+    <!-- Set a GL error. Used by glthread to set errors without syncing. -->
+    <function name="InternalSetError" es2="2.0">
+        <param name="error" type="GLenum"/>
+    </function>
 </category>
 
 <xi:include href="OES_EGL_image.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 2e91831f864..5b51c222d79 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1676,6 +1676,7 @@ offsets = {
     "FogCoordhvNV": 1640,
     "SecondaryColor3hNV": 1641,
     "SecondaryColor3hvNV": 1642,
+    "InternalSetError": 1643,
 }
 
 functions = [
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 02517c1c407..a3f9cac8797 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -432,3 +432,13 @@ _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
 
    _mesa_log_msg(ctx, source, type, *id, severity, len, msg);
 }
+
+/**
+ * Set the parameter as the current GL error. Used by glthread.
+ */
+void GLAPIENTRY
+_mesa_InternalSetError(GLenum error)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_error(ctx, error, "glthread");
+}
diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h
index 17fe380f26a..9549093b090 100644
--- a/src/mesa/main/errors.h
+++ b/src/mesa/main/errors.h
@@ -109,6 +109,8 @@ _mesa_gl_debug(struct gl_context *ctx,
    }                                                                      \
 } while (0)
 
+void GLAPIENTRY
+_mesa_InternalSetError(GLenum error);
 
 #ifdef __cplusplus
 }
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 8fdfeb8f3b8..72c1e0bc739 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1443,6 +1443,7 @@ const struct function common_desktop_functions_possible[] = {
    { "glViewportSwizzleNV", 11, -1 },
 
    { "glInternalBufferSubDataCopyMESA", 11, -1 },
+   { "glInternalSetError", 20, -1 },
 
    { NULL, 0, -1 }
 };
@@ -2494,6 +2495,7 @@ const struct function gles2_functions_possible[] = {
    { "glMaxShaderCompilerThreadsKHR", 20, -1 },
 
    { "glInternalBufferSubDataCopyMESA", 20, -1 },
+   { "glInternalSetError", 20, -1 },
 
    { NULL, 0, -1 }
 };



More information about the mesa-commit mailing list