mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-31 09:10:32 +01:00
tgsi: Implement OPCODE_SSG/SGN.
This commit is contained in:
parent
adf14090fb
commit
823aac36d5
2 changed files with 46 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -1083,6 +1083,29 @@ emit_setsign(
|
|||
TGSI_EXEC_TEMP_80000000_C ) );
|
||||
}
|
||||
|
||||
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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue