Bug 10908 - GLSL: gl_FogParamaters gl_Fog built-in uniform not functioning
Summary: GLSL: gl_FogParamaters gl_Fog built-in uniform not functioning
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: All All
: medium minor
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 29044
  Show dependency treegraph
 
Reported: 2007-05-10 13:27 UTC by James Burns
Modified: 2010-08-25 16:59 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test program desmontrating issue (26.45 KB, text/plain)
2007-05-11 08:42 UTC, James Burns
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Burns 2007-05-10 13:27:07 UTC
The entire gl_Fog structure does not seem to be filled out in sample frag shader.  Same shader does have data filled out using NVidia driver.
Comment 1 Brian Paul 2007-05-10 13:58:04 UTC
Hmmm, I don't see anything obviously broken and my glean test for the gl_Fog uniforms passes.  Can you be more specific, or provide a test shader?
Comment 2 James Burns 2007-05-11 08:42:08 UTC
Created attachment 9930 [details]
Test program desmontrating issue

This source is not exactly representative of my application where the problem is taking place.  (I'm a developer of a multispectral scene generator, layered on top of OpenSceneGraph and OSMesa.)  I have attempted to take some other sample application and replicate what I am seeing in my application.   It is possible that I have made an OpenGL faux pax here in the process of tossing this together....  The main issue is whether the gl_Fog structure is getting filled out by Mesa.  I've got a couple of cases where I try to set frag color (gl_FragColor) to be either fog density or fog color.  Neither seems to work.
Comment 3 James Burns 2007-05-11 08:59:22 UTC
(In reply to comment #1)
> Hmmm, I don't see anything obviously broken and my glean test for the gl_Fog
> uniforms passes.  Can you be more specific, or provide a test shader?
> 

Whatever is wrong (Mesa or my application...) - The symptom I see is that the gl_Fog structure is filled with zeros instead of the fog description passed down with glFogXXX calls.
Comment 4 Brian Paul 2007-05-11 14:21:09 UTC
You can omit this line from your fragment shader:

uniform gl_FogParameters gl_Fog;

The built-in uniforms are pre-declared; you don't have to declare them.

Anyway, when that line is included we're hitting a bug in Mesa.  I'll see about fixing that.
Comment 5 James Burns 2007-05-14 07:50:05 UTC
(In reply to comment #4)
> You can omit this line from your fragment shader:
> 
> uniform gl_FogParameters gl_Fog;
> 
> The built-in uniforms are pre-declared; you don't have to declare them.
> 
> Anyway, when that line is included we're hitting a bug in Mesa.  I'll see about
> fixing that.
> 


Thanks for pointing out that I could press forward by removing the declaration.
Comment 6 Ian Romanick 2009-09-17 16:56:42 UTC
I have verified that this bug still exists with Mesa GIT as of today.  On Nvidia closed-source drivers the object is blue, but on Mesa (both swrast and i965) the object is black.
Comment 7 Vinson Lee 2009-09-17 23:55:01 UTC
> uniform gl_FogParameters gl_Fog;

The Apple GLSL compiler will not compile the fragment shader if the above line is included. The error message "'gl_' : reserved built-in name" is given.
Comment 8 Ian Romanick 2009-09-18 11:11:45 UTC
(In reply to comment #7)
> > uniform gl_FogParameters gl_Fog;
> 
> The Apple GLSL compiler will not compile the fragment shader if the above line
> is included. The error message "'gl_' : reserved built-in name" is given.

Interesting.  I've submitted a bug against the GLSL spec for this.  While Mesa's current behavior is clearly wrong, one of the other (mutually exclusive) behaviors must also be wrong.
Comment 9 Ian Romanick 2010-08-25 16:59:23 UTC
The GLSL 1.30, 1.40, and 1.50 specs were clarified that, with a couple exceptions, it is illegal to redeclare a variable.  The glsl2 compiler in Mesa rejects the declaration with the following error:

0:3(32): error: `gl_Fog' redeclared

Closing this bug as fixed.


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.