Mesa (master): glsl: Make the tree rebalancer use vector_elements, not components().

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


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

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

glsl: Make the tree rebalancer use vector_elements, not components().

components() includes matrix columns, so if this code encountered a
matrix, it would ask for something like a vec9 or vec16.  This is
clearly not what you want.

Earlier code now prevents this from seeing matrices, but we should still
use vector_elements, for clarity.

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

---

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

diff --git a/src/glsl/opt_rebalance_tree.cpp b/src/glsl/opt_rebalance_tree.cpp
index f82b16b..095f2d7 100644
--- a/src/glsl/opt_rebalance_tree.cpp
+++ b/src/glsl/opt_rebalance_tree.cpp
@@ -273,8 +273,8 @@ update_types(ir_instruction *ir, void *)
 
    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()),
+                              MAX2(expr->operands[0]->type->vector_elements,
+                                   expr->operands[1]->type->vector_elements),
                               1);
    assert(new_type != glsl_type::error_type);
    expr->type = new_type;




More information about the mesa-commit mailing list