Bug 27265

Summary: GLSL Compiler doesnt link the attached vertex shader
Product: Mesa Reporter: Karthik Hariharakrishnan <karhar01>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium    
Version: 7.5   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 29044    
Attachments: Vertex Shader that fails to link
source code - sample GLES app
fragment shader used in main.c
do varying var allocation upon usage to use fewer regs

Description Karthik Hariharakrishnan 2010-03-23 07:32:54 UTC
Created attachment 34365 [details]
Vertex Shader that fails to link

The attached vertex shader does not link. A call to 
glGetProgramiv(program, GL_LINK_STATUS, &result)after glLinkProgram  returns GL_FALSE.

Attaching the code and the shaders.
Comment 1 Karthik Hariharakrishnan 2010-03-23 07:33:37 UTC
Created attachment 34366 [details]
source code - sample GLES app
Comment 2 Karthik Hariharakrishnan 2010-03-23 07:34:03 UTC
Created attachment 34367 [details]
fragment shader used in main.c
Comment 3 Brian Paul 2010-03-23 09:19:23 UTC
Created attachment 34368 [details] [review]
do varying var allocation upon usage to use fewer regs

The fragment shader is trying to read a varying var that's never written to (or declared in) the vertex shader.  So that's an error.

I modified the fragment shader accordingly and found the link still failed because of too many varying vars.  However, a lot of varying vars are declared but not actually used in the shader.

The following patch avoids allocating a register slot for varyings that aren't used.  With this patch, the test works.  Want to give it a try?  I've only lightly tested it so far.
Comment 4 Eric Anholt 2010-08-17 08:33:17 UTC
With the glsl2 merge, written but not read varyings are demoted to auto, and likely dead-code eliminated as a result.  So this should be fixed now.

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.