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

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Tue May 24 06:42:12 UTC 2016


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

Clean up after conversion to bitmasks.

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 f690799..9a5238b 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"
@@ -1451,16 +1450,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 ac7573b..b04baed 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 b28ea7e..4773ed6 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"
 
@@ -1131,8 +1130,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 );
@@ -1206,7 +1203,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 ae9bf28..c40c528 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