[Mesa-dev] [Bug 43520] CoreBreach: Static lighting broken in Mesa 7.11

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Dec 6 12:05:39 PST 2011


https://bugs.freedesktop.org/show_bug.cgi?id=43520

--- Comment #1 from corecode <mayer.julian at googlemail.com> 2011-12-06 12:05:39 PST ---
hello, i'm the developer of the game in question.

i've had a look at this problem to see if there is an easy workaround - however
even simplifying the shader in question very much the problem persists and
indeed is quite weird.

the problem occurs in the shader "phong_shadow.frag" with the codepath
#define SHADOW 1
and without LIGHT being defined.

the shader is long, i've made a simple version that still exhibits a problem on
MESA:


uniform vec4    color;
uniform sampler2D texUnit;
varying vec2 texcoord;
varying vec3 position;
#ifdef SHADOW
uniform sampler2DShadow shadowMap[1];
varying vec4 shadowTexCoord[1];

float lookup(vec2 xy)
{
    return shadow2DProj(shadowMap[0], shadowTexCoord[0]).x ;
}
#endif
void main (void)
{
    vec4 tmp     = texture2D(texUnit, texcoord);
#ifdef SHADOW
    float s = lookup(vec2(0.0,0.0));
    gl_FragColor = vec4(tmp.r,  tmp.g,   tmp.b, s); 
    gl_FragColor.a = 1.0; // gl_FragColor should be (tmp.rgb, 1.0), but its
BLACK. when changing s to 1.0, the problem is gone.
#else
    gl_FragColor = tmp;
#endif

}


this doesn't render the same thing as the normal shader, but still exhibits the
basic problem.
in the SHADOW case we should be writing out the same thing to the color as in
the other case, just the contents of the texture lookup. however, just the fact
that the shadow texture lookup is performed and used (written to glFragColor.a,
but overwritten just one line later) makes everything go nuts and the result is
just BLACK for the parts of the geometry where SHADOW is defined.

the weird thing is that although the more complicated "dynamic" lighting shader
(also phong_shadow.frag in the game, but with LIGHT defined to 1) also performs
the shadow lookup, it isn't completely broken - and thats although the shader
is a more complicated superset of the static lighting shader ... just weird.

there are 3 other problems with the game on MESA/ATI:
• with the normal (dynamic lighting) shader, the shadows don't show up, so
there seems to be a general problem with shadow-maps that either manifests
itself as the shadows just not showing up (dynamic light) or making everything
black (static light)
• i can't seem to be able to create a context with FSAA enabled, the game
automatically falls down to no-FSAA
• the "videowalls" are grey instead of containing a colorful animation.
something in mesa seems to break the shader "plasma.frag"

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the mesa-dev mailing list