summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-07-05 15:30:22 -0700
committerJason Ekstrand <[email protected]>2017-07-18 09:43:12 -0700
commita96888923758475e1396a21bf70f9fc3390e76ec (patch)
tree7edee8414e5e3f0a2e5b23c8c301a9fda1334211 /src/compiler/spirv
parent999918bd01c624bc865b0d90a63fd1098b0abcdb (diff)
spirv/nir: Add some useful asserts for type decorations
Now that vtn_type has piles of unions, we should assert sanity before setting fields that may stomp others. Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 763dbf4e681..89ebc5f674c 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -599,12 +599,16 @@ type_decoration_cb(struct vtn_builder *b,
switch (dec->decoration) {
case SpvDecorationArrayStride:
+ assert(type->base_type == vtn_base_type_matrix ||
+ type->base_type == vtn_base_type_array);
type->stride = dec->literals[0];
break;
case SpvDecorationBlock:
+ assert(type->base_type == vtn_base_type_struct);
type->block = true;
break;
case SpvDecorationBufferBlock:
+ assert(type->base_type == vtn_base_type_struct);
type->buffer_block = true;
break;
case SpvDecorationGLSLShared: