[Mesa-dev] [PATCH 09/29] mesa: Track enabled lights in a bitmask
From: Mathias Fröhlich This enables some optimizations afterwards. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/main/enable.c | 2 ++ src/mesa/main/light.c | 1 + src/mesa/main/mtypes.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 1d674bf..bc59280 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -402,10 +402,12 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) FLUSH_VERTICES(ctx, _NEW_LIGHT); 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; diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 4a8dee3..a52efdb 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1171,6 +1171,7 @@ _mesa_init_lighting( struct gl_context *ctx ) GLuint i; /* Lighting group */ + ctx->Light._EnabledLights = 0; for (i = 0; i < MAX_LIGHTS; i++) { init_light( &ctx->Light.Light[i], i ); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 16d6e57..a0b1a86 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -630,6 +630,8 @@ struct gl_light_attrib * Derived state for optimizations: */ /*@{*/ + GLbitfield _EnabledLights; /**< bitmask containing enabled lights */ + GLboolean _NeedEyeCoords; GLboolean _NeedVertices;/**< Use fast shader? */ struct gl_light EnabledList; /**< List sentinel */ -- 2.5.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/29] mesa: Track enabled lights in a bitmask
From: Mathias Fröhlich This enables some optimizations afterwards. Signed-off-by: Mathias Fröhlich --- src/mesa/main/enable.c | 2 ++ src/mesa/main/light.c | 1 + src/mesa/main/mtypes.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index d283077..ac7573b 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -402,10 +402,12 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) FLUSH_VERTICES(ctx, _NEW_LIGHT); 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; diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 4a8dee3..a52efdb 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1171,6 +1171,7 @@ _mesa_init_lighting( struct gl_context *ctx ) GLuint i; /* Lighting group */ + ctx->Light._EnabledLights = 0; for (i = 0; i < MAX_LIGHTS; i++) { init_light( &ctx->Light.Light[i], i ); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 877d377..ae9bf28 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -630,6 +630,8 @@ struct gl_light_attrib * Derived state for optimizations: */ /*@{*/ + GLbitfield _EnabledLights; /**< bitmask containing enabled lights */ + GLboolean _NeedEyeCoords; GLboolean _NeedVertices;/**< Use fast shader? */ struct gl_light EnabledList; /**< List sentinel */ -- 2.5.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev