From 823aac36d5580ea46f76ccec3fd31c91f168274e Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 26 Nov 2008 13:54:28 +0100 Subject: tgsi: Implement OPCODE_SSG/SGN. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/gallium/auxiliary/tgsi/tgsi_exec.c') 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 @@ -828,6 +828,17 @@ micro_rnd( dst->f[3] = floorf( src->f[3] + 0.5f ); } +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, @@ -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: -- cgit v1.2.3