Add foreach_unique iteration construct.

Idea via Ingo Wald / IVL compiler.
This commit is contained in:
Matt Pharr
2012-06-20 10:03:44 -07:00
parent fae47e0dfc
commit 3bc66136b2
17 changed files with 488 additions and 6 deletions

View File

@@ -0,0 +1,15 @@
export uniform int width() { return programCount; }
export void f_f(uniform float RET[], uniform float aFOO[]) {
uniform int count = 0;
int a = aFOO[programIndex];
if (a & 1)
foreach_unique (ua in a & 1)
++count;
RET[programIndex] = count;
}
export void result(uniform float RET[]) {
RET[programIndex] = 1;
}