Files
ispc/tests/struct-test-118.ispc
Matt Pharr 43a2d510bf Incorporate per-lane offsets for varying data in the front-end.
Previously, it was only in the GatherScatterFlattenOpt optimization pass that
we added the per-lane offsets when we were indexing into varying data.
(Specifically, the case of float foo[]; int index; foo[index], where foo
is an array of varying elements rather than uniform elements.)  Now, this
is done in the front-end as we're first emitting code.

In addition to the basic ugliness of doing this in an optimization pass, 
it was also error-prone to do it there, since we no longer have access
to all of the type information that's around in the front-end.

No functionality or performance change.
2011-11-03 13:15:07 -07:00

23 lines
497 B
Plaintext

export uniform int width() { return programCount; }
struct Foo {
float x;
float f;
};
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
float a = aFOO[programIndex];
uniform Foo myFoo[3] = { { -1, -2 }, {a, -3}, {-4, -5} };
int i = aFOO[0];
varying Foo barFoo = myFoo[i];
//CO print("% %\n", myFoo[i].x, barFoo.x);
RET[programIndex] = barFoo.x;
}
export void result(uniform float RET[]) {
RET[programIndex] = 1+programIndex;
}