diff options
author | Jason Ekstrand <[email protected]> | 2017-12-11 22:15:04 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-01-08 14:57:44 -0800 |
commit | dabce5061d9a49ebbf269d651e086e638be01aa9 (patch) | |
tree | eb435a548503a7ff9570c5836dae5b1425b7e8d1 /src/compiler | |
parent | 6cf965751a5bbb015d53bdec0663d6bed66a9026 (diff) |
spirv: Add better validation to Op[Spec]Constant
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 9 |
1 files changed, 7 insertions, 2 deletions
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: |