summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2019-05-02 09:33:40 -0700
committerRob Clark <robdclark@chromium.org>2019-05-02 11:19:22 -0700
commite941faf3e83fa0d5ce0bd6e67119e8d6bf975502 (patch)
treec5fbfe64905c2e78ef4cd6e7ece99ed2fca03363
parentf697f61590fcdbba624749ce535f5a8f7b0267a5 (diff)
downloadmesa-e941faf3e83fa0d5ce0bd6e67119e8d6bf975502.tar.gz
freedreno/ir3: add IR3_SHADER_DEBUG flag to disable ubo lowering
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>
-rw-r--r--src/freedreno/ir3/ir3_compiler.c1
-rw-r--r--src/freedreno/ir3/ir3_compiler.h1
-rw-r--r--src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c8
3 files changed, 9 insertions, 1 deletions
diff --git a/src/freedreno/ir3/ir3_compiler.c b/src/freedreno/ir3/ir3_compiler.c
index b0f2b139d5e..be9ae83b278 100644
--- a/src/freedreno/ir3/ir3_compiler.c
+++ b/src/freedreno/ir3/ir3_compiler.c
@@ -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
};
diff --git a/src/freedreno/ir3/ir3_compiler.h b/src/freedreno/ir3/ir3_compiler.h
index 181125fa3b1..efe6f1e30f6 100644
--- a/src/freedreno/ir3/ir3_compiler.h
+++ b/src/freedreno/ir3/ir3_compiler.h
@@ -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;
diff --git a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c
index a79b1a30bf9..312c0644623 100644
--- a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c
+++ b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c
@@ -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)