[Mesa-dev] [PATCH v2 11/15] glsl/linker: dvec3/dvec4 may consume twice input vertex attributes
airlied at gmail.com
Fri May 13 20:41:04 UTC 2016
On 13 May 2016 at 18:34, Juan A. Suarez Romero <jasuarez at igalia.com> wrote:
> 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
>> 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.
For MAX_VERTEX_ATTRIBS I think we always want to count as
2. It's was an oversight on my part I think if I missed that.
But yes be careful with locations as it consumes two attributes,
but not two locations.
location 3 dvec3
location 4 dvec3
is valid, but they consume 4 attributes.
More information about the mesa-dev