diff options
author | Jason Ekstrand <[email protected]> | 2017-06-29 10:33:31 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-07-05 15:26:53 -0700 |
commit | 2e92d6a3929aec3bfbcec25dca771160db4133ee (patch) | |
tree | efd890b4f47710073bd13bf1a3690a2e4831c9f6 /src/compiler | |
parent | 6d30f33307cd95e2ee16de10b80a0d9881f788fd (diff) |
nir/spirv: Remove unneeded parameters from pointer_to_offset
Everyone now calls it with stop_at_matrix = false. Since we're now
always walking all the way to the end of the access chain, the type
returned is just the same as ptr->type;
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 3 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_private.h | 3 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 21 |
3 files changed, 8 insertions, 19 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 72a890454ed..3d9ef766111 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2173,8 +2173,7 @@ vtn_handle_ssbo_or_shared_atomic(struct vtn_builder *b, SpvOp opcode, } else { assert(ptr->mode == vtn_variable_mode_ssbo); nir_ssa_def *offset, *index; - struct vtn_type *type; - offset = vtn_pointer_to_offset(b, ptr, &index, &type, NULL, false); + offset = vtn_pointer_to_offset(b, ptr, &index, NULL); nir_intrinsic_op op = get_ssbo_nir_atomic_op(opcode); diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index b025eea49e3..603cfc2b6e3 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -479,8 +479,7 @@ nir_deref_var *vtn_pointer_to_deref(struct vtn_builder *b, struct vtn_pointer *ptr); nir_ssa_def * vtn_pointer_to_offset(struct vtn_builder *b, struct vtn_pointer *ptr, - nir_ssa_def **index_out, struct vtn_type **type_out, - unsigned *end_idx_out, bool stop_at_matrix); + nir_ssa_def **index_out, unsigned *end_idx_out); struct vtn_ssa_value *vtn_local_load(struct vtn_builder *b, nir_deref_var *src); diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 8e6e4c97a9e..3b474dc3c37 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -340,8 +340,7 @@ get_vulkan_resource_index(struct vtn_builder *b, struct vtn_pointer *ptr, nir_ssa_def * vtn_pointer_to_offset(struct vtn_builder *b, struct vtn_pointer *ptr, - nir_ssa_def **index_out, struct vtn_type **type_out, - unsigned *end_idx_out, bool stop_at_matrix) + nir_ssa_def **index_out, unsigned *end_idx_out) { unsigned idx = 0; struct vtn_type *type; @@ -358,11 +357,6 @@ vtn_pointer_to_offset(struct vtn_builder *b, struct vtn_pointer *ptr, case GLSL_TYPE_FLOAT: case GLSL_TYPE_DOUBLE: case GLSL_TYPE_BOOL: - /* Some users may not want matrix or vector derefs */ - if (stop_at_matrix) - goto end; - /* Fall through */ - case GLSL_TYPE_ARRAY: offset = nir_iadd(&b->nb, offset, vtn_access_link_as_ssa(b, ptr->chain->link[idx], @@ -385,8 +379,7 @@ vtn_pointer_to_offset(struct vtn_builder *b, struct vtn_pointer *ptr, } } -end: - *type_out = type; + assert(type == ptr->type); if (end_idx_out) *end_idx_out = idx; @@ -671,13 +664,12 @@ vtn_block_load(struct vtn_builder *b, struct vtn_pointer *src) nir_ssa_def *offset, *index = NULL; unsigned chain_idx; - struct vtn_type *type; - offset = vtn_pointer_to_offset(b, src, &index, &type, &chain_idx, false); + offset = vtn_pointer_to_offset(b, src, &index, &chain_idx); struct vtn_ssa_value *value = NULL; _vtn_block_load_store(b, op, true, index, offset, access_offset, access_size, - src->chain, chain_idx, type, &value); + src->chain, chain_idx, src->type, &value); return value; } @@ -687,11 +679,10 @@ vtn_block_store(struct vtn_builder *b, struct vtn_ssa_value *src, { nir_ssa_def *offset, *index = NULL; unsigned chain_idx; - struct vtn_type *type; - offset = vtn_pointer_to_offset(b, dst, &index, &type, &chain_idx, false); + offset = vtn_pointer_to_offset(b, dst, &index, &chain_idx); _vtn_block_load_store(b, nir_intrinsic_store_ssbo, false, index, offset, - 0, 0, dst->chain, chain_idx, type, &src); + 0, 0, dst->chain, chain_idx, dst->type, &src); } static bool |