[PATCH 5/6] d3dcompiler: Store initializers inside the hlsl_ir_var structure.

Matteo Bruni matteo.mystral at gmail.com
Wed Jun 17 11:23:43 CDT 2020


On Wed, Jun 17, 2020 at 5:47 PM Zebediah Figura <zfigura at codeweavers.com> wrote:
>
> On 6/17/20 10:29 AM, Matteo Bruni wrote:
> > I see what you're doing but I'm a bit bothered by the part where you
> > store the initializers into struct hlsl_ir_var. I don't know that it
> > is a fair "complaint", it's certainly mostly stylistical. But hear my
> > variation and see if it makes any sense to you.
> >
> > Initializers could be temporarily stored in a special list inside
> > hlsl_ctx. Here in declaration_statement and other places where you
> > process initializers, you list_move_head() from that list to $$ and
> > that's it.
>
> It would work, I think, and I agree it'd be simpler than this patch. The
> one place this approach gets hairy is with uniform initializers (which
> translate to default values). We could parse that in declare_vars() and
> store it as a flat value in hlsl_ir_var without difficulty, but we'd
> need to be able to run constant folding over it (and maybe other passes?
> Of course, I don't even have examples of anything that needs uniform
> initializers.)

Good point on uniform initializers, that's a bit awkward. It seems to
me that those are annoying either way, since they probably can refer
to arbitrary (constant) expressions and need to be constant folded to
compute the default value, but you want to load the uniform in the
actual shader. Hopefully they can wait...



More information about the wine-devel mailing list