summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-18 16:33:32 -0700
committerJason Ekstrand <[email protected]>2017-12-05 20:55:37 -0800
commit91d91ce3e24f198f2f5b88c22e3186a22334295e (patch)
treee0033c197b9116408e3165866b0a98c76b6f3d18
parentdee936c8056aa35847258e9707028a45038eaf56 (diff)
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 <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
-rw-r--r--src/compiler/spirv/vtn_variables.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index c0db46d55a0..08428a2823f 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1495,11 +1495,9 @@ vtn_pointer_to_ssa(struct vtn_builder *b, struct vtn_pointer *ptr)
vtn_assert(ptr->ptr_type);
vtn_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.
*/
vtn_assert(!ptr->offset && !ptr->block_index);
@@ -1509,9 +1507,14 @@ vtn_pointer_to_ssa(struct vtn_builder *b, struct vtn_pointer *ptr)
*/
vtn_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);
}
+
+ vtn_assert(ptr->offset && ptr->block_index);
+ return nir_vec2(&b->nb, ptr->block_index, ptr->offset);
}
struct vtn_pointer *