[Mesa-dev] [PATCH 10/11] i965: provide GLSL IR to KHR_debug

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


---
 src/mesa/drivers/dri/i965/brw_link.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 2cbb1e0b879..24e0079fc5d 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -251,10 +251,18 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
          (INTEL_DEBUG & intel_debug_flag_for_shader_stage(shader->Stage));
 
       if (debug_enabled && shader->ir) {
-         fprintf(stderr, "GLSL IR for native %s shader %d:\n",
+         char *buf;
+         size_t buf_size;
+         FILE * log_fp = open_memstream(&buf, &buf_size);
+         fprintf(log_fp, "GLSL IR for native %s shader %d:\n",
                  _mesa_shader_stage_to_string(shader->Stage), shProg->Name);
-         _mesa_print_ir(stderr, shader->ir, NULL);
-         fprintf(stderr, "\n\n");
+         _mesa_print_ir(log_fp, shader->ir, NULL);
+         fprintf(log_fp, "\n\n");
+         fclose(log_fp);
+         static GLuint msg_id = 0;
+         shader_debug_log_mesa(brw, &msg_id, buf);
+         fputs(buf, stderr);
+         free(buf);
       }
 
       prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage,
-- 
2.19.2



More information about the mesa-dev mailing list