summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/spirv_to_nir.c
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-08-08 10:00:45 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-08-10 22:15:35 -0700
commit5ed4e31c08dc079473dd2e459c973355d49cd529 (patch)
tree1266a923e19dc36e41f258c02a969a848a46ac45 /src/compiler/spirv/spirv_to_nir.c
parent925e9142bdd119bf371dbad2ec32e0c161e583e0 (diff)
spirv: Drop lower_workgroup_access_to_offsets
Intel drivers are not using this anymore, and turnip still don't have Compute Shaders, so won't make a difference to stop using this option. Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/compiler/spirv/spirv_to_nir.c')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c108
1 files changed, 2 insertions, 106 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 7a2e30707ce..08649be080c 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1086,65 +1086,6 @@ translate_image_format(struct vtn_builder *b, SpvImageFormat format)
}
}
-static struct vtn_type *
-vtn_type_layout_std430(struct vtn_builder *b, struct vtn_type *type,
- uint32_t *size_out, uint32_t *align_out)
-{
- switch (type->base_type) {
- case vtn_base_type_scalar: {
- uint32_t comp_size = glsl_type_is_boolean(type->type)
- ? 4 : glsl_get_bit_size(type->type) / 8;
- *size_out = comp_size;
- *align_out = comp_size;
- return type;
- }
-
- case vtn_base_type_vector: {
- uint32_t comp_size = glsl_type_is_boolean(type->type)
- ? 4 : glsl_get_bit_size(type->type) / 8;
- unsigned align_comps = type->length == 3 ? 4 : type->length;
- *size_out = comp_size * type->length,
- *align_out = comp_size * align_comps;
- return type;
- }
-
- case vtn_base_type_matrix:
- case vtn_base_type_array: {
- /* We're going to add an array stride */
- type = vtn_type_copy(b, type);
- uint32_t elem_size, elem_align;
- type->array_element = vtn_type_layout_std430(b, type->array_element,
- &elem_size, &elem_align);
- type->stride = vtn_align_u32(elem_size, elem_align);
- *size_out = type->stride * type->length;
- *align_out = elem_align;
- return type;
- }
-
- case vtn_base_type_struct: {
- /* We're going to add member offsets */
- type = vtn_type_copy(b, type);
- uint32_t offset = 0;
- uint32_t align = 0;
- for (unsigned i = 0; i < type->length; i++) {
- uint32_t mem_size, mem_align;
- type->members[i] = vtn_type_layout_std430(b, type->members[i],
- &mem_size, &mem_align);
- offset = vtn_align_u32(offset, mem_align);
- type->offsets[i] = offset;
- offset += mem_size;
- align = MAX2(align, mem_align);
- }
- *size_out = offset;
- *align_out = align;
- return type;
- }
-
- default:
- unreachable("Invalid SPIR-V type for std430");
- }
-}
-
static void
vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
const uint32_t *w, unsigned count)
@@ -1416,18 +1357,6 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
default:
break;
}
- } else if (storage_class == SpvStorageClassWorkgroup &&
- b->options->lower_workgroup_access_to_offsets) {
- /* Lay out Workgroup types so it can be lowered to offsets during
- * SPIR-V to NIR conversion. When not lowering to offsets, the
- * stride will be calculated by the driver.
- */
- uint32_t size, align;
- val->type->deref = vtn_type_layout_std430(b, val->type->deref,
- &size, &align);
- val->type->length = size;
- val->type->align = align;
- val->type->stride = vtn_align_u32(size, align);
}
}
break;
@@ -2697,33 +2626,6 @@ get_uniform_nir_atomic_op(struct vtn_builder *b, SpvOp opcode)
}
static nir_intrinsic_op
-get_shared_nir_atomic_op(struct vtn_builder *b, SpvOp opcode)
-{
- switch (opcode) {
- case SpvOpAtomicLoad: return nir_intrinsic_load_shared;
- case SpvOpAtomicStore: return nir_intrinsic_store_shared;
-#define OP(S, N) case SpvOp##S: return nir_intrinsic_shared_##N;
- OP(AtomicExchange, atomic_exchange)
- OP(AtomicCompareExchange, atomic_comp_swap)
- OP(AtomicCompareExchangeWeak, atomic_comp_swap)
- OP(AtomicIIncrement, atomic_add)
- OP(AtomicIDecrement, atomic_add)
- OP(AtomicIAdd, atomic_add)
- OP(AtomicISub, atomic_add)
- OP(AtomicSMin, atomic_imin)
- OP(AtomicUMin, atomic_umin)
- OP(AtomicSMax, atomic_imax)
- OP(AtomicUMax, atomic_umax)
- OP(AtomicAnd, atomic_and)
- OP(AtomicOr, atomic_or)
- OP(AtomicXor, atomic_xor)
-#undef OP
- default:
- vtn_fail_with_opcode("Invalid shared atomic", opcode);
- }
-}
-
-static nir_intrinsic_op
get_deref_nir_atomic_op(struct vtn_builder *b, SpvOp opcode)
{
switch (opcode) {
@@ -2842,15 +2744,9 @@ vtn_handle_atomics(struct vtn_builder *b, SpvOp opcode,
nir_ssa_def *offset, *index;
offset = vtn_pointer_to_offset(b, ptr, &index);
- nir_intrinsic_op op;
- if (ptr->mode == vtn_variable_mode_ssbo) {
- op = get_ssbo_nir_atomic_op(b, opcode);
- } else {
- vtn_assert(ptr->mode == vtn_variable_mode_workgroup &&
- b->options->lower_workgroup_access_to_offsets);
- op = get_shared_nir_atomic_op(b, opcode);
- }
+ assert(ptr->mode == vtn_variable_mode_ssbo);
+ nir_intrinsic_op op = get_ssbo_nir_atomic_op(b, opcode);
atomic = nir_intrinsic_instr_create(b->nb.shader, op);
int src = 0;