summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-03-22 16:50:58 -0700
committerEric Anholt <[email protected]>2013-04-01 11:30:36 -0700
commit229a51cdbe3128626fd359fe03722a55e40927d7 (patch)
tree760a03b002b6deb344f18823a882a88fc3523299
parent777a7f2003f260cc383f14029413f48101ae5718 (diff)
i965: Dump shader source for linked shader programs.
We dump shader source in ir_to_mesa.cpp, and we dump linked programs here, but we had no reference from the linked programs to their source. This was preventing improvement of shader-db to use linked shader programs instead of individual shader files (which is bogus, because it means we optimize out VS outputs, and don't interpolate FS inputs!) Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 066cf4e21f3..1a520391ec1 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -113,6 +113,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
struct brw_context *brw = brw_context(ctx);
struct intel_context *intel = &brw->intel;
unsigned int stage;
+ static const char *target_strings[]
+ = { "vertex", "fragment", "geometry" };
for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
struct brw_shader *shader =
@@ -256,12 +258,26 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
_mesa_reference_program(ctx, &prog, NULL);
if (ctx->Shader.Flags & GLSL_DUMP) {
- static const char *target_strings[]
- = { "vertex", "fragment", "geometry" };
printf("\n");
printf("GLSL IR for linked %s program %d:\n", target_strings[stage],
shProg->Name);
_mesa_print_ir(shader->base.ir, NULL);
+ printf("\n");
+ }
+ }
+
+ if (ctx->Shader.Flags & GLSL_DUMP) {
+ for (unsigned i = 0; i < shProg->NumShaders; i++) {
+ const struct gl_shader *sh = shProg->Shaders[i];
+ if (!sh)
+ continue;
+
+ printf("GLSL %s shader %d source for linked program %d:\n",
+ target_strings[_mesa_shader_type_to_index(sh->Type)],
+ i,
+ shProg->Name);
+ printf("%s", sh->Source);
+ printf("\n");
}
}