diff options
author | Keith Whitwell <[email protected]> | 2009-09-12 18:33:46 -0700 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2009-09-12 18:33:46 -0700 |
commit | 18e5f1cee4cadc6306ebc2e2ba047172ff42556a (patch) | |
tree | d7eaa67b09be8bde426794f8664f8a6c38dcb67d | |
parent | 055fe5768c6e455b3466be47e1771711c495f1c6 (diff) |
tgsi: implement saturation
Fix recent performance regression.
-rw-r--r-- | progs/fp/add-sat.txt | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_sse2.c | 43 |
2 files changed, 32 insertions, 17 deletions
diff --git a/progs/fp/add-sat.txt b/progs/fp/add-sat.txt new file mode 100644 index 00000000000..2253efb0855 --- /dev/null +++ b/progs/fp/add-sat.txt @@ -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 diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 3cdf8b9f359..53e3f746eef 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -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; |