[Mesa-dev] [PATCH] mesa: add EXT_debug_label support

Timothy Arceri tarceri at itsqueeze.com
Tue Dec 11 00:08:33 UTC 2018


KHR_debug already provides superior functionality but this
extension is still in use and adding support for it seems fairly
harmless. For example it seems to be used by Unity as seen in the
Parkitect trace attached to Mesa bug #108919.
---
 src/mapi/glapi/gen/gl_API.xml    | 17 +++++++++++++++++
 src/mesa/main/extensions_table.h |  1 +
 src/mesa/main/objectlabel.c      |  6 ++++++
 3 files changed, 24 insertions(+)

diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index f1def8090d..75423c4edb 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -12973,6 +12973,23 @@
     <enum name="GPU_MEMORY_INFO_EVICTED_MEMORY_NVX"           value="0x904B" />
 </category>
 
+<category name="GL_EXT_debug_label" number="439">
+  <function name="LabelObjectEXT" alias="ObjectLabel">
+    <param name="type" type="GLenum"/>
+    <param name="object" type="GLuint"/>
+    <param name="length" type="GLsizei"/>
+    <param name="label" type="const GLchar *"/>
+  </function>
+
+  <function name="GetObjectLabelEXT" alias="GetObjectLabel">
+    <param name="type" type="GLenum"/>
+    <param name="object" type="GLuint"/>
+    <param name="bufSize" type="GLsizei"/>
+    <param name="length" type="GLsizei"/>
+    <param name="label" type="GLchar *"/>
+  </function>
+</category>
+
 <xi:include href="AMD_gpu_shader_int64.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
 <category name="GL_NV_fill_rectangle" number="466">
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index dad38124d5..b68f6781c4 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -217,6 +217,7 @@ EXT(EXT_compiled_vertex_array               , dummy_true
 EXT(EXT_compressed_ETC1_RGB8_sub_texture    , OES_compressed_ETC1_RGB8_texture       ,  x ,  x , ES1, ES2, 2014)
 EXT(EXT_copy_image                          , OES_copy_image                         ,  x ,  x ,  x ,  30, 2014)
 EXT(EXT_copy_texture                        , dummy_true                             , GLL,  x ,  x ,  x , 1995)
+EXT(EXT_debug_label                         , dummy_true                             , GLL, GLC,  x ,  x , 2013)
 EXT(EXT_depth_bounds_test                   , EXT_depth_bounds_test                  , GLL, GLC,  x ,  x , 2002)
 EXT(EXT_discard_framebuffer                 , dummy_true                             ,  x ,  x , ES1, ES2, 2009)
 EXT(EXT_disjoint_timer_query                , EXT_disjoint_timer_query               ,  x ,  x ,  x , ES2, 2016)
diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
index 1e3022ee54..9d4cc1871e 100644
--- a/src/mesa/main/objectlabel.c
+++ b/src/mesa/main/objectlabel.c
@@ -139,6 +139,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
 
    switch (identifier) {
    case GL_BUFFER:
+   case GL_BUFFER_OBJECT_EXT:
       {
          struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name);
          if (bufObj)
@@ -146,6 +147,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
       }
       break;
    case GL_SHADER:
+   case GL_SHADER_OBJECT_EXT:
       {
          struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
          if (shader)
@@ -153,6 +155,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
       }
       break;
    case GL_PROGRAM:
+   case GL_PROGRAM_OBJECT_EXT:
       {
          struct gl_shader_program *program =
             _mesa_lookup_shader_program(ctx, name);
@@ -161,6 +164,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
       }
       break;
    case GL_VERTEX_ARRAY:
+   case GL_VERTEX_ARRAY_OBJECT_EXT:
       {
          struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, name);
          if (obj)
@@ -168,6 +172,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
       }
       break;
    case GL_QUERY:
+   case GL_QUERY_OBJECT_EXT:
       {
          struct gl_query_object *query = _mesa_lookup_query_object(ctx, name);
          if (query)
@@ -225,6 +230,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
       }
       break;
    case GL_PROGRAM_PIPELINE:
+   case GL_PROGRAM_PIPELINE_OBJECT_EXT:
       {
          struct gl_pipeline_object *pipe =
             _mesa_lookup_pipeline_object(ctx, name);
-- 
2.19.2



More information about the mesa-dev mailing list