diff options
author | Jason Ekstrand <[email protected]> | 2019-07-10 17:55:44 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-07-16 17:02:08 -0500 |
commit | 6394680f6b54595d1f2dfac7159d2772090b234e (patch) | |
tree | a46a0885c198a1be9ec8874266994604177bdb71 /src/compiler/spirv | |
parent | f07f516c5625671d7c31beb40f6dbdbb20ffffc4 (diff) |
spirv: Add a warning for ArrayStride on arrays of blocks
It's disallowed according to the SPIR-V spec or at least I think that's
what the spec says. It's in a section explicitly about explicit layout
of things in the StorageBuffer, Uniform, and PushConstant storage
classes so it's not 100% clear that it applies with other storage
classes. However, it seems like it should apply in general and
violating it can trigger (fairly harmless) asserts in NIR.
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 6a9ccfe0f38..ea4aebb767c 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -722,8 +722,15 @@ array_stride_decoration_cb(struct vtn_builder *b, struct vtn_type *type = val->type; if (dec->decoration == SpvDecorationArrayStride) { - vtn_fail_if(dec->operands[0] == 0, "ArrayStride must be non-zero"); - type->stride = dec->operands[0]; + if (vtn_type_contains_block(b, type)) { + vtn_warn("The ArrayStride decoration cannot be applied to an array " + "type which contains a structure type decorated Block " + "or BufferBlock"); + /* Ignore the decoration */ + } else { + vtn_fail_if(dec->operands[0] == 0, "ArrayStride must be non-zero"); + type->stride = dec->operands[0]; + } } } |