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.
24 lines
500 B
Plaintext
24 lines
500 B
Plaintext
|
|
export uniform int width() { return programCount; }
|
|
|
|
|
|
struct Foo {
|
|
uniform float x;
|
|
uniform float f;
|
|
};
|
|
export void f_fi(uniform float RET[], uniform float a[], uniform int bFOO[]) {
|
|
int b = bFOO[programIndex];
|
|
uniform struct Foo myFoo[17];
|
|
uniform int i;
|
|
for (i = 0; i < 17; ++i) {
|
|
myFoo[i].x = i;
|
|
myFoo[i].f = 17+2*i;
|
|
}
|
|
RET[programIndex] = myFoo[b/2].f;
|
|
}
|
|
|
|
|
|
export void result(uniform float RET[]) {
|
|
RET[programIndex] = 19 + 2 * programIndex;
|
|
}
|