From 98a8ca1c48592892eb3a6a6518cd85613624dfcc Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 16 Apr 2015 22:24:35 +0200 Subject: gltrace, glretrace: translate enums if emulating KHR_debug with EXT_debug_label Some of the identifiers (types in EXT_debug_label) are different between these two extensions, which led to GL errors when applications used KHR_debug with those. (The only non-translatable one seems to be GL_DISPLAY_LIST which is compat only.) --- dispatch/glproc.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) (limited to 'dispatch') diff --git a/dispatch/glproc.py b/dispatch/glproc.py index 81c30ad4..a94cefee 100644 --- a/dispatch/glproc.py +++ b/dispatch/glproc.py @@ -504,11 +504,69 @@ class GlDispatcher(Dispatcher): def failFunction(self, function): # We fake these when they are not available if sys.platform == 'darwin': - # Fallback to EXT_debug_label on MacOSX + # Fallback to EXT_debug_label on MacOSX, some enums need to be translated. if function.name == 'glObjectLabel': + print r' switch(identifier) {' + print r' case GL_TEXTURE:' + print r' case GL_FRAMEBUFFER:' + print r' case GL_RENDERBUFFER:' + print r' case GL_SAMPLER:' + print r' case GL_TRANSFORM_FEEDBACK:' + print r' break;' + print r' case GL_BUFFER:' + print r' identifier = GL_BUFFER_OBJECT_EXT;' + print r' break;' + print r' case GL_SHADER:' + print r' identifier = GL_SHADER_OBJECT_EXT;' + print r' break;' + print r' case GL_PROGRAM:' + print r' identifier = GL_PROGRAM_OBJECT_EXT;' + print r' break;' + print r' case GL_VERTEX_ARRAY:' + print r' identifier = GL_VERTEX_ARRAY_OBJECT_EXT;' + print r' break;' + print r' case GL_QUERY:' + print r' identifier = GL_QUERY_OBJECT_EXT;' + print r' break;' + print r' case GL_PROGRAM_PIPELINE:' + print r' identifier = GL_PROGRAM_PIPELINE_OBJECT_EXT;' + print r' break;' + print r' default:' + print r' return;' + print r' }' print r' _glLabelObjectEXT(identifier, name, length < 0 ? 0 : length, length == 0 ? "" : label);' return if function.name == 'glGetObjectLabel': + print r' switch(identifier) {' + print r' case GL_TEXTURE:' + print r' case GL_FRAMEBUFFER:' + print r' case GL_RENDERBUFFER:' + print r' case GL_SAMPLER:' + print r' case GL_TRANSFORM_FEEDBACK:' + print r' break;' + print r' case GL_BUFFER:' + print r' identifier = GL_BUFFER_OBJECT_EXT;' + print r' break;' + print r' case GL_SHADER:' + print r' identifier = GL_SHADER_OBJECT_EXT;' + print r' break;' + print r' case GL_PROGRAM:' + print r' identifier = GL_PROGRAM_OBJECT_EXT;' + print r' break;' + print r' case GL_VERTEX_ARRAY:' + print r' identifier = GL_VERTEX_ARRAY_OBJECT_EXT;' + print r' break;' + print r' case GL_QUERY:' + print r' identifier = GL_QUERY_OBJECT_EXT;' + print r' break;' + print r' case GL_PROGRAM_PIPELINE:' + print r' identifier = GL_PROGRAM_PIPELINE_OBJECT_EXT;' + print r' break;' + print r' default:' + print r' if (length != 0) *length = 0;' + print r' if (label != 0 && bufSize > 0) *label = 0;' + print r' return;' + print r' }' print r' _glGetObjectLabelEXT(identifier, name, bufSize, length, label);' return if function.name in ( -- cgit v1.2.3