Search code examples
hlsl

If statement doesn't return a value on all paths


I have a shader code snippet of a blend function in Photoshop. However, due to the way the if statement is written, I have a hard time understanding what it returns.

This is the if statement I have trouble understanding:

if(float2(0,0) < 0)
    ...;

What is returned in case the value returns == or >?


Solution

  • The if statement will return true or false. If true c will be set to a new value. If it returns false c is not changed. At the end of the method c is returned. Ultimately c will be between 0 and 1.