[Mesa-dev] SpvOpSelect w/ float operands

Brian Paul brianp at vmware.com
Tue Nov 17 17:25:05 UTC 2020


Using the Intel Vulkan driver, we've found some cases where SpvOpSelect 
is returning -0.0 (negative zeros) instead of normal 0.0 depending on 
the arguments.

I'm wondering if "SpvOpSelect x, a, b" for floats is being implemented 
with something like "a*x + b*(1-x)" ?  That might explain where the 
negative zeros are coming from.

Our work-around is to implement selection with bitwise operations: (a & 
x) | (b & ~x)

It seems to me that SpvOpSelect shouldn't interpret the bits and just 
return an exact copy of the argument.

-Brian


More information about the mesa-dev mailing list