diff options
author | Roland Scheidegger <rscheidegger@gmx.ch> | 2005-09-12 21:20:10 +0000 |
---|---|---|
committer | Roland Scheidegger <rscheidegger@gmx.ch> | 2005-09-12 21:20:10 +0000 |
commit | f20917de5bd2b1fc152e74304d3649a1f6042422 (patch) | |
tree | 9a5390f0f8cda2d046edd0387ab1c502981f159c /src/mesa/drivers/dri/r200/r200_state.c | |
parent | 11543624edbee91f1257a614f0778999bc170345 (diff) |
add complete support for ATI_fragment_shader for the r200. Most of the new code is in the new file r200_fragshader.c. Reverse engeneered by Dave Airlie and me
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_state.c')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 43126b3378..968783607d 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2087,6 +2087,34 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_VERTEX_PROGRAM, state); break; + case GL_FRAGMENT_SHADER_ATI: + if ( !state ) { + /* restore normal tex env colors and make sure tex env combine will get updated + mark env atoms dirty (as their data was overwritten by afs even + if they didn't change) and restore tex coord routing */ + GLuint unit; + for (unit = 0; unit < R200_MAX_TEXTURE_UNITS; unit++) { + rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT] &= + ~(R200_TXFORMAT_ST_ROUTE_MASK | R200_TXFORMAT_LOOKUP_DISABLE); + rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT] |= unit << R200_TXFORMAT_ST_ROUTE_SHIFT; + /* need to guard this with drmSupportsFragmentShader? Should never get here if + we don't announce ATI_fs, right? */ + rmesa->hw.tex[unit].cmd[TEX_PP_TXMULTI_CTL] = 0; + R200_STATECHANGE( rmesa, pix[unit] ); + R200_STATECHANGE( rmesa, tex[unit] ); + } + rmesa->hw.cst.cmd[CST_PP_CNTL_X] = 0; + R200_STATECHANGE( rmesa, cst ); + R200_STATECHANGE( rmesa, tf ); + } + else { + /* need to mark this dirty as pix/tf atoms have overwritten the data + even if the data in the atoms didn't change */ + R200_STATECHANGE( rmesa, atf ); + R200_STATECHANGE( rmesa, afs[1] ); + /* everything else picked up in r200UpdateTextureState hopefully */ + } + break; default: return; } @@ -2260,7 +2288,7 @@ void r200ValidateState( GLcontext *ctx ) r200UpdateDrawBuffer(ctx); } - if (new_state & _NEW_TEXTURE) { + if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM)) { r200UpdateTextureState( ctx ); new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */ } @@ -2282,7 +2310,7 @@ void r200ValidateState( GLcontext *ctx ) */ if (new_state & (_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) { update_texturematrix( ctx ); - } + } if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW|_MESA_NEW_NEED_EYE_COORDS)) { update_light( ctx ); |