Created attachment 40303 [details] test case for piglit shader_runner GLSL spec v1.10 Section 7.6 says: "Unlike user-defined varying variables, the built-in varying variables don't have a strict one-to-one correspondence between the vertex language and the fragment language. Two sets are provided, one for each language." The attached case tries to declare varying built-in variable gl_TexCoord to different sizes between vertex and fragment shaders, but it fails to link: error: vertex shader output 'gl_TexCoord' declared as type 'vec4[2]', but fragment shader input declared as type 'vec4[1]' Tested on Piketon (i965) with mesa master.
In the vertex shader, there are built-in outputs called gl_FrontColor and gl_BackColor. One of these ends up in the fragment shader built-in input gl_Color. This is what section 7.6 is referring to. gl_TexCoord is a bit of a special case. It's declared as 'vec4 gl_TexCoord[]' (unsized array), and shaders that will use variable accesses to it must redeclare it with a size. This sizes of other arrays, even built-in arrays, are required to match between the vertex shader and the fragment shader. What does this test do on other GL implementations? Perhaps Vinson and Ken can try it on "the other three" and let us know.
Catalyst 10.10 succesfully links the two shaders and draws green. I was concerned that gl_TexCoord might have been dead-code eliminated, seeing as the test never reads nor writes it, but even after modifying the test to use it, the two shaders still link. I don't have access to my nVidia hardware at the moment, but I can try it soon.
The attached piglit case (id=40303) passes on Mac OS X. The entire window is green.
The attached piglit case (id=40303) passes on the Windows Intel driver. The entire window is green.
The attached piglit case (id=40303) passes with the NVIDIA driver. The entire window is green.
I've committed the attachment id=40303 to piglit.
commit cb2b547a4771ddf56975ede566dbf3a8f5389689 Author: Ian Romanick <ian.d.romanick@intel.com> Date: Mon Dec 13 15:16:39 2010 -0800 linker: Allow built-in arrays to have different sizes between shader stages Fixes pitlit test glsl-link-varying-TexCoord (bugzilla #31650).
Reopening until the fix is cherry-picked to the 7.10 and 7.9 branches. Apologies for the breach of procedure.
commit 4febfee3b77faa8abbcc152896d76de30043c823 Author: Ian Romanick <ian.d.romanick@intel.com> Date: Mon Dec 13 15:16:39 2010 -0800 linker: Allow built-in arrays to have different sizes between shader stages Fixes pitlit test glsl-link-varying-TexCoord (bugzilla #31650). (cherry picked from commit cb2b547a4771ddf56975ede566dbf3a8f5389689)
verified on 7.10 branch
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.