[Mesa-dev] [PATCH 07/11] i965/compiler: provide formatted strings to the shader debug log

Mark Janes mark.a.janes at intel.com
Fri Dec 7 00:35:48 UTC 2018


---
 src/intel/compiler/brw_compiler.h         |  2 +-
 src/intel/compiler/brw_fs_generator.cpp   |  2 +-
 src/intel/compiler/brw_vec4_generator.cpp |  3 +--
 src/intel/vulkan/anv_device.c             |  2 +-
 src/mesa/drivers/dri/i965/intel_screen.c  | 19 ++++++++++---------
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
index ca9d41ca7a8..816b96b24e6 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 *, GLuint *msg_id, const char *str, ...) PRINTFLIKE(3, 4);
+   void (*shader_debug_log)(void *, GLuint *msg_id, const char *buf);
    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 6b80f8433b2..10cc6b2ff15 100644
--- a/src/intel/compiler/brw_fs_generator.cpp
+++ b/src/intel/compiler/brw_fs_generator.cpp
@@ -2487,7 +2487,7 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
    assert(validated);
 
    static GLuint msg_id = 0;
-   compiler->shader_debug_log(log_data, &msg_id, "%s", buf);
+   compiler->shader_debug_log(log_data, &msg_id, buf);
    free(buf);
    return start_offset;
 }
diff --git a/src/intel/compiler/brw_vec4_generator.cpp b/src/intel/compiler/brw_vec4_generator.cpp
index f56ec6aa9a1..0ed1c8d99fa 100644
--- a/src/intel/compiler/brw_vec4_generator.cpp
+++ b/src/intel/compiler/brw_vec4_generator.cpp
@@ -2220,8 +2220,7 @@ generate_code(struct brw_codegen *p,
 
    fclose(log_fp);
    static GLuint msg_id = 0;
-   compiler->shader_debug_log(log_data, &msg_id,
-                              "%s", buf);
+   compiler->shader_debug_log(log_data, &msg_id, buf);
    free(buf);
 }
 
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index e60f7327ec1..f8ecf2f6991 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, GLuint *id, const char *fmt, ...)
+compiler_debug_log(void *data, GLuint *id, const char *buf)
 { }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 6b54767f8dd..ed0eaa783db 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -2389,17 +2389,18 @@ intel_device_get_revision(int fd)
 }
 
 static void
-shader_debug_log_mesa(void *data, GLuint *msg_id, const char *fmt, ...)
+shader_debug_log_mesa(void *data, GLuint *msg_id, const char *buf)
 {
    struct brw_context *brw = (struct brw_context *)data;
-   va_list args;
-
-   va_start(args, fmt);
-   _mesa_gl_vdebugf(&brw->ctx, msg_id,
-                    MESA_DEBUG_SOURCE_SHADER_COMPILER,
-                    MESA_DEBUG_TYPE_OTHER,
-                    MESA_DEBUG_SEVERITY_NOTIFICATION, fmt, args);
-   va_end(args);
+   const size_t len = strlen(buf);
+   const char *buf_ptr = buf;
+   while (buf_ptr < buf + len) {
+      buf_ptr += _mesa_gl_debug(&brw->ctx, msg_id,
+                                MESA_DEBUG_SOURCE_SHADER_COMPILER,
+                                MESA_DEBUG_TYPE_OTHER,
+                                MESA_DEBUG_SEVERITY_NOTIFICATION,
+                                buf_ptr);
+   }
 }
 
 static void
-- 
2.19.2



More information about the mesa-dev mailing list