[Mesa-dev] [PATCH 01/15] i965: get the proper vertex surface type for doubles on gen8+

Alejandro Piñeiro apinheiro at igalia.com
Wed May 4 13:30:13 UTC 2016



On 04/05/16 12:31, Kenneth Graunke wrote:
> On Thursday, April 28, 2016 1:40:31 PM PDT Antia Puentes wrote:
>> From: Alejandro Piñeiro <apinheiro at igalia.com>
>>
>> This commit adds support for PASSTHRU format when pushing
>> double-precision attributes.
>>
>> Check glarray->Doubles in order to know if we should choose a format
>> that does a conversion to float, or just passthru the 64-bit double.
>> ---
>>  src/mesa/drivers/dri/i965/brw_draw_upload.c | 30 +++++++++++++++++++++++++
> +---
>>  1 file changed, 27 insertions(+), 3 deletions(-)
> What's the motivation for using the PASSTHRU formats?  Is there some
> advantage over just using the R64*FLOAT formats?

We can't use R64*FLOAT because it does a double to float conversion, as
explained at the bdw PRM (vol 7, section 10.15, page 470, Table "Source
Element Formats Supported in VF Unit"). PASSTHRU ensures that the
64-bits are passed without any conversion, that is what we want. If it
is not clear reading the commit message, I could expand it.

FWIW, the R64*FLOAT format is used when calling the previous API
(without *L*). You can call glVertexAttribPointer using GL_DOUBLE as
type, but it will feed the shaders with floats. That conversion is done
using R64*FLOAT formats when uploading the data. When using
glVertexAttrib with GL_DOUBLE, the casting to float is done on the call
itself, at mesa/main.

Finally, the alternative to R64*PASSTHRU formats would be using
R32*FLOAT formats, and doing two uploads if needed (for dvec3/dvec4). We
needed to do that for the in-progress gen7 support, and means some extra
code compared to just use PASSTHRU. If you are curious:
https://github.com/Igalia/mesa/commit/7d4b0c5cff33a3b555a9c5d38b1af0aeba697cac

Best regards








More information about the mesa-dev mailing list