These make it easier to iterate over arbitrary amounts of data elements; specifically, they automatically handle the "ragged extra bits" that come up when the number of elements to be processed isn't evenly divided by programCount. TODO: documentation
34 lines
867 B
Plaintext
34 lines
867 B
Plaintext
|
|
export uniform int width() { return programCount; }
|
|
|
|
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
|
#define NA 4
|
|
#define NB 8
|
|
#define NC 7
|
|
uniform int a[NA][NB][NC];
|
|
|
|
for (uniform int i = 0; i < NA; ++i)
|
|
for (uniform int j = 0; j < NB; ++j)
|
|
for (uniform int k = 0; j < NC; ++j)
|
|
a[i][j][k] = 0;
|
|
|
|
foreach_tiled (i = 0 ... NA, j = 0 ... NB, k = 0 ... NC) {
|
|
a[i][j][k] += 1;
|
|
}
|
|
|
|
uniform int errs = 0;
|
|
for (uniform int i = 0; i < NA; ++i)
|
|
for (uniform int j = 0; j < NB; ++j)
|
|
for (uniform int k = 0; j < NC; ++j)
|
|
if (a[i][j][k] != 1) {
|
|
//CO print("% % % = %\n", i, j, k, a[i][j][k]);
|
|
++errs;
|
|
}
|
|
|
|
RET[programIndex] = errs;
|
|
}
|
|
|
|
export void result(uniform float RET[]) {
|
|
RET[programIndex] = 0;
|
|
}
|