[Piglit] glslparsertest/glsl2/local-function-03.frag
chris
wwzbwwzb at 163.com
Mon Nov 25 00:04:15 PST 2013
Sorry, I found I have quoted the wrong place of spec.
But the test is in git http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/local-function-03.frag
quoted in spec section 4.2:
Function declarations (prototypes) cannot occur
inside of functions;
The built-in functions are scoped in a scope outside the global scope users declare global variables in.
That is, a shader's global scope, available for user-defined functions and global variables, is nested inside
the scope containing the built-in functions. When a function name is redeclared in a nested scope, it hides
all functions declared with that name in the outer scope. Function declarations (prototypes) cannot occur
inside of functions; they must be at global scope, or for the built-in functions, outside the global scope,
otherwise a compile-time error results.
At 2013-11-25 15:54:50,"Chris Forbes" <chrisf at ijw.co.nz> wrote:
>I'm not sure you quoted the bit of spec you intended to, but that test
>looks pretty bogus at a first glance.
>
>-- Chris
>
>On Mon, Nov 25, 2013 at 8:08 PM, chris <wwzbwwzb at 163.com> wrote:
>> Dear all,
>>
>> I run this test(glslparsertest/glsl2/local-function-03.frag),and I think it
>> is may be bug of piglit.
>>
>> As spec, this test should be fail, but pass, since declaration function in
>> not in global scope should be an error.
>>
>> Is there anyone noticed this test?
>>
>> // [config]
>> // expect_result: pass
>> // glsl_version: 1.10
>> //
>> // # NOTE: Config section was auto-generated from file
>> // # NOTE: 'glslparser.tests' at git revision
>> // # NOTE: 6cc17ae70b70d150aa1751f8e28db7b2a9bd50f0
>> // [end config]
>>
>> /* PASS - local function declarations are not allowed in GLSL 1.10. */
>> #version 110
>> void main() {
>> float foo(float x);
>> gl_FragColor = vec4(0.0, foo(0.5), 0.0, 1.0);
>> }
>>
>> float foo(float x) {
>> return x + 0.5;
>> }
>>
>> In glsl 1.1.0 section 6.1.1:
>> 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
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131125/c35c7b97/attachment-0001.html>
More information about the Piglit
mailing list