[Piglit] [PATCH] arb_uniform_buffer_object: Add UBO from vs-struct-pad tests

Paul Berry stereotype441 at gmail.com
Mon Aug 19 10:29:15 PDT 2013


On 16 August 2013 22:03, Ian Romanick <idr at freedesktop.org> wrote:

> On 08/16/2013 01:38 PM, Ian Romanick wrote:
>
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> The vs-struct-pad and fs-struct-pad tests both fail on Mesa.  The UBOs
>> from those tests are added here to help narrow down the origin of the
>> problem.
>>
>> This test passes on NVIDIA (304.64 on GTX 260).
>>
>> v2: Correct version of the patch to send to the list.
>>
>
> After more review of the spec (and testing on AMD drivers), I believe the
> first version (with offsets 0, 16, 20, and 24) is correct after all.  It
> all comes down to this text from rule #9 (emphasis mine):
>
>       (9) If the member is a structure, the base alignment of the
> structure is
>           <N>, where <N> is the largest base alignment value of any of its
>           members, and *rounded up to the base alignment of a vec4*. The
>           individual members of this sub-structure are then assigned
> offsets
>           by applying this set of rules recursively, where the base offset
> of
>           the first member of the sub-structure is equal to the aligned
> offset
>           of the structure. The structure may have padding at the end; the
>           base offset of the member following the sub-structure is rounded
> up
>           to the next multiple of the base alignment of the structure.
>
> In part of our code we're not doing the rounding on substructures, and it
> doesn't look like my old NVIDIA drivers are either.  Ugh.


I agree with your analysis.  The first version (with offsets 0, 16, 20, 24)
is correct.

I'd recommend adding a comment to the test quoting the spec test you've
quoted above, so that people don't have to go digging through email
archives to understand why you chose the offsets you did.

With the comment added, the test is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130819/e5b5c227/attachment.html>


More information about the Piglit mailing list