diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 01541e04314..d61d12e83cf 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -39,6 +39,7 @@ static const struct debug_named_value agx_debug_options[] = { {"verbose", AGX_DBG_VERBOSE, "Disassemble verbosely"}, {"internal", AGX_DBG_INTERNAL, "Dump even internal shaders"}, {"novalidate",AGX_DBG_NOVALIDATE,"Skip IR validation in debug builds"}, + {"noopt", AGX_DBG_NOOPT, "Disable backend optimizations"}, DEBUG_NAMED_VALUE_END }; @@ -1743,12 +1744,14 @@ agx_compile_shader_nir(nir_shader *nir, if (agx_debug & AGX_DBG_SHADERS && !skip_internal) agx_print_shader(ctx, stdout); - agx_optimizer(ctx); - agx_dce(ctx); - agx_validate(ctx, "Optimization"); + if (likely(!(agx_debug & AGX_DBG_NOOPT))) { + agx_optimizer(ctx); + agx_dce(ctx); + agx_validate(ctx, "Optimization"); - if (agx_debug & AGX_DBG_SHADERS && !skip_internal) - agx_print_shader(ctx, stdout); + if (agx_debug & AGX_DBG_SHADERS && !skip_internal) + agx_print_shader(ctx, stdout); + } agx_ra(ctx); diff --git a/src/asahi/compiler/agx_compiler.h b/src/asahi/compiler/agx_compiler.h index b5a2c0fecde..7dc732c23e8 100644 --- a/src/asahi/compiler/agx_compiler.h +++ b/src/asahi/compiler/agx_compiler.h @@ -45,6 +45,7 @@ enum agx_dbg { AGX_DBG_VERBOSE = BITFIELD_BIT(3), AGX_DBG_INTERNAL = BITFIELD_BIT(4), AGX_DBG_NOVALIDATE = BITFIELD_BIT(5), + AGX_DBG_NOOPT = BITFIELD_BIT(6), }; extern int agx_debug;