mesa: always return GL_OUT_OF_MEMORY or GL_NO_ERROR when KHR_no_error enabled
[mesa.git] / src / mesa / main / light.c
index c9e2fc2f12bfba1d80b7b7f65440ef654d0a891d..87a06db309d0f5227cc274a9ee0db50b5f960127 100644 (file)
@@ -31,7 +31,6 @@
 #include "enums.h"
 #include "light.h"
 #include "macros.h"
-#include "util/simple_list.h"
 #include "mtypes.h"
 #include "math/m_matrix.h"
 #include "util/bitscan.h"
@@ -707,13 +706,14 @@ _mesa_update_material( struct gl_context *ctx, GLuint bitmask )
 void
 _mesa_update_color_material( struct gl_context *ctx, const GLfloat color[4] )
 {
-   const GLbitfield bitmask = ctx->Light._ColorMaterialBitmask;
+   GLbitfield bitmask = ctx->Light._ColorMaterialBitmask;
    struct gl_material *mat = &ctx->Light.Material;
-   int i;
 
-   for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) 
-      if (bitmask & (1<<i))
-        COPY_4FV( mat->Attrib[i], color );
+   while (bitmask) {
+      const int i = u_bit_scan(&bitmask);
+
+      COPY_4FV( mat->Attrib[i], color );
+   }
 
    _mesa_update_material( ctx, bitmask );
 }
@@ -1122,8 +1122,6 @@ _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag )
 static void
 init_light( struct gl_light *l, GLuint n )
 {
-   make_empty_list( l );
-
    ASSIGN_4V( l->Ambient, 0.0, 0.0, 0.0, 1.0 );
    if (n==0) {
       ASSIGN_4V( l->Diffuse, 1.0, 1.0, 1.0, 1.0 );
@@ -1197,7 +1195,6 @@ _mesa_init_lighting( struct gl_context *ctx )
    for (i = 0; i < MAX_LIGHTS; i++) {
       init_light( &ctx->Light.Light[i], i );
    }
-   make_empty_list( &ctx->Light.EnabledList );
 
    init_lightmodel( &ctx->Light.Model );
    init_material( &ctx->Light.Material );