aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_program.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-11-09 00:51:58 -0800
committerKenneth Graunke <[email protected]>2019-02-21 10:26:09 -0800
commit80c856cbee8bf3980c1bbfd8d9a8f2c4ca81036e (patch)
treebe06b8aa0bf302226f78367c1be7a6186629466f /src/gallium/drivers/iris/iris_program.c
parent2186d831857ccf01cc90d789c1e339a3ec379e23 (diff)
iris: only bother with params if there are any...
Diffstat (limited to 'src/gallium/drivers/iris/iris_program.c')
-rw-r--r--src/gallium/drivers/iris/iris_program.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index 731a3d7a347..773d4e5ebb3 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -470,23 +470,27 @@ iris_setup_uniforms(const struct brw_compiler *compiler,
}
}
- nir_foreach_block(block, impl) {
- nir_foreach_instr_safe(instr, block) {
- if (instr->type != nir_instr_type_intrinsic)
- continue;
-
- nir_intrinsic_instr *load = nir_instr_as_intrinsic(instr);
-
- if (load->intrinsic != nir_intrinsic_load_ubo)
- continue;
-
- if (load->src[0].ssa == temp_ubo_name) {
- 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);
+ if (prog_data->nr_params > 0) {
+ nir_foreach_block(block, impl) {
+ nir_foreach_instr_safe(instr, block) {
+ if (instr->type != nir_instr_type_intrinsic)
+ continue;
+
+ nir_intrinsic_instr *load = nir_instr_as_intrinsic(instr);
+
+ if (load->intrinsic != nir_intrinsic_load_ubo)
+ continue;
+
+ b.cursor = nir_before_instr(instr);
+
+ if (load->src[0].ssa == temp_ubo_name) {
+ 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);
+ }
}
}
}