diff options
author | Jason Ekstrand <jason@jlekstrand.net> | 2017-10-19 11:04:05 -0700 |
---|---|---|
committer | Chad Versace <chadversary@chromium.org> | 2017-11-30 23:35:27 +0000 |
commit | 794d5bbee519287238d12556a54548a1c951b56b (patch) | |
tree | 714058e13af6b808437b201ae19edf25b99e3075 /src | |
parent | 6d25795e51e76f08586da9acdc0e1bf213cd574d (diff) |
FROMLIST: spirv: Use a dereference instead of vtn_variable_resource_index
This is equivalent and means we don't have resource index code scattered
about.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Archived-At: https://lists.freedesktop.org/archives/mesa-dev/2017-October/173528.html
(am from https://patchwork.freedesktop.org/patch/183821/)
Needed for SPIR-V VariablePointers capability.
BUG=b:68708929
TEST=No regressions on Eve in `cts-tradefed run cts -m CtsDeqpTestCases`.
Change-Id: I847aa91fe096c71dc88b229c72d60eb3c9a3fcc5
Reviewed-on: https://chromium-review.googlesource.com/799672
Tested-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index c57f5541319..3711dcfacf8 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1492,11 +1492,9 @@ vtn_pointer_to_ssa(struct vtn_builder *b, struct vtn_pointer *ptr) assert(ptr->ptr_type); assert(ptr->ptr_type->type); - if (ptr->offset && ptr->block_index) { - return nir_vec2(&b->nb, ptr->block_index, ptr->offset); - } else { - /* If we don't have an offset or block index, then we must be a pointer - * to the variable itself. + if (!ptr->offset || !ptr->block_index) { + /* If we don't have an offset then we must be a pointer to the variable + * itself. */ assert(!ptr->offset && !ptr->block_index); @@ -1506,9 +1504,14 @@ vtn_pointer_to_ssa(struct vtn_builder *b, struct vtn_pointer *ptr) */ assert(ptr->var && ptr->var->type->base_type == vtn_base_type_struct); - return nir_vec2(&b->nb, vtn_variable_resource_index(b, ptr->var, NULL), - nir_imm_int(&b->nb, 0)); + struct vtn_access_chain chain = { + .length = 0, + }; + ptr = vtn_ssa_offset_pointer_dereference(b, ptr, &chain); } + + assert(ptr->offset && ptr->block_index); + return nir_vec2(&b->nb, ptr->block_index, ptr->offset); } struct vtn_pointer * |