diff options
author | Roland Scheidegger <[email protected]> | 2005-10-05 22:40:09 +0000 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2005-10-05 22:40:09 +0000 |
commit | 9dd973ec3b2b53f4b95d2ba0a746a0e52533becf (patch) | |
tree | 8ff6f83960c9d717dad44c2f8b10ef00ee86de75 /src/mesa/drivers/dri/r200 | |
parent | 24a44d74b6e9880dfc019bd1cfa9ce0351377c85 (diff) |
fix problems with some texgen modes by putting the chip into LOCAL_VIEWER mode for lighting (potentially causes slight misrenderings with the specular components of lights if the light model is not set for local viewer).
Diffstat (limited to 'src/mesa/drivers/dri/r200')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index e80cae872e3..788afb4c24f 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -1322,8 +1322,25 @@ static void r200Lightfv( GLcontext *ctx, GLenum light, } } - - +static void r200UpdateLocalViewer ( GLcontext *ctx ) +{ +/* It looks like for the texgen modes GL_SPHERE_MAP, GL_NORMAL_MAP and + GL_REFLECTION_MAP we need R200_LOCAL_VIEWER set (fglrx does exactly that + for these and only these modes). This means specular highlights may turn out + wrong in some cases when lighting is enabled but GL_LIGHT_MODEL_LOCAL_VIEWER + is not set, though it seems to happen rarely and the effect seems quite + subtle. May need TCL fallback to fix it completely, though I'm not sure + how you'd identify the cases where the specular highlights indeed will + be wrong. Don't know if fglrx does something special in that case. +*/ + r200ContextPtr rmesa = R200_CONTEXT(ctx); + R200_STATECHANGE( rmesa, tcl ); + if (ctx->Light.Model.LocalViewer || + ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) + rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LOCAL_VIEWER; + else + rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LOCAL_VIEWER; +} static void r200LightModelfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) @@ -1336,11 +1353,7 @@ static void r200LightModelfv( GLcontext *ctx, GLenum pname, break; case GL_LIGHT_MODEL_LOCAL_VIEWER: - R200_STATECHANGE( rmesa, tcl ); - if (ctx->Light.Model.LocalViewer) - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LOCAL_VIEWER; - else - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LOCAL_VIEWER; + r200UpdateLocalViewer( ctx ); break; case GL_LIGHT_MODEL_TWO_SIDE: @@ -2295,6 +2308,7 @@ void r200ValidateState( GLcontext *ctx ) if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM)) { r200UpdateTextureState( ctx ); new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */ + r200UpdateLocalViewer( ctx ); } /* Need an event driven matrix update? |