diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-04-21 12:09:21 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-04-21 12:09:21 +0100 |
commit | 7f98ed3fb6f35050d9d377fd5ab4025e798156ea (patch) | |
tree | 597d5214dd81a62df654ed3fe61648636bea8ca7 /dispatch | |
parent | 98a8ca1c48592892eb3a6a6518cd85613624dfcc (diff) |
gltrace,glretrace: Refactor EXT_debug_label -> KHR_debug identifier translation.
Diffstat (limited to 'dispatch')
-rw-r--r-- | dispatch/glproc.py | 99 |
1 files changed, 39 insertions, 60 deletions
diff --git a/dispatch/glproc.py b/dispatch/glproc.py index a94cefee..a1231f98 100644 --- a/dispatch/glproc.py +++ b/dispatch/glproc.py @@ -506,69 +506,15 @@ class GlDispatcher(Dispatcher): if sys.platform == 'darwin': # 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' if (translateDebugLabelIdentifier(identifier)) {' + print r' _glLabelObjectEXT(identifier, name, length < 0 ? 0 : length, length == 0 ? "" : label);' + 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' if (translateDebugLabelIdentifier(identifier)) {' + print r' _glGetObjectLabelEXT(identifier, name, bufSize, length, label);' + print r' return;' print r' }' - print r' _glGetObjectLabelEXT(identifier, name, bufSize, length, label);' - return if function.name in ( # GL_KHR_debug 'glDebugMessageControl', @@ -676,6 +622,39 @@ if __name__ == '__main__': print print '#elif defined(__APPLE__)' print + print 'static inline bool' + print 'translateDebugLabelIdentifier(GLenum & identifier)' + print '{' + print ' switch (identifier) {' + print ' case GL_TEXTURE:' + print ' case GL_FRAMEBUFFER:' + print ' case GL_RENDERBUFFER:' + print ' case GL_SAMPLER:' + print ' case GL_TRANSFORM_FEEDBACK:' + print ' return true;' + print ' case GL_BUFFER:' + print ' identifier = GL_BUFFER_OBJECT_EXT;' + print ' return true;' + print ' case GL_SHADER:' + print ' identifier = GL_SHADER_OBJECT_EXT;' + print ' return true;' + print ' case GL_PROGRAM:' + print ' identifier = GL_PROGRAM_OBJECT_EXT;' + print ' return true;' + print ' case GL_VERTEX_ARRAY:' + print ' identifier = GL_VERTEX_ARRAY_OBJECT_EXT;' + print ' return true;' + print ' case GL_QUERY:' + print ' identifier = GL_QUERY_OBJECT_EXT;' + print ' return true;' + print ' case GL_PROGRAM_PIPELINE:' + print ' identifier = GL_PROGRAM_PIPELINE_OBJECT_EXT;' + print ' return true;' + print ' default:' + print ' return false;' + print ' }' + print '}' + print dispatcher.dispatchModuleImpl(cglapi) print print '#elif defined(HAVE_X11)' |