[Mesa-dev] [PATCH] nir: Always print non-xyzw swizzles.
Jason Ekstrand
jason at jlekstrand.net
Mon Sep 21 21:55:45 PDT 2015
On Sep 21, 2015 9:48 PM, "Ilia Mirkin" <imirkin at alum.mit.edu> wrote:
>
> On Tue, Sep 22, 2015 at 12:45 AM, Matt Turner <mattst88 at gmail.com> wrote:
> > On Mon, Sep 21, 2015 at 9:37 PM, Ilia Mirkin <imirkin at alum.mit.edu>
wrote:
> >> On Tue, Sep 22, 2015 at 12:31 AM, Matt Turner <mattst88 at gmail.com>
wrote:
> >>> Previously we would not print a swizzle on ssa_52 when only its .x
> >>> component is used (as seen in the definition of ssa_53):
> >>>
> >>> vec3 ssa_52 = fadd ssa_51, ssa_51
> >>> vec1 ssa_53 = flog2 ssa_52
> >>> vec1 ssa_54 = flog2 ssa_52.y
> >>> vec1 ssa_55 = flog2 ssa_52.z
> >>>
> >>> But this makes the interpretation of the RHS of the definition
difficult
> >>> to understand and dependent on the size of the LHS. Just print
swizzles
> >>> when they are not .xyzw (which is only possible on vec4 uses), so the
> >>> previous example is now printed as:
> >>>
> >>> vec3 ssa_52 = fadd ssa_51.xyz, ssa_51.xyz
> >>
> >> IMHO if ssa_51 is a vec3, this makes sense without the .xyz. I'd
> >> change the condition to print the identity swizzle only if source size
> >> != output size, not sure if that's easy to do though.
> >
> > I actually like it better as is for the same reason as stated -- you
> > don't have to know the type of the ssa value to know what it is.
>
> Well, you'd know based on whether the swizzle is printed or not. If no
> swizzle, then it's the same size as the dest. Anyways, your way is an
> argument to always just print the swizzle, for vec4's as well.
I think I'd be inclined to agree with ilia. I fully agree that "vec1 ssa_25
= fadd ssa_4, ssa_7.y" is silly when ssa_4 is a vec3. However, I would like
to drop the swizzles whenever it's "clear from the context". That probably
means source is the same size as destination, identity swizzle, and all
channels written.
--Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150921/bf27f83b/attachment-0001.html>
More information about the mesa-dev
mailing list