[Piglit] glslparsertest/glsl2/local-function-03.frag is this a bug?

Ian Romanick idr at freedesktop.org
Tue Dec 3 12:29:48 PST 2013


On 11/25/2013 06:11 PM, chris wrote:
> Dear all,
> Can someone help me?
> I just want to make clear if the two condition is sure in shading language.
> 1.  define a function with unnamed arguments is not allowed in piglit.
>> float a(float x, float )
>> {
>>   return x;
>> }
> http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/parameters-04.vert

Do you know if this works on other GLSL implementations?  This test was
added before we started quoting spec text in the tests, so I'm not sure
why I added it... possibly because it's not allowed in C (but it is in C++)?

> 2. declaration of function in function scope is allowed in piglit.
> 
>> void main() {
>>     float foo(float x);
>>     gl_FragColor = vec4(0.0, foo(0.5), 0.0, 1.0);
>> }
> 
> http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/local-function-03.frag

This is probably a bogus test.  The GLSL grammar allows function
declarations at arbitrary locations, but starting with GLSL 1.20, the
text of the spec requires that declarations be at global scope.  We
probably should have taken this to be a clarification of the 1.10 spec.
 I don't think any other implementation allows this behavior.

> Thanks.
> 
> At 2013-11-25 16:08:28,chris <wwzbwwzb at 163.com> wrote:
> 
>     This test should be pass but fail.
>     (glslparsertest/glsl2/parameters-04.vert)
>     http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/parameters-04.vert
>     // [config]
>     // expect_result: *fail*
>     // glsl_version: 1.10
>     //
>     // # NOTE: Config section was auto-generated from file
>     // # NOTE: 'glslparser.tests' at git revision
>     // # NOTE: 6cc17ae70b70d150aa1751f8e28db7b2a9bd50f0
>     // [end config]
> 
>     /* FAIL - formal parameter lacks a name
>      */
>     float a(float x, float )
>     {
>       return x;
>     }
> 
>     glsl spec section 6.1.1
>     *
>     *
>     *Hence, function definitions **can have unnamed arguments.*
>     *
>     *
>     *The const qualifier cannot be used with out or inout, or a
>     compile-time error results.  The above is used *
>     *both for function declarations (i.e., prototypes) and for function
>     definitions.  Hence, function definitions *
>     *can have unnamed arguments.*
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit



More information about the Piglit mailing list