summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/radeonsi_shader.c
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2012-06-07 19:30:47 +0200
committerMichel Dänzer <[email protected]>2012-06-12 18:33:54 +0200
commit4c4ef9c29acf4f1f40aa3c5d268322efd26c1786 (patch)
treebbdae4c84db998b742c9985b74c2c360129648c6 /src/gallium/drivers/radeonsi/radeonsi_shader.c
parent7b11051a28731b099dc47df9e5db7eccfa889369 (diff)
radeonsi: Only dump shaders with environment variable RADEON_DUMP_SHADERS=1.
Diffstat (limited to 'src/gallium/drivers/radeonsi/radeonsi_shader.c')
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_shader.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index e625a74338a..0a4f04bdb12 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -543,6 +543,9 @@ int si_pipe_shader_create(
unsigned char * inst_bytes;
unsigned inst_byte_count;
unsigned i;
+ bool dump;
+
+ dump = debug_get_bool_option("RADEON_DUMP_SHADERS", FALSE);
radeon_llvm_context_init(&si_shader_ctx.radeon_bld);
bld_base = &si_shader_ctx.radeon_bld.soa.bld_base;
@@ -568,14 +571,18 @@ int si_pipe_shader_create(
radeon_llvm_finalize_module(&si_shader_ctx.radeon_bld);
mod = bld_base->base.gallivm->module;
- tgsi_dump(shader->tokens, 0);
- LLVMDumpModule(mod);
- radeon_llvm_compile(mod, &inst_bytes, &inst_byte_count, "SI", 1 /* dump */);
- fprintf(stderr, "SI CODE:\n");
- for (i = 0; i < inst_byte_count; i+=4 ) {
- fprintf(stderr, "%02x%02x%02x%02x\n", inst_bytes[i + 3],
- inst_bytes[i + 2], inst_bytes[i + 1],
- inst_bytes[i]);
+ if (dump) {
+ tgsi_dump(shader->tokens, 0);
+ LLVMDumpModule(mod);
+ }
+ radeon_llvm_compile(mod, &inst_bytes, &inst_byte_count, "SI", dump);
+ if (dump) {
+ fprintf(stderr, "SI CODE:\n");
+ for (i = 0; i < inst_byte_count; i+=4 ) {
+ fprintf(stderr, "%02x%02x%02x%02x\n", inst_bytes[i + 3],
+ inst_bytes[i + 2], inst_bytes[i + 1],
+ inst_bytes[i]);
+ }
}
shader->num_sgprs = util_le32_to_cpu(*(uint32_t*)inst_bytes);