KHR_debug indicates that message id's can be used to filter debug logs. Mesa incorrectly generates incrementing message id's for each message in shader_debug_log. The ids must be stable if they are to be used for filtering.
_mesa_gl_vdebug expects the address of a static GLuint, which is assigned at the first log event and remains stable for subsequent events. --- src/intel/compiler/brw_compiler.h | 2 +- src/intel/compiler/brw_fs_generator.cpp | 3 ++- src/intel/compiler/brw_vec4_generator.cpp | 3 ++- src/intel/vulkan/anv_device.c | 2 +- src/mesa/drivers/dri/i965/intel_screen.c | 5 ++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index e4f4d83c8e8..ca9d41ca7a8 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -89,7 +89,7 @@ struct brw_compiler { int aligned_pairs_class; } fs_reg_sets[3]; - void (*shader_debug_log)(void *, const char *str, ...) PRINTFLIKE(2, 3); + void (*shader_debug_log)(void *, GLuint *msg_id, const char *str, ...) PRINTFLIKE(3, 4); void (*shader_perf_log)(void *, const char *str, ...) PRINTFLIKE(2, 3); bool scalar_stage[MESA_SHADER_STAGES]; diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp index ebf63b07837..a8618912cf4 100644 --- a/src/intel/compiler/brw_fs_generator.cpp +++ b/src/intel/compiler/brw_fs_generator.cpp @@ -2476,7 +2476,8 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width) ralloc_free(disasm_info); assert(validated); - compiler->shader_debug_log(log_data, + static GLuint msg_id = 0; + compiler->shader_debug_log(log_data, &msg_id, "%s SIMD%d shader: %d inst, %d loops, %u cycles, " "%d:%d spills:fills, Promoted %u constants, " "compacted %d to %d bytes.", diff --git a/src/intel/compiler/brw_vec4_generator.cpp b/src/intel/compiler/brw_vec4_generator.cpp index ee232cbf96e..00c89b21daf 100644 --- a/src/intel/compiler/brw_vec4_generator.cpp +++ b/src/intel/compiler/brw_vec4_generator.cpp @@ -2211,7 +2211,8 @@ generate_code(struct brw_codegen *p, ralloc_free(disasm_info); assert(validated); - compiler->shader_debug_log(log_data, + static GLuint msg_id = 0; + compiler->shader_debug_log(log_data, &msg_id, "%s vec4 shader: %d inst, %d loops, %u cycles, " "%d:%d spills:fills, compacted %d to %d bytes.", stage_abbrev, before_size / 16, diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 6b5ba25c6bc..e60f7327ec1 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -45,7 +45,7 @@ #include "genxml/gen7_pack.h" static void -compiler_debug_log(void *data, const char *fmt, ...) +compiler_debug_log(void *data, GLuint *id, const char *fmt, ...) { } static void diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index c0201357869..6b54767f8dd 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -2389,14 +2389,13 @@ intel_device_get_revision(int fd) } static void -shader_debug_log_mesa(void *data, const char *fmt, ...) +shader_debug_log_mesa(void *data, GLuint *msg_id, const char *fmt, ...) { struct brw_context *brw = (struct brw_context *)data; va_list args; va_start(args, fmt); - GLuint msg_id = 0; - _mesa_gl_vdebugf(&brw->ctx, &msg_id, + _mesa_gl_vdebugf(&brw->ctx, msg_id, MESA_DEBUG_SOURCE_SHADER_COMPILER, MESA_DEBUG_TYPE_OTHER, MESA_DEBUG_SEVERITY_NOTIFICATION, fmt, args); -- 2.19.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev