[Mesa-dev] [PATCH 18/31] mesa: Remove the linked list of enabled lights

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Tue Jun 7 05:30:33 UTC 2016


From: Mathias Fröhlich <mathias.froehlich at web.de>

Clean up after conversion to bitmasks.

Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
---
 src/mesa/main/context.c | 11 +----------
 src/mesa/main/enable.c  |  4 ----
 src/mesa/main/light.c   |  4 ----
 src/mesa/main/mtypes.h  |  4 ----
 4 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 172c854..a99a54e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -120,7 +120,6 @@
 #include "shared.h"
 #include "shaderobj.h"
 #include "shaderimage.h"
-#include "util/simple_list.h"
 #include "util/strtod.h"
 #include "state.h"
 #include "stencil.h"
@@ -1453,16 +1452,8 @@ _mesa_copy_context( const struct gl_context *src, struct gl_context *dst,
       dst->Hint = src->Hint;
    }
    if (mask & GL_LIGHTING_BIT) {
-      GLuint i;
-      /* begin with memcpy */
+      /* OK to memcpy */
       dst->Light = src->Light;
-      /* fixup linked lists to prevent pointer insanity */
-      make_empty_list( &(dst->Light.EnabledList) );
-      for (i = 0; i < MAX_LIGHTS; i++) {
-         if (dst->Light.Light[i].Enabled) {
-            insert_at_tail(&(dst->Light.EnabledList), &(dst->Light.Light[i]));
-         }
-      }
    }
    if (mask & GL_LINE_BIT) {
       /* OK to memcpy */
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index bc59280..1468a45 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -35,7 +35,6 @@
 #include "enable.h"
 #include "errors.h"
 #include "light.h"
-#include "util/simple_list.h"
 #include "mtypes.h"
 #include "enums.h"
 #include "api_arrayelt.h"
@@ -403,12 +402,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
          if (state) {
             ctx->Light._EnabledLights |= 1u << (cap - GL_LIGHT0);
-            insert_at_tail(&ctx->Light.EnabledList,
-                           &ctx->Light.Light[cap-GL_LIGHT0]);
          }
          else {
             ctx->Light._EnabledLights &= ~(1u << (cap - GL_LIGHT0));
-            remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
          }
          break;
       case GL_LIGHTING:
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 49e99ce..ae723e8 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -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"
 
@@ -1121,8 +1120,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 );
@@ -1196,7 +1193,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 );
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f0128cd..dcc471a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -333,9 +333,6 @@ struct gl_material
  */
 struct gl_light
 {
-   struct gl_light *next;	/**< double linked list with sentinel */
-   struct gl_light *prev;
-
    GLfloat Ambient[4];		/**< ambient color */
    GLfloat Diffuse[4];		/**< diffuse color */
    GLfloat Specular[4];		/**< specular color */
@@ -634,7 +631,6 @@ struct gl_light_attrib
 
    GLboolean _NeedEyeCoords;		
    GLboolean _NeedVertices;		/**< Use fast shader? */
-   struct gl_light EnabledList;         /**< List sentinel */
 
    GLfloat _BaseColor[2][3];
    /*@}*/
-- 
2.5.5



More information about the mesa-dev mailing list