From: Jason Ekstrand Date: Wed, 5 Jul 2017 22:30:22 +0000 (-0700) Subject: spirv/nir: Add some useful asserts for type decorations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a96888923758475e1396a21bf70f9fc3390e76ec;p=mesa.git 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 --- 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: