summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-11-08 19:40:44 -0500
committerMarek Olšák <[email protected]>2019-11-11 19:45:10 -0500
commitd29a33286260ac2de3b7718d9133923c40eeb1f7 (patch)
tree30aa1190d5ea6c2632dccff8f9f1adaa156fe219 /src/mesa/state_tracker
parent265abc54f828750ffde075d6faf71541ca58ad42 (diff)
st/mesa: add ST_DEBUG=nir to print NIR shaders
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_debug.c1
-rw-r--r--src/mesa/state_tracker/st_program.c11
2 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
index 95564cbc364..66085b646c5 100644
--- a/src/mesa/state_tracker/st_debug.c
+++ b/src/mesa/state_tracker/st_debug.c
@@ -47,6 +47,7 @@ int ST_DEBUG = 0;
static const struct debug_named_value st_debug_flags[] = {
{ "mesa", DEBUG_MESA, NULL },
{ "tgsi", DEBUG_PRINT_IR, NULL },
+ { "nir", DEBUG_PRINT_IR, NULL },
{ "constants",DEBUG_CONSTANTS, NULL },
{ "pipe", DEBUG_PIPE, NULL },
{ "tex", DEBUG_TEX, NULL },
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 41508710783..9fa12c9f65d 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -741,6 +741,9 @@ st_create_vp_variant(struct st_context *st,
nir_shader_get_entrypoint(state.ir.nir));
}
+ if (ST_DEBUG & DEBUG_PRINT_IR)
+ nir_print_shader(state.ir.nir, stderr);
+
vpv->driver_shader = pipe->create_vs_state(pipe, &state);
/* When generating a NIR program, we usually don't have TGSI tokens.
@@ -1359,6 +1362,9 @@ st_create_fp_variant(struct st_context *st,
screen->finalize_nir(screen, state.ir.nir, false);
}
+ if (ST_DEBUG & DEBUG_PRINT_IR)
+ nir_print_shader(state.ir.nir, stderr);
+
variant->driver_shader = pipe->create_fs_state(pipe, &state);
variant->key = *key;
@@ -1774,7 +1780,10 @@ st_get_common_variant(struct st_context *st,
st_finalize_nir(st, &prog->Base, prog->shader_program,
state.ir.nir, true);
}
- } else {
+
+ if (ST_DEBUG & DEBUG_PRINT_IR)
+ nir_print_shader(state.ir.nir, stderr);
+ } else {
if (key->lower_depth_clamp) {
struct gl_program_parameter_list *params = prog->Base.Parameters;