diff options
Diffstat (limited to 'src/gallium')
| -rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 18 | ||||
| -rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_sse2.c | 30 | 
2 files changed, 46 insertions, 2 deletions
| diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 1981d8b68f..9fd0497043 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -829,6 +829,17 @@ micro_rnd(  }  static void +micro_sgn( +   union tgsi_exec_channel *dst, +   const union tgsi_exec_channel *src ) +{ +   dst->f[0] = src->f[0] < 0.0f ? -1.0f : src->f[0] > 0.0f ? 1.0f : 0.0f; +   dst->f[1] = src->f[1] < 0.0f ? -1.0f : src->f[1] > 0.0f ? 1.0f : 0.0f; +   dst->f[2] = src->f[2] < 0.0f ? -1.0f : src->f[2] > 0.0f ? 1.0f : 0.0f; +   dst->f[3] = src->f[3] < 0.0f ? -1.0f : src->f[3] > 0.0f ? 1.0f : 0.0f; +} + +static void  micro_shl(     union tgsi_exec_channel *dst,     const union tgsi_exec_channel *src0, @@ -2480,7 +2491,12 @@ exec_instruction(        break;     case TGSI_OPCODE_SSG: -      assert (0); +   /* TGSI_OPCODE_SGN */ +      FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { +         FETCH( &r[0], 0, chan_index ); +         micro_sgn( &r[0], &r[0] ); +         STORE( &r[0], 0, chan_index ); +      }        break;     case TGSI_OPCODE_CMP: diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index d2d431980b..cac44af7f4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1084,6 +1084,29 @@ emit_setsign(  }  static void PIPE_CDECL +sgn4f( +   float *store ) +{ +   store[0] = store[0] < 0.0f ? -1.0f : store[0] > 0.0f ? 1.0f : 0.0f; +   store[1] = store[1] < 0.0f ? -1.0f : store[1] > 0.0f ? 1.0f : 0.0f; +   store[2] = store[2] < 0.0f ? -1.0f : store[2] > 0.0f ? 1.0f : 0.0f; +   store[3] = store[3] < 0.0f ? -1.0f : store[3] > 0.0f ? 1.0f : 0.0f; +} + +static void +emit_sgn( +   struct x86_function *func, +   unsigned xmm_save,  +   unsigned xmm_dst ) +{ +   emit_func_call_dst( +      func, +      xmm_save, +      xmm_dst, +      sgn4f ); +} + +static void PIPE_CDECL  sin4f(     float *store )  { @@ -2102,7 +2125,12 @@ emit_instruction(        break;     case TGSI_OPCODE_SSG: -      return 0; +   /* TGSI_OPCODE_SGN */ +      FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { +         FETCH( func, *inst, 0, 0, chan_index ); +         emit_sgn( func, 0, 0 ); +         STORE( func, *inst, 0, 0, chan_index ); +      }        break;     case TGSI_OPCODE_CMP: | 
