Files
ispc/tests/foreach-mask-1.ispc
Matt Pharr d74cc6397b Fix significant bug in mask management in code generated for 'foreach'.
In particular, we 1. weren't setting the function mask to 'all on', such that
any mixed function mask would in turn apply inside the foreach loop, and 2.
weren't always setting the internal mask to 'all on' before doing any additional
masking based on the iteration variables.
2012-03-19 15:06:35 -07:00

22 lines
542 B
Plaintext

export uniform int width() { return programCount; }
export void f_f(uniform float RET[], uniform float aFOO[]) {
uniform float val[programCount+3];
for (uniform int i = 0; i < programCount+3; ++i)
val[i] = 0;
// make sure we reset the func mask in the foreach loop...
if ((int)aFOO[programIndex] & 1)
foreach (i = 0 ... programCount+3)
val[i] += aFOO[i] - 1;
RET[programIndex] = val[3+programIndex];
}
export void result(uniform float RET[]) {
RET[programIndex] = programIndex+3;
}