您如何有效地进行并行选择?
例如,给定这个标量代码,有没有办法编写它,以便 Cg 编译器使代码并行/ SIMD 执行(并且可能使用无分支选择)。
Out.x = ( A.x <= threshold) ? B.x : C.x ;
Out.y = ( A.y <= threshold) ? B.y : C.y ;
Out.z = ( A.z <= threshold) ? B.z : C.z ;
Out.w = ( A.w <= threshold) ? B.w : C.w ;