summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2008-11-26 12:56:23 +0100
committerMichal Krol <[email protected]>2008-11-26 13:24:32 +0100
commit18a1389077c72717dfbe6ae10793f3329d13b848 (patch)
treeece9a38d6f7085119e294fe810181b992da79650
parent4de360e67d83cd6503fb8ad053bb8afe507db5fa (diff)
tgsi: Implement OPCODE_ROUND for SSE2 backend.
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sse2.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
index 8dfd2ced089..8574d79da1b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
@@ -1001,6 +1001,29 @@ emit_rcp (
make_xmm( xmm_src ) );
}
+static void PIPE_CDECL
+rnd4f(
+ float *store )
+{
+ store[0] = floorf( store[0] + 0.5f );
+ store[1] = floorf( store[1] + 0.5f );
+ store[2] = floorf( store[2] + 0.5f );
+ store[3] = floorf( store[3] + 0.5f );
+}
+
+static void
+emit_rnd(
+ struct x86_function *func,
+ unsigned xmm_save,
+ unsigned xmm_dst )
+{
+ emit_func_call_dst(
+ func,
+ xmm_save,
+ xmm_dst,
+ rnd4f );
+}
+
static void
emit_rsqrt(
struct x86_function *func,
@@ -1811,7 +1834,11 @@ emit_instruction(
break;
case TGSI_OPCODE_ROUND:
- return 0;
+ FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
+ FETCH( func, *inst, 0, 0, chan_index );
+ emit_rnd( func, 0, 0 );
+ STORE( func, *inst, 0, 0, chan_index );
+ }
break;
case TGSI_OPCODE_EXPBASE2: