From: Peteri Andras Date: Mon, 13 Jul 2009 14:03:16 +0000 (-0600) Subject: r128: fix two-sided lighting segfault seen in GLUT's olight demo X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=680f7d09b00fdec0dbe5e357639d6b445bb9266e;p=mesa.git r128: fix two-sided lighting segfault seen in GLUT's olight demo --- diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 451dcd1b553..4ae7bf5b97d 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -771,6 +771,11 @@ static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, FLUSH_BATCH( rmesa ); updateSpecularLighting(ctx); } + + if ( pname == GL_LIGHT_MODEL_TWO_SIDE ) { + FLUSH_BATCH( rmesa ); + r128ChooseRenderState( ctx ); + } } static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c index bcc9ffa651e..5b91271d740 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.c +++ b/src/mesa/drivers/dri/r128/r128_tris.c @@ -426,7 +426,7 @@ r128_fallback_point( r128ContextPtr rmesa, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) #define _R128_NEW_RENDER_STATE (ANY_FALLBACK_FLAGS | ANY_RASTER_FLAGS) -static void r128ChooseRenderState(GLcontext *ctx) +void r128ChooseRenderState(GLcontext *ctx) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; diff --git a/src/mesa/drivers/dri/r128/r128_tris.h b/src/mesa/drivers/dri/r128/r128_tris.h index d90ca31534e..c0667edb61f 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.h +++ b/src/mesa/drivers/dri/r128/r128_tris.h @@ -38,7 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/mtypes.h" extern void r128InitTriFuncs( GLcontext *ctx ); - +extern void r128ChooseRenderState( GLcontext *ctx ); extern void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) r128Fallback( rmesa->glCtx, bit, mode )