From ac4dc6e139b8ed84622ba0fcdcea4ec15e60b586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 3 Oct 2020 15:19:19 -0400 Subject: [PATCH] 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 Part-of: --- 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 @@ + + + + + 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 } };