diff options
author | Michel Dänzer <[email protected]> | 2012-06-07 19:30:47 +0200 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2012-06-12 18:33:54 +0200 |
commit | 4c4ef9c29acf4f1f40aa3c5d268322efd26c1786 (patch) | |
tree | bbdae4c84db998b742c9985b74c2c360129648c6 /src/gallium/drivers | |
parent | 7b11051a28731b099dc47df9e5db7eccfa889369 (diff) |
radeonsi: Only dump shaders with environment variable RADEON_DUMP_SHADERS=1.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeon/SICodeEmitter.cpp | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_shader.c | 23 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/gallium/drivers/radeon/SICodeEmitter.cpp b/src/gallium/drivers/radeon/SICodeEmitter.cpp index 1d247061e41..585d4180e4d 100644 --- a/src/gallium/drivers/radeon/SICodeEmitter.cpp +++ b/src/gallium/drivers/radeon/SICodeEmitter.cpp @@ -156,8 +156,12 @@ void SICodeEmitter::emitState(MachineFunction & MF) bool SICodeEmitter::runOnMachineFunction(MachineFunction &MF) { - MF.dump(); TM = &MF.getTarget(); + const AMDILSubtarget &STM = TM->getSubtarget<AMDILSubtarget>(); + + if (STM.dumpCode()) { + MF.dump(); + } emitState(MF); 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); |