Mesa (master): glsl: Validate that base types match for a number of binops.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Apr 8 07:03:45 UTC 2014


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sun Apr  6 22:45:43 2014 -0700

glsl: Validate that base types match for a number of binops.

The IR is not supposed to support implicit type conversions; we just
failed to validate it.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/ir_validate.cpp |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 527acea..71defc8 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -381,6 +381,9 @@ ir_validate::visit_leave(ir_expression *ir)
    case ir_binop_min:
    case ir_binop_max:
    case ir_binop_pow:
+      assert(ir->operands[0]->type->base_type ==
+             ir->operands[1]->type->base_type);
+
       if (ir->operands[0]->type->is_scalar())
 	 assert(ir->operands[1]->type == ir->type);
       else if (ir->operands[1]->type->is_scalar())




More information about the mesa-commit mailing list