Here is the patch. :)

On Fri, 26 Dec 2003 19:44:50 +0100
Felix Kühling <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I fixed two TCL bugs on radeon that appeared after the move to
> Mesa-newtree. A patch is attached.
> 
> The light_model_cntl thing looks almost like a copy-paste from R200.
> This fixes missing colors and textures in various applications (pulsar,
> queens, endgame, tuxkart, torcs, ...).
> 
> _mesa_allow_light_in_model seems to do the exact opposite of what it
> says. With this patch the lighting is correct again in flightgear. I'm
> not convinced though, that this is correct as I don't really understand
> all the details here. Keith?
> 
> Regards,
>   Felix

------------    __\|/__    ___     ___       -------------------------
 Felix       ___\_e -_/___/ __\___/ __\_____   You can do anything,
   Kühling  (_____\Ä/____/ /_____/ /________)  just not everything
 [EMAIL PROTECTED]       \___/   \___/   U        at the same time.
Index: radeon_state.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/radeon/radeon_state.c,v
retrieving revision 1.5
diff -u -r1.5 radeon_state.c
--- radeon_state.c      9 Dec 2003 14:17:40 -0000       1.5
+++ radeon_state.c      26 Dec 2003 18:39:42 -0000
@@ -868,28 +868,28 @@
 
       /* Default to PREMULT:
        */
-      light_model_ctl1 &= ~((0xf << RADEON_EMISSIVE_SOURCE_SHIFT) |
-                          (0xf << RADEON_AMBIENT_SOURCE_SHIFT) |
-                          (0xf << RADEON_DIFFUSE_SOURCE_SHIFT) |
-                          (0xf << RADEON_SPECULAR_SOURCE_SHIFT)); 
+      light_model_ctl1 &= ~((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
+                          (3 << RADEON_AMBIENT_SOURCE_SHIFT) |
+                          (3 << RADEON_DIFFUSE_SOURCE_SHIFT) |
+                          (3 << RADEON_SPECULAR_SOURCE_SHIFT)); 
    
       if (mask & MAT_BIT_FRONT_EMISSION) {
-        light_model_ctl1 |= (3 <<
+        light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
                             RADEON_EMISSIVE_SOURCE_SHIFT);
       }
 
       if (mask & MAT_BIT_FRONT_AMBIENT) {
-        light_model_ctl1 |= (3 <<
+        light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
                             RADEON_AMBIENT_SOURCE_SHIFT);
       }
         
       if (mask & MAT_BIT_FRONT_DIFFUSE) {
-        light_model_ctl1 |= (3 <<
+        light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
                             RADEON_DIFFUSE_SOURCE_SHIFT);
       }
    
       if (mask & MAT_BIT_FRONT_SPECULAR) {
-        light_model_ctl1 |= (3 <<
+        light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
                             RADEON_SPECULAR_SOURCE_SHIFT);
       }
    
@@ -1755,7 +1755,7 @@
       radeonUpdateSpecular( ctx ); /* for PK_SPEC */
       if (rmesa->TclFallback) 
         radeonChooseVertexState( ctx );
-      _mesa_allow_light_in_model( ctx, !state );
+      _mesa_allow_light_in_model( ctx, state );
       break;
 
    case GL_LIGHT0:

Reply via email to