Mesa (gallium-0.2): tgsi: Implement OPCODE_TRUNC.

Alan Hourihane alanh at kemper.freedesktop.org
Wed Nov 5 11:59:56 UTC 2008


Module: Mesa
Branch: gallium-0.2
Commit: de2ace201fe26d36a2a75211a7d8447940a47fbe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=de2ace201fe26d36a2a75211a7d8447940a47fbe

Author: michal <michal at quad.(none)>
Date:   Wed Nov  5 11:48:56 2008 +0100

tgsi: Implement OPCODE_TRUNC.

---

 src/gallium/auxiliary/tgsi/tgsi_sse2.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
index f79170b..47e52c8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
@@ -784,6 +784,17 @@ emit_f2it(
       make_xmm( xmm ) );
 }
 
+static void
+emit_i2f(
+   struct x86_function *func,
+   unsigned xmm )
+{
+   sse2_cvtdq2ps(
+      func,
+      make_xmm( xmm ),
+      make_xmm( xmm ) );
+}
+
 static void PIPE_CDECL
 flr4f(
    float *store )
@@ -2104,7 +2115,12 @@ emit_instruction(
       break;
 
    case TGSI_OPCODE_TRUNC:
-      return 0;
+      FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
+         FETCH( func, *inst, 0, 0, chan_index );
+         emit_f2it( func, 0 );
+         emit_i2f( func, 0 );
+         STORE( func, *inst, 0, 0, chan_index );
+      }
       break;
 
    case TGSI_OPCODE_SHL:




More information about the mesa-commit mailing list