[Mesa-dev] [PATCH 9/9] glsl: Don't use MOD_TO_FRACT lowering on GLSL 1.30's % operator.

Kenneth Graunke kenneth at whitecape.org
Wed Jun 15 00:49:38 PDT 2011


MOD_TO_FRACT was designed to lower the GLSL 1.20 mod() function, which
operates on floating point values.  However, we also use ir_binop_mod
for GLSL 1.30's % operator, which operates on integers.

For now, make MOD_TO_FRACT only apply to floating-point mod operations.
In the future, we may want to add a lowering pass for integer-based mod.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/lower_instructions.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/lower_instructions.cpp b/src/glsl/lower_instructions.cpp
index 94b8c4a..806f863 100644
--- a/src/glsl/lower_instructions.cpp
+++ b/src/glsl/lower_instructions.cpp
@@ -276,7 +276,7 @@ lower_instructions_visitor::visit_leave(ir_expression *ir)
       break;
 
    case ir_binop_mod:
-      if (lowering(MOD_TO_FRACT))
+      if (lowering(MOD_TO_FRACT) && ir->type->is_float())
 	 mod_to_fract(ir);
       break;
 
-- 
1.7.5.4



More information about the mesa-dev mailing list