From: Marek Olšák Date: Sat, 9 Nov 2019 00:40:44 +0000 (-0500) Subject: st/mesa: add ST_DEBUG=nir to print NIR shaders X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d29a33286260ac2de3b7718d9133923c40eeb1f7;p=mesa.git st/mesa: add ST_DEBUG=nir to print NIR shaders Reviewed-by: Timothy Arceri --- 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;