Please do not reply to this email: if you want to comment on the bug, go to
the URL shown below and enter yourcomments there.
https://bugs.freedesktop.org/show_bug.cgi?id=8065
------- Additional Comments From [EMAIL PROTECTED] 2006-08-31 08:19 -------
I have managed to extract the shader causing trouble and, as I expected, the fix
was not necessary - the shader is ill-formed, I am affraid. The Mesa's GLSL
compiler is under development and allows you to do some "extra" things that are
illegal. Other compilers from other vendors also have some "features", but they
are different from ours.
Particularly, Mesa GLSL currently accepts the following code:
const vec3 precalc_sin30 = vec3 (sin (30.0));
const float other_precalculated_constant = clamp (pow (cos (66.6), 16.0), 0.0,
1.0);
void main () {
gl_FragColor = vec4 (precalc_sin30, other_precalculated_constant);
}
It accepts it only because it does not accept lots of semantic errors.
On the other hand, celestia shader initializes a global variable with a uniform
which is illegal. The initializer must be a constant expression. Mesa will
accept that (see above), but will evaluate the initializer at compile-time,
meaning that it will be 0.0 all the time.
This is the celestia's shader.
uniform vec3 ambientColor;
vec4 diff = vec4(ambientColor, 1.0);
uniform vec3 lightcolor0;
varying vec2 diffTexCoord;
uniform sampler2D diffTex;
varying vec2 normTexCoord;
varying vec3 lightDir0;
uniform sampler2D normTex;
void main(void)
{
vec4 color;
vec3 n = texture2D(normTex, normTexCoord.st).xyz * vec3(2.0, 2.0, 2.0) -
vec3(1.0, 1.0, 1.0);
float l;
l = max(0.0, dot(lightDir0, n)) * clamp(lightDir0.z * 8.0, 0.0, 1.0);
diff.rgb += l * lightcolor0;
color = texture2D(diffTex, diffTexCoord.st);
gl_FragColor = color * diff;
}
Simply move the initialization part to the main() function body and it will run
on Mesa and other non-nVIDIA IHVs (I suspect nVIDIA is the development
environment for celestia team).
uniform vec3 ambientColor;
uniform vec3 lightcolor0;
varying vec2 diffTexCoord;
uniform sampler2D diffTex;
varying vec2 normTexCoord;
varying vec3 lightDir0;
uniform sampler2D normTex;
void main(void)
{
vec4 color;
vec3 n = texture2D(normTex, normTexCoord.st).xyz * vec3(2.0, 2.0, 2.0) -
vec3(1.0, 1.0, 1.0);
float l;
l = max(0.0, dot(lightDir0, n)) * clamp(lightDir0.z * 8.0, 0.0, 1.0);
vec4 diff = vec4(ambientColor, 1.0);
diff.rgb += l * lightcolor0;
color = texture2D(diffTex, diffTexCoord.st);
gl_FragColor = color * diff;
}
Roland, can you report the bug to the celestia project?
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev