From dabce5061d9a49ebbf269d651e086e638be01aa9 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 11 Dec 2017 22:15:04 -0800 Subject: spirv: Add better validation to Op[Spec]Constant Reviewed-by: Lionel Landwerlin --- src/compiler/spirv/spirv_to_nir.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 6f5d3e1d64f..014de781cc1 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -1300,7 +1300,9 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode, } case SpvOpConstant: { - vtn_assert(glsl_type_is_scalar(val->type->type)); + vtn_fail_if(val->type->base_type != vtn_base_type_scalar, + "Result type of %s must be a scalar", + spirv_op_to_string(opcode)); int bit_size = glsl_get_bit_size(val->type->type); switch (bit_size) { case 64: @@ -1317,8 +1319,11 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode, } break; } + case SpvOpSpecConstant: { - vtn_assert(glsl_type_is_scalar(val->type->type)); + vtn_fail_if(val->type->base_type != vtn_base_type_scalar, + "Result type of %s must be a scalar", + spirv_op_to_string(opcode)); int bit_size = glsl_get_bit_size(val->type->type); switch (bit_size) { case 64: -- cgit v1.2.3