Bug 19273 - GLSL crash backtrace with RegnumOnline game
Summary: GLSL crash backtrace with RegnumOnline game
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-24 02:52 UTC by Mateusz Kaduk
Modified: 2009-08-24 12:31 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Crash backtrace (3.06 KB, text/x-log)
2008-12-24 02:52 UTC, Mateusz Kaduk
Details
Regnum Online game log (not safe graphic mode) (42.80 KB, text/plain)
2008-12-31 01:43 UTC, Mateusz Kaduk
Details
Shaders used by game (10.05 KB, application/x-bzip)
2009-04-16 02:44 UTC, Mateusz Kaduk
Details
Comparing two screens with GLSL enabled and disabled. (96.73 KB, image/jpeg)
2009-05-07 08:14 UTC, Mateusz Kaduk
Details
Screenshot with invisible textures. (27.98 KB, image/jpeg)
2009-05-19 20:26 UTC, Mateusz Kaduk
Details

Description Mateusz Kaduk 2008-12-24 02:52:20 UTC
Created attachment 21464 [details]
Crash backtrace

Hi,
When I try to run game I get the following.

============================================
#define SHADER_MODEL_2
#ifndef GL_ARB_half_float_pixel
#define half float
#define half2 vec2
#define half3 vec3
#define half4 vec4
#endif

uniform half4 color_0;
uniform half4 color_1;
uniform half4 ov_color;
uniform sampler2D texture_base;
uniform sampler2D texture_color_mask;
uniform half specular_power;
uniform half specular_bright;

varying half2 texcoord;
varying half3 normal;
varying half3 posWorld;
varying half4 vfog;

const half3 vEyeDir = half3(0.0, 0.0, 1.0);

void main()
{
half4 clrTexture = texture2D( texture_base, gl_TexCoord[0].xy );
half4 clrDiffuseMask = texture2D( texture_color_mask, gl_TexCoord[0].xy );

half  fBaseFactor = 1.0 - (clrDiffuseMask.r * color_0.a + clrDiffuseMask.g * color_1.a);

half3 clrLayer0 	= clrDiffuseMask.r * color_0.rgb * clrTexture.rgb * color_0.a;
half3 clrLayer1 	= clrDiffuseMask.g * color_1.rgb * clrTexture.rgb * color_1.a;

half4 clrBase = (fBaseFactor * clrTexture) + half4(clrLayer0 + clrLayer1, 0.0);

half3 vNormal = normalize(normal);
half4 clrDiffuse = half4(0.0);
half4 clrSpecular = half4(0.0);

for (int i = 0; i < 2; i++)
{
half3 vLightDir = normalize(-gl_LightSource[i].position.xyz);
half fDiffuse = max(0.0, dot(vNormal, -vLightDir));
clrDiffuse += fDiffuse * gl_LightSource[i].diffuse + gl_LightSource[i].ambient;
half fSpecular = pow(max(0.0, dot(vEyeDir, reflect(vLightDir, vNormal))), specular_power);
if (fDiffuse < 0.0)
fSpecular = 0.0;
clrSpecular += gl_LightSource[i].specular * fSpecular * specular_bright;
}

#ifdef SHADER_MODEL_3
for (int i = 2; i < gl_MaxLights; i++)
{
if (gl_LightSource[i].ambient.a > 0.0) {
half3 vLightPos = gl_LightSource[i].position.xyz;
half3 vLightInf = vLightPos - posWorld;
half fLightDist = length(vLightInf);

half fAttFactor = max(min(1.0, 1.0 - (fLightDist / 10.0)), 0.0);

half3 vNormLightDir = normalize(vLightInf);

half fDiffuse = max(0.0, dot(vNormal, vNormLightDir));

half4 clrAmb = (gl_LightSource[i].ambient * 0.15) + 0.35;
clrDiffuse += fAttFactor * ((fDiffuse * gl_LightSource[i].diffuse) + clrAmb);

half fSpecular = pow(max(0.0, dot(vEyeDir, reflect(-vNormLightDir, vNormal))), specular_power * 0.25);

if (fDiffuse < 0.0)
fSpecular = 0.0;

half fSpecFactor = fAttFactor * fSpecular * specular_bright;
half4 clrSpecValue = gl_LightSource[i].specular * fSpecFactor;

clrSpecular += min(half4(1.0), max(half4(0.0), clrSpecValue));
}
}
#endif

half4 clr;
clr.rgb = (clrBase.rgb * (clrDiffuse.rgb + gl_LightModel.ambient.rgb));
clr.rgb += clrDiffuseMask.a * clrSpecular.rgb;
clr.a = ov_color.w * clrTexture.a;

clr.rgb = mix(clr.rgb, vfog.rgb, vfog.a);

gl_FragColor = clr;
}

