diff options
author | Kenneth Graunke <[email protected]> | 2018-11-09 01:27:39 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:09 -0800 |
commit | deb6d588a612c527ca9f821f4301c8fc05ebcc6a (patch) | |
tree | 3b294f593880775c211793b7596b32cdbbafa71d /src/gallium/drivers/iris/iris_program.c | |
parent | 2b0a2915dcc015789ca4b81cdb2bd0578152fde3 (diff) |
iris: fix system value remapping
Diffstat (limited to 'src/gallium/drivers/iris/iris_program.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_program.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index b0306cca4f8..79086e60993 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -431,6 +431,7 @@ iris_setup_uniforms(const struct brw_compiler *compiler, b.cursor = nir_before_block(nir_start_block(impl)); nir_ssa_def *temp_ubo_name = nir_ssa_undef(&b, 1, 32); + /* Turn system value intrinsics into uniforms */ nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) @@ -473,6 +474,9 @@ iris_setup_uniforms(const struct brw_compiler *compiler, } } + nir_validate_shader(nir, "before remapping"); + + /* Place the new params at the front of constant buffer 0. */ if (prog_data->nr_params > 0) { nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -486,18 +490,24 @@ iris_setup_uniforms(const struct brw_compiler *compiler, b.cursor = nir_before_instr(instr); + assert(load->src[0].is_ssa); + if (load->src[0].ssa == temp_ubo_name) { - load->src[0] = nir_src_for_ssa(nir_imm_int(&b, 0)); + nir_instr_rewrite_src(instr, &load->src[0], + nir_src_for_ssa(nir_imm_int(&b, 0))); } else if (nir_src_as_uint(load->src[0]) == 0) { nir_ssa_def *offset = nir_iadd(&b, load->src[1].ssa, nir_imm_int(&b, prog_data->nr_params)); - load->src[1] = nir_src_for_ssa(offset); + nir_instr_rewrite_src(instr, &load->src[1], + nir_src_for_ssa(offset)); } } } } + nir_validate_shader(nir, "after remap"); + // XXX: vs clip planes? if (nir->info.stage != MESA_SHADER_COMPUTE) brw_nir_analyze_ubo_ranges(compiler, nir, NULL, prog_data->ubo_ranges); |