Files
ispc/tests/gather-struct-vector.ispc
Matt Pharr f81acbfe80 Implement unbound varibility for struct types.
Now, if a struct member has an explicit 'uniform' or 'varying'
qualifier, then that member has that variability, regardless of
the variability of the struct's variability.  Members without
'uniform' or 'varying' have unbound variability, and in turn
inherit the variability of the struct.

As a result of this, now structs can properly be 'varying' by default,
just like all the other types, while still having sensible semantics.
2012-02-21 10:28:31 -08:00

32 lines
697 B
Plaintext

struct Ray {
float<3> v;
};
export uniform int width() { return programCount; }
export void f_f(uniform float RET[], uniform float aFOO[]) {
Ray r[programCount];
for (uniform int i = 0; i < programCount; ++i) {
r[i].v.x = 100*i + programIndex;
r[i].v.y = 200*i + 2*programIndex;
r[i].v.z = 300*i + 3*programIndex;
}
varying Ray *rp = &r[programIndex/2];
RET[programIndex] = rp->v.z;
}
export void result(uniform float RET[]) {
uniform int d0 = 0;
uniform int d1 = 0;
for (uniform int i = 0; i < programCount; i += 2) {
RET[i] = d0+d1;
d1 += 3;
RET[i+1] = d0+d1;
d0 += 300;
d1 += 3;
}
}