summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-04-02 17:46:36 -0700
committerJason Ekstrand <[email protected]>2018-06-22 20:54:00 -0700
commit9fb36011d11a1bc3e3156bfba94684c10049878d (patch)
tree8975119a08aef74e28214c688ac0b54a492ce07d
parentd57e724a45ada6e3a749fcbcb69eb12c090ee959 (diff)
anv/pipeline: Convert lower_multiview to deref instructions
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/intel/vulkan/anv_nir_lower_multiview.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/intel/vulkan/anv_nir_lower_multiview.c b/src/intel/vulkan/anv_nir_lower_multiview.c
index 6822595728c..bde7aade50f 100644
--- a/src/intel/vulkan/anv_nir_lower_multiview.c
+++ b/src/intel/vulkan/anv_nir_lower_multiview.c
@@ -134,18 +134,11 @@ build_view_index(struct lower_multiview_state *state)
if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
idx_var->data.interpolation = INTERP_MODE_FLAT;
- if (glsl_type_is_array(type)) {
- nir_deref_var *deref = nir_deref_var_create(b->shader, idx_var);
- nir_deref_array *arr = nir_deref_array_create(b->shader);
- arr->deref.type = glsl_int_type();
- arr->deref_array_type = nir_deref_array_type_direct;
- arr->base_offset = 0;
- deref->deref.child = &arr->deref;
-
- state->view_index = nir_load_deref_var(b, deref);
- } else {
- state->view_index = nir_load_var(b, idx_var);
- }
+ nir_deref_instr *deref = nir_build_deref_var(b, idx_var);
+ if (glsl_type_is_array(type))
+ deref = nir_build_deref_array(b, deref, nir_imm_int(b, 0));
+
+ state->view_index = nir_load_deref(b, deref);
}
}