Mesa (glsl2): ir_to_mesa: Fix matrix * scalar multiplication.
Eric Anholt
anholt at kemper.freedesktop.org
Mon Jun 28 20:30:13 UTC 2010
Module: Mesa
Branch: glsl2
Commit: 3f3f41357d33893d01213b37c6d92bcb435b0eeb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f3f41357d33893d01213b37c6d92bcb435b0eeb
Author: Eric Anholt <eric at anholt.net>
Date: Mon Jun 28 19:56:53 2010 -0700
ir_to_mesa: Fix matrix * scalar multiplication.
We're accessing in terms of columns, so we need to do MUL/MAD/MAD/MAD
instead of DP4s.
Fixes:
glsl-fs-exp2
glsl-fs-log2
glsl-fs-mix-constant
glsl-fs-sqrt-zero
glsl-vs-sqrt-zero
---
src/mesa/shader/ir_to_mesa.cpp | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp
index 8541906..b8113da 100644
--- a/src/mesa/shader/ir_to_mesa.cpp
+++ b/src/mesa/shader/ir_to_mesa.cpp
@@ -589,15 +589,21 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
src_column.index++;
}
} else {
- ir_to_mesa_dst_reg dst_chan = result_dst;
ir_to_mesa_src_reg src_column = op[0];
ir_to_mesa_src_reg src_chan = op[1];
- for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) {
- dst_chan.writemask = (1 << i);
- src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i);
- ir_to_mesa_emit_op2(ir, OPCODE_MUL,
- dst_chan, src_column, src_chan);
- src_column.index++;
+ assert(!ir->operands[1]->type->is_matrix() ||
+ !"FINISHME: matrix * matrix");
+ for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) {
+ src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i);
+ if (i == 0) {
+ ir_to_mesa_emit_op2(ir, OPCODE_MUL,
+ result_dst, src_column, src_chan);
+ } else {
+ ir_to_mesa_emit_op3(ir, OPCODE_MAD,
+ result_dst, src_column, src_chan,
+ result_src);
+ }
+ src_column.index++;
}
}
} else {
More information about the mesa-commit
mailing list