문제

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