It is no longer legal to initialize arrays and structs with single

scalar values (that ispc used to smear across the array/struct
elements).  Now, initializers in variable declarations must be
{ }-delimited lists, with one element per struct member or array
element, respectively.

There were a few problems with the previous implementation of the
functionality to initialize from scalars.  First, the expression
would be evaluated once per value initialized, so if it had side-effects,
the wrong thing would happen.  Next, for large multidimensional arrays,
the generated code would be a long series of move instructions, rather
than loops (and this in turn made LLVM take a long time.)

While both of these problems are fixable, it's a non-trivial
amount of re-plumbing for a questionable feature anyway.

Fixes issue #50.
This commit is contained in:
Matt Pharr
2011-07-01 13:45:58 +01:00
parent a2940d63b4
commit d2d5858be1
40 changed files with 114 additions and 57 deletions

View File

@@ -13,7 +13,10 @@ struct Bar {
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
float a = aFOO[programIndex];
uniform Bar bar = 2.;
uniform Bar bar;
for (uniform int i = 0; i < 6; ++i)
for (uniform int j = 0; j < 6; ++j)
bar.foo[i].f[j] = 2.;
RET[programIndex] = bar.foo[b].f[b];
}