From a96888923758475e1396a21bf70f9fc3390e76ec Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 5 Jul 2017 15:30:22 -0700 Subject: 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 --- src/compiler/spirv/spirv_to_nir.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/compiler/spirv') 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: -- cgit v1.2.3