Mesa (master): glsl: Guard against error_type in the tree rebalancer.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Jul 16 22:41:51 UTC 2014


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Jul 15 16:35:55 2014 -0700

glsl: Guard against error_type in the tree rebalancer.

This helped me track down the bug fixed in the previous commit.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/opt_rebalance_tree.cpp |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/glsl/opt_rebalance_tree.cpp b/src/glsl/opt_rebalance_tree.cpp
index 7ef0d2d..f82b16b 100644
--- a/src/glsl/opt_rebalance_tree.cpp
+++ b/src/glsl/opt_rebalance_tree.cpp
@@ -271,11 +271,13 @@ update_types(ir_instruction *ir, void *)
    if (!expr)
       return;
 
-   expr->type =
+   const glsl_type *const new_type =
       glsl_type::get_instance(expr->type->base_type,
                               MAX2(expr->operands[0]->type->components(),
                                    expr->operands[1]->type->components()),
                               1);
+   assert(new_type != glsl_type::error_type);
+   expr->type = new_type;
 }
 
 void




More information about the mesa-commit mailing list