summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-07-11 12:16:06 -0400
committerZack Rusin <[email protected]>2013-07-11 20:19:04 -0400
commit00cd455bd50c6b16b2f72a6d2726de3d3818c7f5 (patch)
tree2b13c67bd84020a1bad285c3678b497a571ae1a4 /src/mesa/state_tracker
parenta171812d27afb1a52c5d81deaa6027f30bc102e8 (diff)
gallium: fixup definitions of the rsq and sqrt
GLSL spec says that rsq is undefined for src<=0, but the D3D10 spec says it needs to be a NaN, so lets stop taking an absolute value of the source which completely breaks that behavior. For the gl program we can simply insert an extra abs instrunction which produces the desired behavior there. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 7f306973f3d..67c6f53f638 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -615,8 +615,6 @@ translate_opcode( unsigned op )
return TGSI_OPCODE_RCP;
case OPCODE_RET:
return TGSI_OPCODE_RET;
- case OPCODE_RSQ:
- return TGSI_OPCODE_RSQ;
case OPCODE_SCS:
return TGSI_OPCODE_SCS;
case OPCODE_SEQ:
@@ -756,6 +754,10 @@ compile_instruction(
emit_ddy( t, dst[0], &inst->SrcReg[0] );
break;
+ case OPCODE_RSQ:
+ ureg_RSQ( ureg, dst[0], ureg_abs(src[0]) );
+ break;
+
default:
ureg_insn( ureg,
translate_opcode( inst->Opcode ),