************************************
game: shader/slang/slang_emit.c:329: storage_to_src_reg: Assertion `st->Index >= 0' failed.
Saving backtrace to crash_backtrace_28938.log
Got SIGABRT (aborted)

Any help in regard to this ?
Comment 1 Brian Paul 2008-12-30 16:51:39 UTC
OK, I've committed some fixes to Mesa/master that should fix this.  Could you retest please?
Comment 2 Mateusz Kaduk 2008-12-31 01:43:33 UTC
Created attachment 21584 [details]
Regnum Online game log (not safe graphic mode)

Thanks the crash for Regnum Online is fixed. 

However if I rise terrain detail I get everything white on my screen. And game outputs this

Unsupported opcode 8 (BGNLOOP) in vertex shader
Unsupported opcode 11 (BRK) in vertex shader
Unsupported opcode 27 (ENDLOOP) in vertex shader

Also in log.txt which is attached I see a lot of errors that its trying to link with uncompiled shader.

This white screen also happens in another free but comercialy developed game Savage 2 - A Tortured Soul. It would be great to have this fixed or should I file another bug for that ?
Comment 3 Brian Paul 2008-12-31 07:48:35 UTC
There's two problems now.  1. It looks like loops in vertex shaders are not supported yet in the i965 driver.  2. Linking separate compilation units is not supported in Mesa yet.  We probably won't fix these things for a while.
Comment 4 Mateusz Kaduk 2009-01-21 06:51:03 UTC
(In reply to comment #3)
> There's two problems now.  1. It looks like loops in vertex shaders are not
> supported yet in the i965 driver.  2. Linking separate compilation units is not
> supported in Mesa yet.  We probably won't fix these things for a while.
> 

I am not sure if loops are supported now with 
OpenGL renderer string: Mesa DRI Intel(R) 965GM GEM 20090114
OpenGL version string: 2.1 Mesa 7.3-rc3

but still I find

separate compilation units not supported
and
for(i...)  body is too large/complex to unroll

Comment 5 Mateusz Kaduk 2009-04-16 02:44:19 UTC
Created attachment 24845 [details]
Shaders used by game

Now what I get is no texture on character in menu (invisible) and in game everything that needs texture except sky is black. Also game freezes when I want to quit it. Hard restart needed.

As it comes to textures what I see now in game log is

[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(655)] Shader <ps_pp_blurv> info log: 
Error: 2001: Syntax error.
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(698)] Shader <PostProcess.BlurV> info log: 
linking with uncompiled shader
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(1378)] Shader PostProcess.BlurV validation failed
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(1381)] Shader <postprocess_blurv> info log: 
linking with uncompiled shader
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(655)] Shader <ps_pp_blurh> info log: 
Error: 2001: Syntax error.
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(698)] Shader <PostProcess.BlurH> info log: 
linking with uncompiled shader
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(1378)] Shader PostProcess.BlurH validation failed
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(1381)] Shader <postprocess_blurh> info log: 
linking with uncompiled shader
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(655)] Shader <ps_pp_fsglow> info log: 
Error: 2001: Syntax error.
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(698)] Shader <PostProcess.FullSceneGlow> info log: 
linking with uncompiled shader
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(1378)] Shader PostProcess.FullSceneGlow validation failed
[16/04/2009 11:27:56] [ShaderGL][shader_gl.cpp(1381)] Shader <postprocess_fsglow> info log: 
linking with uncompiled shader
[16/04/2009 11:27:56] [Display Entity][display_entity.cpp(78)] Setting 1280 x 800 x 16 fullscreen video mode

What is needed is fixing standalone glslcompiler so it compiles after ./configure ; make
Comment 6 Mateusz Kaduk 2009-05-07 08:14:31 UTC
Created attachment 25595 [details]
Comparing two screens with GLSL enabled and disabled.

Latest Mesa from (git master 07.05.09) does not crash game, but as shown on attached screenshot problems are possibly with fragment shaders, because of bad shading and color of character.

Also game log shows
Error: 2001: Syntax error.
linking with uncompiled shader
Comment 7 Mateusz Kaduk 2009-05-19 20:26:24 UTC
Created attachment 26017 [details]
Screenshot with invisible textures.

Still the same error in log
[20/05/2009 05:18:55] [ShaderGL][shader_gl.cpp(655)] Shader <ps_pp_blurv> info log: 
Error: 2001: Syntax error.


but new behaviour on screen, no textures at all. Everything is invisible. New bug?
Comment 8 Mateusz Kaduk 2009-07-20 02:07:35 UTC
Game works with GLSL (safe mode disabled) with

OpenGL renderer string: Mesa DRI Intel(R) 965GM GEM 20090712 2009Q2 RC3 
OpenGL version string: 2.1 Mesa 7.5

I am marking it as resolved.
Comment 9 Adam Jackson 2009-08-24 12:31:29 UTC
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.