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.
This commit is contained in:
Matt Pharr
2011-11-03 13:15:07 -07:00
parent 6084d6aeaf
commit 43a2d510bf
7 changed files with 247 additions and 129 deletions

View File

@@ -12,12 +12,12 @@ export void f_fi(uniform float RET[], uniform float a[], uniform int bFOO[]) {
uniform int i;
for (i = 0; i < 17; ++i) {
myFoo[i].x = i;
myFoo[i].f = 2*i;
myFoo[i].f = 17+2*i;
}
RET[programIndex] = myFoo[b/2].f;
}
export void result(uniform float RET[]) {
RET[programIndex] = 2 + 2 * programIndex;
RET[programIndex] = 19 + 2 * programIndex;
}