Bug 27265 - GLSL Compiler doesnt link the attached vertex shader
Summary: GLSL Compiler doesnt link the attached vertex shader
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 7.5
Hardware: Other All
: medium major
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 29044
  Show dependency treegraph
 
Reported: 2010-03-23 07:32 UTC by Karthik Hariharakrishnan
Modified: 2010-08-17 08:33 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Vertex Shader that fails to link (15.75 KB, text/x-csrc)
2010-03-23 07:32 UTC, Karthik Hariharakrishnan
Details
source code - sample GLES app (13.77 KB, text/x-csrc)
2010-03-23 07:33 UTC, Karthik Hariharakrishnan
Details
fragment shader used in main.c (536 bytes, text/x-csrc)
2010-03-23 07:34 UTC, Karthik Hariharakrishnan
Details
do varying var allocation upon usage to use fewer regs (3.71 KB, patch)
2010-03-23 09:19 UTC, Brian Paul
Details | Splinter Review

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.