mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 06:00:10 +01:00
tgsi: implement saturation
Fix recent performance regression.
This commit is contained in:
parent
055fe5768c
commit
18e5f1cee4
2 changed files with 32 additions and 17 deletions
6
progs/fp/add-sat.txt
Normal file
6
progs/fp/add-sat.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
!!ARBfp1.0
|
||||
TEMP R0;
|
||||
MOV R0, fragment.color;
|
||||
ADD_SAT R0, R0, R0;
|
||||
MUL result.color, {0.5}.x, R0;
|
||||
END
|
||||
|
|
@ -1360,6 +1360,32 @@ emit_store(
|
|||
const struct tgsi_full_instruction *inst,
|
||||
unsigned chan_index )
|
||||
{
|
||||
switch( inst->Instruction.Saturate ) {
|
||||
case TGSI_SAT_NONE:
|
||||
break;
|
||||
|
||||
case TGSI_SAT_ZERO_ONE:
|
||||
sse_maxps(
|
||||
func,
|
||||
make_xmm( xmm ),
|
||||
get_temp(
|
||||
TGSI_EXEC_TEMP_00000000_I,
|
||||
TGSI_EXEC_TEMP_00000000_C ) );
|
||||
|
||||
sse_minps(
|
||||
func,
|
||||
make_xmm( xmm ),
|
||||
get_temp(
|
||||
TGSI_EXEC_TEMP_ONE_I,
|
||||
TGSI_EXEC_TEMP_ONE_C ) );
|
||||
break;
|
||||
|
||||
case TGSI_SAT_MINUS_PLUS_ONE:
|
||||
assert( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch( reg->DstRegister.File ) {
|
||||
case TGSI_FILE_OUTPUT:
|
||||
emit_output(
|
||||
|
|
@ -1388,19 +1414,6 @@ emit_store(
|
|||
default:
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
switch( inst->Instruction.Saturate ) {
|
||||
case TGSI_SAT_NONE:
|
||||
break;
|
||||
|
||||
case TGSI_SAT_ZERO_ONE:
|
||||
/* assert( 0 ); */
|
||||
break;
|
||||
|
||||
case TGSI_SAT_MINUS_PLUS_ONE:
|
||||
assert( 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define STORE( FUNC, INST, XMM, INDEX, CHAN )\
|
||||
|
|
@ -1747,10 +1760,6 @@ emit_instruction(
|
|||
if (indirect_temp_reference(inst))
|
||||
return FALSE;
|
||||
|
||||
/* we don't handle saturation/clamping yet */
|
||||
if (inst->Instruction.Saturate != TGSI_SAT_NONE)
|
||||
return FALSE;
|
||||
|
||||
/* need to use extra temps to fix SOA dependencies : */
|
||||
if (tgsi_check_soa_dependencies(inst))
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue