I'm aware there are efficiency issues surrounding the use of branching instructions in HLSL, but I'm having trouble finding coding guidelines covering the use of branching. So, I would like to know which of the following three HLSL code snippets is the
most efficient:
// 1:
//
result = (a >= b) ? c : d;
// 2:
//
if (a >= b)
result = c;
else
result = d;
// 3:
//
x = step(a, b);
result = (x * c) + ((1 - x) * d);
Assume the underlying hardware supports dynamic flow control. Also, if you happen to know of a resource that provides information on this subject that would be great too.