Bug 31284

Summary: [glsl2] fail to link uniform array with identical initializer across 2 shaders
Product: Mesa Reporter: zhao jian <jian.j.zhao>
Component: Mesa coreAssignee: Ian Romanick <idr>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: chadversary, kenneth
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: glsl uniform array in vertext and fragment shader
glsl uniform array in vertext and fragment shader

Description zhao jian 2010-11-01 01:13:05 UTC
I fail to run some shader test which has uniform arrays in its vertex and uniform shaders, and it failed in its link stage, the error is something like: 
Failed to link:
error: initializers for uniform `f' have differing values
Couldn't find uniform for initializer f
Couldn't find uniform for initializer f

I tested on Piketon with:
Libdrm:         (master)2.4.22-6-g0a1ff35c70730160973715b82112cd97c62ac13e
Mesa:           (master)aa43176ebd26227947b07221f4e475c52bd7a76b
Xserver:    (master)xorg-server-1.9.0-178-g1a0d9324b3d9fd93e685066e0e5cea0611878c0d
Xf86_video_intel:  (master)2.12.902-24-gb066ddda31e40afa652ae51ffc35025ac3ef6f2a
Kernel_unstable:       (drm-intel-next)176f28ebf4303b4f7e3a5bd8be7842a8bbecd9c3
Comment 1 zhao jian 2010-11-01 01:22:15 UTC
Created attachment 39943 [details]
glsl uniform array in vertext and fragment shader
Comment 2 zhao jian 2010-11-01 01:25:35 UTC
And the GLSL spec 1.20 and 1.40 all had a section of uniform saying this: 
"The uniform qualifier can be used with any of the basic data types, or when declaring a variable whose type is a structure, or an array of any of these.If multiple shaders are linked together, then they will share a single global uniform name space. Hence,the types and initializers of uniform variables with the same name must match across all shaders that are linked into a single executable. It is legal for some shaders to provide an initializer for a particular uniform variable, while another shader does not, but all provided initializers must be equal."
Comment 3 zhao jian 2010-11-01 18:36:01 UTC
Comment on attachment 39943 [details]
glsl uniform array in vertext and fragment shader

There is a typo in it.
Comment 4 zhao jian 2010-11-01 18:39:13 UTC
Created attachment 39972 [details]
glsl uniform array in vertext and fragment shader
Comment 5 Vinson Lee 2010-11-24 16:43:34 UTC
I've committed the attachment id=39972 to piglit.
Comment 6 Gordon Jin 2010-11-29 22:57:39 UTC
Suggesting this as higher priority. It impacts many of our testcases so it will be good to get fixed first.
Comment 7 Chad Versace 2010-12-03 13:58:39 UTC
Fixed in Mesa commit b381eff1411dea5b9e0c9fbc8641a8760052b2eb.
Changing status to RESOLVED/FIXED.
Comment 8 zhao jian 2010-12-06 17:45:38 UTC
(In reply to comment #7)
> Fixed in Mesa commit b381eff1411dea5b9e0c9fbc8641a8760052b2eb.
> Changing status to RESOLVED/FIXED.

Yes. It was fixed by Mesa commit b381eff1411dea5b9e0c9fbc8641a8760052b2eb. verified.

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.