diff options
author | Ian Romanick <[email protected]> | 2011-08-03 15:42:05 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2011-08-16 14:09:43 -0700 |
commit | ba01df11c4d09c65514a8522cb319e29034ab5a8 (patch) | |
tree | 830204cec99c9eff16dd6dde7c0571accc10437f /docs | |
parent | e7bf096e8b04931996c8c56548ce0b2c0af3a0dc (diff) |
ir_to_mesa: Implement ir_binop_all_equal using DP4 w/SGE
The operation ir_binop_all_equal is !(a.x != b.x || a.y != b.y || a.z
!= b.z || a.w != b.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 !bool((int(a.x != b.x) +
int(a.y == b.y) + int(a.z == b.z) + int(a.w == b.w)). This can be
implemented using a dot-product with a vector of all 1.0. After the
dot-product, the value will be an integer on the range [0,4].
Previously a SEQ instruction was used to clamp the resulting logic
value to [0,1] and invert the result. Using an SGE instruction on the
negation of the dot-product result has the same effect. Many older
shader architectures do not support the SEQ instruction. It must be
emulated using two SGE instructions and a MUL. On these
architectures, the single SGE saves two instructions.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions