aboutsummaryrefslogtreecommitdiffstats
path: root/src/getopt
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-08-03 15:27:43 -0700
committerIan Romanick <[email protected]>2011-08-16 14:09:42 -0700
commit92ca560d68e8a6b532998707afcf4f60c0ce2806 (patch)
treec025c0c9f684b584f56dd151ee51570c000c2e9c /src/getopt
parent7f4c65256cc3f4d9f6a214424beabe688a5dd6a2 (diff)
ir_to_mesa: Implement ir_unop_any using DP4 w/saturate or DP4 w/SLT
This is just like the ir_binop_logic_or case. The operation ir_unop_any is (a.x || a.y || a.z || a.w). Logical-or is implemented using addition (followed by clampling to [0,1]) on values of 0.0 and 1.0. Replacing the logical-or operators with addition gives (a.x + a.y + a.z + a.w). This can be implemented using a dot-product with a vector of all 1.0. Previously a SNE instruction was used to clamp the resulting logic value to [0,1]. In a fragment shader, using a saturate on the dot-product has the same effect. Adding the saturate to the dot-product is free, so (at least) one instruction is saved. In a vertex shader, using an SLT on the negation of the dot-product result has the same effect. Many older shader architectures do not support the SNE instruction. It must be emulated using two SLT instructions and an ADD. On these architectures, the single SLT saves two instructions. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/getopt')
0 files changed, 0 insertions, 0 deletions