summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-12-11 22:15:04 -0800
committerJason Ekstrand <[email protected]>2018-01-08 14:57:44 -0800
commitdabce5061d9a49ebbf269d651e086e638be01aa9 (patch)
treeeb435a548503a7ff9570c5836dae5b1425b7e8d1 /src/compiler/spirv
parent6cf965751a5bbb015d53bdec0663d6bed66a9026 (diff)
spirv: Add better validation to Op[Spec]Constant
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c9
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: