Files
ispc/tests/entry-mask-for.ispc
Matt Pharr 926b3b9ee3 Fix bugs with mask-handling for switch/do/for/while statements.
All of these pass the current mask to FunctionEmitContext::SetBlockEntryMask()
so that when a break/continue/return is encountered, it can test to see if all
lanes have followed that path and then return; this in turn ensures that we never
run statements with an all-off execution mask.

These functions were passing the function internal mask, not the full mask, and
thus could end up executing code with the mask all off if some lanes were
disabled by an outer function.  (The new tests test this case.)
2012-07-09 15:13:30 -07:00

31 lines
603 B
Plaintext

export uniform int width() { return programCount; }
int * uniform ptr = NULL;
int func(int v) {
int ret;
// print("%\n", v);
for (;;) {
if (v == 0) {
ret = 1;
break;
}
*ptr = 1;
}
return ret;
}
export void f_f(uniform float RET[], uniform float aFOO[]) {
int count = 10;
if (programIndex & 1)
count = 0x7ffffff;
RET[programIndex] = 0;
if (!(programIndex & 1))
RET[programIndex] = func(programIndex & 1);
}
export void result(uniform float RET[]) {
RET[programIndex] = !(programIndex & 1);
}