Is there some builtin fragment function in CG that allows me to compute the following without conditionals?

y = x>bias?1.0f:0.0f;

有帮助吗?

解决方案

Almost. It's a >= instead of a >

http://http.developer.nvidia.com/Cg/step.html

y = step(bias, x);

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top