Mesa (master): freedreno/ir3: add IR3_SHADER_DEBUG flag to disable ubo lowering

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 2 18:19:53 UTC 2019


Module: Mesa
Branch: master
Commit: e941faf3e83fa0d5ce0bd6e67119e8d6bf975502
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e941faf3e83fa0d5ce0bd6e67119e8d6bf975502

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu May  2 09:33:40 2019 -0700

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 at chromium.org>

---

 src/freedreno/ir3/ir3_compiler.c               | 1 +
 src/freedreno/ir3/ir3_compiler.h               | 1 +
 src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c | 8 +++++++-
 3 files changed, 9 insertions(+), 1 deletion(-)

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)




More information about the mesa-commit mailing list