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>
This commit is contained in:
Rob Clark
2019-05-02 09:33:40 -07:00
parent f697f61590
commit e941faf3e8
3 changed files with 9 additions and 1 deletions
+1
View 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
};
+1
View 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;
@@ -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)