freedreno/ir3: add IR3_SHADER_DEBUG flag to disable ubo lowering
authorRob Clark <robdclark@chromium.org>
Thu, 2 May 2019 16:33:40 +0000 (09:33 -0700)
committerRob Clark <robdclark@chromium.org>
Thu, 2 May 2019 18:19:22 +0000 (11:19 -0700)
It isn't quite as simple as not running the pass, since with packed
varyings we get load_ubo for block==0 (ie. the "real" uniforms).  So
instead run the pass normally but decline to lower anything in
block > 0

Signed-off-by: Rob Clark <robdclark@chromium.org>
src/freedreno/ir3/ir3_compiler.c
src/freedreno/ir3/ir3_compiler.h
src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c

index b0f2b139d5ed617780eebd7465d6498ef2160379..be9ae83b27815b26e226fea3afe2526b9c6f829d 100644 (file)
@@ -35,6 +35,7 @@ static const struct debug_named_value shader_debug_options[] = {
        {"disasm",     IR3_DBG_DISASM,     "Dump NIR and adreno shader disassembly"},
        {"optmsgs",    IR3_DBG_OPTMSGS,    "Enable optimizer debug messages"},
        {"forces2en",  IR3_DBG_FORCES2EN,  "Force s2en mode for tex sampler instructions"},
+       {"nouboopt",   IR3_DBG_NOUBOOPT,   "Disable lowering UBO to uniform"},
        DEBUG_NAMED_VALUE_END
 };
 
index 181125fa3b1d4769eb6e7f44b424bc60b9299280..efe6f1e30f6d0a32fb5cb1bedb5d5d1f14f0e7e4 100644 (file)
@@ -81,6 +81,7 @@ enum ir3_shader_debug {
        IR3_DBG_DISASM    = 0x08,
        IR3_DBG_OPTMSGS   = 0x10,
        IR3_DBG_FORCES2EN = 0x20,
+       IR3_DBG_NOUBOOPT  = 0x40,
 };
 
 extern enum ir3_shader_debug ir3_shader_debug;
index a79b1a30bf9829a43143ff49be12e1d0b7e6fd35..312c06446234ca804a816063169f6e07e716e8df 100644 (file)
@@ -22,9 +22,9 @@
  */
 
 #include "ir3_nir.h"
+#include "ir3_compiler.h"
 #include "compiler/nir/nir.h"
 #include "compiler/nir/nir_builder.h"
-#include "util/u_dynarray.h"
 #include "mesa/main/macros.h"
 
 static inline struct ir3_ubo_range
@@ -54,6 +54,12 @@ gather_ubo_ranges(nir_intrinsic_instr *instr,
        const struct ir3_ubo_range r = get_ubo_load_range(instr);
        const uint32_t block = nir_src_as_uint(instr->src[0]);
 
+       /* if UBO lowering is disabled, we still want to lower block 0
+        * (which is normal uniforms):
+        */
+       if ((block > 0) && (ir3_shader_debug & IR3_DBG_NOUBOOPT))
+               return;
+
        if (r.start < state->range[block].start)
                state->range[block].start = r.start;
        if (state->range[block].end < r.end)