Summary: | celestia crashes with software mesa if opengl 2.0 render path is selected | ||
---|---|---|---|
Product: | Mesa | Reporter: | Roland Scheidegger <sroland> |
Component: | Mesa core | Assignee: | mesa-dev |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | high | ||
Version: | git | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Roland Scheidegger
2006-08-29 11:11:12 UTC
FWIW, I replaced the abort() with a _mesa_problem() call that should be more informative. (In reply to comment #1) > FWIW, I replaced the abort() with a _mesa_problem() call that should be more > informative. No longer aborts, whole saturn is fully red, and the message is: Mesa 6.5.1 implementation error: bad slang opcode 0x43 Please report at bugzilla.freedesktop.org Looks like the slang compiler is generating opcodes (such as slang_asm_vec4_copy) which the interpreter can't execute. Michal Krol will probably have to look into that. Fixed in CVS. Though I would like to see the particualr shader causing the assertion if it is possible. 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? (In reply to comment #5) > 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. Well, usually crashing isn't how opengl user errors should be handled ;-). > Roland, can you report the bug to the celestia project? Done: http://shatters.net/forum/viewtopic.php?p=76076 Mass version move, cvs -> git |
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.