Module: Mesa
Branch: master
Commit: dabce5061d9a49ebbf269d651e086e638be01aa9
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dabce5061d9a49ebbf269d651e086e638be01aa9

Author: Jason Ekstrand <jason.ekstr...@intel.com>
Date:   Mon Dec 11 22:15:04 2017 -0800

spirv: Add better validation to Op[Spec]Constant

Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>

---

 src/compiler/spirv/spirv_to_nir.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c 
b/src/compiler/spirv/spirv_to_nir.c
index 6f5d3e1d64..014de781cc 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:

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to