Add foreach and foreach_tiled looping constructs
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
This commit is contained in:
13
tests/foreach-7.ispc
Normal file
13
tests/foreach-7.ispc
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
float sum = 0;
|
||||
foreach (i = 0 ... 6)
|
||||
sum += aFOO[i];
|
||||
RET[programIndex] = reduce_add(sum);
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 21;
|
||||
}
|
||||
Reference in New Issue
Block a user