summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-03-20 12:12:12 -0700
committerJason Ekstrand <[email protected]>2018-03-30 17:20:27 -0700
commit6018f5b07966a0f85dea1ee6775d50a8c85fdee1 (patch)
tree7210e637f30493290da9a17d3f30c33840dc4881 /src/compiler/nir
parent0517d65f9639349d626aeb2af48ba9e4e605900d (diff)
nir/lower_indirect_derefs: Support interp_var_at intrinsics
This fixes the fs-interpolateAtCentroid-block-array piglit test on i965. Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected]
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_lower_indirect_derefs.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/compiler/nir/nir_lower_indirect_derefs.c
index c949224b15c..02f202dea39 100644
--- a/src/compiler/nir/nir_lower_indirect_derefs.c
+++ b/src/compiler/nir/nir_lower_indirect_derefs.c
@@ -95,9 +95,15 @@ emit_load_store(nir_builder *b, nir_intrinsic_instr *orig_instr,
if (src == NULL) {
/* This is a load instruction */
nir_intrinsic_instr *load =
- nir_intrinsic_instr_create(b->shader, nir_intrinsic_load_var);
+ nir_intrinsic_instr_create(b->shader, orig_instr->intrinsic);
load->num_components = orig_instr->num_components;
load->variables[0] = nir_deref_var_clone(deref, load);
+
+ /* Copy over any sources. This is needed for interp_var_at */
+ for (unsigned i = 0;
+ i < nir_intrinsic_infos[orig_instr->intrinsic].num_srcs; i++)
+ nir_src_copy(&load->src[i], &orig_instr->src[i], load);
+
unsigned bit_size = orig_instr->dest.ssa.bit_size;
nir_ssa_dest_init(&load->instr, &load->dest,
load->num_components, bit_size, NULL);
@@ -142,6 +148,9 @@ lower_indirect_block(nir_block *block, nir_builder *b,
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
if (intrin->intrinsic != nir_intrinsic_load_var &&
+ intrin->intrinsic != nir_intrinsic_interp_var_at_centroid &&
+ intrin->intrinsic != nir_intrinsic_interp_var_at_sample &&
+ intrin->intrinsic != nir_intrinsic_interp_var_at_offset &&
intrin->intrinsic != nir_intrinsic_store_var)
continue;
@@ -158,7 +167,7 @@ lower_indirect_block(nir_block *block, nir_builder *b,
b->cursor = nir_before_instr(&intrin->instr);
- if (intrin->intrinsic == nir_intrinsic_load_var) {
+ if (intrin->intrinsic != nir_intrinsic_store_var) {
nir_ssa_def *result;
emit_load_store(b, intrin, intrin->variables[0],
&intrin->variables[0]->deref, &result, NULL);