diff options
author | Jason Ekstrand <[email protected]> | 2017-11-30 17:13:56 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-12-05 22:01:54 -0800 |
commit | 32c859125b916c24ab76bd52db6e37a1a22f4858 (patch) | |
tree | e469b503eabb682ad508453162783cdb495e2b56 /src/intel/vulkan | |
parent | cfb81f58a0c3f5f8dfde3d0783ff5211b657f895 (diff) |
anv: Handle nir_intrinsic_vulkan_resource_reindex
Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_nir_apply_pipeline_layout.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c index f8d81648a9a..612b3f7effe 100644 --- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c +++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c @@ -129,6 +129,25 @@ lower_res_index_intrinsic(nir_intrinsic_instr *intrin, } static void +lower_res_reindex_intrinsic(nir_intrinsic_instr *intrin, + struct apply_pipeline_layout_state *state) +{ + nir_builder *b = &state->builder; + + /* For us, the resource indices are just indices into the binding table and + * array elements are sequential. A resource_reindex just turns into an + * add of the two indices. + */ + assert(intrin->src[0].is_ssa && intrin->src[0].is_ssa); + nir_ssa_def *new_index = nir_iadd(b, intrin->src[0].ssa, + intrin->src[1].ssa); + + assert(intrin->dest.is_ssa); + nir_ssa_def_rewrite_uses(&intrin->dest.ssa, nir_src_for_ssa(new_index)); + nir_instr_remove(&intrin->instr); +} + +static void lower_tex_deref(nir_tex_instr *tex, nir_deref_var *deref, unsigned *const_index, unsigned array_size, nir_tex_src_type src_type, bool allow_indirect, @@ -265,8 +284,15 @@ apply_pipeline_layout_block(nir_block *block, switch (instr->type) { case nir_instr_type_intrinsic: { nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); - if (intrin->intrinsic == nir_intrinsic_vulkan_resource_index) { + switch (intrin->intrinsic) { + case nir_intrinsic_vulkan_resource_index: lower_res_index_intrinsic(intrin, state); + break; + case nir_intrinsic_vulkan_resource_reindex: + lower_res_reindex_intrinsic(intrin, state); + break; + default: + break; } break; } |