[Piglit] [PATCH] glsl-1.10: Test that empty declarations are allowed

Chad Versace chad at chad-versace.us
Fri Aug 5 14:51:36 PDT 2011


On 08/05/2011 02:03 PM, Ian Romanick wrote:
> On 08/05/2011 12:34 PM, Chad Versace wrote:
>> This tests that each of the following empty declarations is allowed:
>>     vert, local:     float
>>     vert, local:     const float
>>     vert, global:    float
>>     vert, global:    const float
>>     vert, attribute: float
>>     vert, varying:   float
>>     vert, uniform:   float
> 
>> Surprisingly, the formal GLSL grammar allows empty declarations.  From
>> page 68 (page 74 of pdf) of the GLSL 1.10 spec:
>>      init_declarator_list:
>>          single_declaration
>>          ...
> 
>>      single_declaration:
>>          fully_specified_type
>>          ...
> 
>>      fully_specified_type:
>>          type_specifier
>>          type_qualifier type_specifier
> 
>> Since this property of the grammar is consistent through all versions of
>> GLSL (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
> 
>> Moreover, C99 allows empty declarations. The program below successfully
>> compiles with `gcc --std=c99`.
>>     float;
>>     int main() { return 0; }
> 
> These look good, but there are a couple things that should be added:
> 
> 1. Check the GLSL ES spec for the same issue.  If it exists there, make
> '#version 100' tests as well.

Will do.

> 2. Check the GLSL spec for other cases that may have this issue.  Can
> you use a qualifier (e.g., uniform) with an incomplete declaration?
> Make tests (positive or negative) for those as well.

The grammar allows type_qualifier to precede type_specifier, which means we
should have tests for centroid, precision quals, and the rest.

> Before these get committed, I'd also like to see the commit message
> enumerate the platforms that pass / fail with some brief explanation.
> "XYZ driver / OS passes."   "ABC driver / OS fails because of this,
> that, and the other thing."

I'll test against NVidia and Apple. Since this peculiarity of the grammar isn't
high priority for me, I'll wait until we return to SIGGRAPH.


-- 
Chad Versace
chad at chad-versace.us

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20110805/5542c243/attachment-0001.pgp>


More information about the Piglit mailing list