uint32_t *bytecode;
int i, j, r, fs_size;
struct r600_fetch_shader *shader;
+ unsigned sb_disasm = rctx->screen->debug_flags & (DBG_SB_DISASM | DBG_SB);
assert(count < 32);
fprintf(stderr, "\n");
}
-#if 0
- r600_bytecode_disasm(&bc);
+ if (!sb_disasm) {
+ r600_bytecode_disasm(&bc);
- fprintf(stderr, "______________________________________________________________\n");
-#else
- r600_sb_bytecode_process(rctx, &bc, NULL, 1 /*dump*/, 0 /*optimize*/);
-#endif
+ fprintf(stderr, "______________________________________________________________\n");
+ } else {
+ r600_sb_bytecode_process(rctx, &bc, NULL, 1 /*dump*/, 0 /*optimize*/);
+ }
}
fs_size = bc.ndw*4;
{ "sbstat", DBG_SB_STAT, "Print optimization statistics for shaders" },
{ "sbdump", DBG_SB_DUMP, "Print IR dumps after some optimization passes" },
{ "sbnofallback", DBG_SB_NO_FALLBACK, "Abort on errors instead of fallback" },
+ { "sbdisasm", DBG_SB_DISASM, "Use sb disassembler for shader dumps" },
DEBUG_NAMED_VALUE_END /* must be last */
};
uint32_t *ptr;
bool dump = r600_can_dump_shader(rctx->screen, tgsi_get_processor_type(sel->tokens));
unsigned use_sb = rctx->screen->debug_flags & DBG_SB;
+ unsigned sb_disasm = use_sb || (rctx->screen->debug_flags & DBG_SB_DISASM);
shader->shader.bc.isa = rctx->isa;
return r;
}
-#if 0
- if (dump) {
+ if (dump && !sb_disasm) {
fprintf(stderr, "--------------------------------------------------------------\n");
r600_bytecode_disasm(&shader->shader.bc);
fprintf(stderr, "______________________________________________________________\n");
- }
-#else
- if (dump || use_sb) {
- r = r600_sb_bytecode_process(rctx, &shader->shader.bc, &shader->shader, dump, use_sb);
+ } else if ((dump && sb_disasm) || use_sb) {
+ r = r600_sb_bytecode_process(rctx, &shader->shader.bc, &shader->shader,
+ dump, use_sb);
if (r) {
R600_ERR("r600_sb_bytecode_process failed !\n");
return r;
}
}
-#endif
/* Store the shader in a buffer. */
if (shader->bo == NULL) {
boolean use_kill = false;
bool dump = (r600_ctx->screen->debug_flags & DBG_CS) != 0;
unsigned use_sb = r600_ctx->screen->debug_flags & DBG_SB_CS;
+ unsigned sb_disasm = use_sb ||
+ (r600_ctx->screen->debug_flags & DBG_SB_DISASM);
shader_ctx.bc = bytecode;
r600_bytecode_init(shader_ctx.bc, r600_ctx->chip_class, r600_ctx->family,
}
r600_bytecode_build(shader_ctx.bc);
-#if 0
- if (dump) {
+ if (dump && !sb_disasm) {
r600_bytecode_disasm(shader_ctx.bc);
- }
-#else
- if (dump || use_sb) {
+ } else if ((dump && sb_disasm) || use_sb) {
if (r600_sb_bytecode_process(r600_ctx, shader_ctx.bc, NULL, dump, use_sb))
R600_ERR("r600_sb_bytecode_process failed!\n");
}
-#endif
free(bytes);
return 1;