<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Dear all,<div>Can someone help me?</div><div>I just want to make clear if the two condition is sure in shading language.</div><div>1. define a function with unnamed arguments is not allowed in piglit.</div><div><div><div>> float a(float x, float )</div><div><span style="line-height: 1.7;">></span><span style="line-height: 1.7;"> </span>{</div><div><span style="line-height: 1.7;">></span><span style="line-height: 1.7;"> </span> return x;</div><div><span style="line-height: 1.7;">></span><span style="line-height: 1.7;"> </span>}</div></div><div><a href="http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/parameters-04.vert">http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/parameters-04.vert</a></div>2. declaration of function in function scope is allowed in piglit.</div><div><pre>> void main() {
> float foo(float x);
> gl_FragColor = vec4(0.0, foo(0.5), 0.0, 1.0);
> }
<a href="http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/local-function-03.frag" target="_blank" style="color: rgb(0, 51, 153); white-space: normal;">http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/local-function-03.frag</a></pre>Thanks.<br><div></div><div id="divNeteaseMailCard"></div><br>At 2013-11-25 16:08:28,chris <wwzbwwzb@163.com> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><span style="line-height: 1.7;">This test should be pass but fail. (glslparsertest/glsl2/parameters-04.vert)</span><br><div><a href="http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/parameters-04.vert">http://cgit.freedesktop.org/piglit/tree/tests/glslparsertest/glsl2/parameters-04.vert</a><br><div>// [config]</div><div>// expect_result: <b>fail</b></div><div>// glsl_version: 1.10</div><div>//</div><div>// # NOTE: Config section was auto-generated from file</div><div>// # NOTE: 'glslparser.tests' at git revision</div><div>// # NOTE: 6cc17ae70b70d150aa1751f8e28db7b2a9bd50f0</div><div>// [end config]</div><div><br></div><div>/* FAIL - formal parameter lacks a name</div><div> */</div><div>float a(float x, float )</div><div>{</div><div> return x;</div><div>}</div></div><div><br></div>glsl spec section 6.1.1<div><div><div><b><br></b></div><div><b>Hence, function definitions </b><b style="line-height: 1.7;">can have unnamed arguments.</b></div></div><div><b><br></b></div><div><b>The const qualifier cannot be used with out or inout, or a compile-time error results. The above is used </b></div><div><b>both for function declarations (i.e., prototypes) and for function definitions. Hence, function definitions </b></div><div><b>can have unnamed arguments.</b></div></div><br><div id="isForwardContent"><span title="neteasefooter"><span id="netease_mail_footer"></span></span></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>