[Mesa-dev] [PATCH v2 11/15] glsl/linker: dvec3/dvec4 may consume twice input vertex attributes

Juan A. Suarez Romero jasuarez at igalia.com
Fri May 13 08:34:39 UTC 2016


On Fri, 2016-05-13 at 05:34 +1000, Dave Airlie wrote:
> On 13 May 2016 4:28 AM, "Antia Puentes" <apuentes at igalia.com> wrote:
> > 
> > 
> > From: "Juan A. Suarez Romero" <jasuarez at igalia.com>
> > 
> > From the GL 4.5 core spec, section 11.1.1 (Vertex Attributes):
> > 
> > "A program with more than the value of MAX_VERTEX_ATTRIBS
> > active attribute variables may fail to link, unless
> > device-dependent optimizations are able to make the program
> > fit within available hardware resources. For the purposes
> > of this test, attribute variables of the type dvec3, dvec4,
> > dmat2x3, dmat2x4, dmat3, dmat3x4, dmat4x3, and dmat4 may
> > count as consuming twice as many attributes as equivalent
> > single-precision types. While these types use the same number
> > of generic attributes as their single-precision equivalents,
> > implementations are permitted to consume two single-precision
> > vectors of internal storage for each three- or four-component
> > double-precision vector."
> > 
> > This commits adds a flag that allows driver to specify if dvec3,
> > dvec4,
> > dmat2x3, dmat2x4, dmat3, dmat3x4, dmat4x3 and dmat4 count as
> > consuming
> > twice as many attributes as equivalent single-precision types
> > (default
> > value being false).
> Doesn't this patch break all the drivers currently implementing this
> extension?
> 
> If I read it correctly, it creates the new Const, and then turns off
> the feature.
> 


Right. That const defines if those doubles consume two locations (flag
as true) or just one (flag as false), for the purposes of checking if
it reaches the MAX_VERTEX_ATTRIBS.

And the default value is to count as one (flag as false). The reason is
that this is what is happening right now in that function, except when
we use explicit location.

When you added the code to count doubles as consuming two locations,
you only did it if the locations were explicit. But in other case,
double attributes as counted as consuming one attribute.

I don't know if you only added it with explicit location for a good
reason, or just forgot to add in the general case. 

So I took the general case as the default one.

If actually the general case should count the doubles as consuming two
(as in the case of explicit), when either we can swap the flag set it
to true as default, or directly remove the flag and force all drivers
to count doubles as consuming two attributes.


> I haven't found any hardware that doesn't consume two locations, so I
> didn't
> care to implement optional support for it back when I wrote this.
> Adding optional
> support and breaking all the gallium drivers doesn't seem like the
> correct answer
> at this time either.
> 
> Dave.
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list