OSDN Git Service

make sure vertex programs are only enabled on the hw when they are really enabled...
authorRoland Scheidegger <rscheidegger@gmx.ch>
Fri, 1 Sep 2006 20:21:12 +0000 (20:21 +0000)
committerRoland Scheidegger <rscheidegger@gmx.ch>
Fri, 1 Sep 2006 20:21:12 +0000 (20:21 +0000)
src/mesa/drivers/dri/r200/r200_state.c
src/mesa/drivers/dri/r200/r200_vertprog.c

index d266e78..452d354 100644 (file)
@@ -2103,6 +2103,7 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state )
    case GL_VERTEX_PROGRAM_ARB:
       if (!state) {
         GLuint i;
+        rmesa->curr_vp_hw = NULL;
         R200_STATECHANGE( rmesa, vap );
         rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~R200_VAP_PROG_VTX_SHADER_ENABLE;
         /* mark all tcl atoms (tcl vector state got overwritten) dirty
@@ -2133,8 +2134,11 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state )
         /* FIXME: ugly as hell. need to call everything which might change tcl_output_vtxfmt0/1 and compsel */
         r200UpdateSpecular( ctx );
         r200Fogfv( ctx, GL_FOG_COORD_SRC, NULL );
+#if 1
        /* shouldn't be necessary, as it's picked up anyway in r200ValidateState (_NEW_PROGRAM),
           but without it doom3 locks up at always the same places. Why? */
+       /* FIXME: This can (and should) be replaced by a call to the TCL_STATE_FLUSH reg before
+          accessing VAP_SE_VAP_CNTL. Requires drm changes (done). Remove after some time... */
         r200UpdateTextureState( ctx );
         /* if we call r200UpdateTextureState we need the code below because we are calling it with
            non-current derived enabled values which may revert the state atoms for frag progs even when
@@ -2154,17 +2158,10 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state )
         R200_STATECHANGE( rmesa, cst );
         R200_STATECHANGE( rmesa, tf );
         rmesa->hw.cst.cmd[CST_PP_CNTL_X] = 0;
+#endif
       }
       else {
-        R200_STATECHANGE( rmesa, vap );
-        if (!rmesa->TclFallback) {
-        /* FIXME: fglrx sets R200_VAP_SINGLE_BUF_STATE_ENABLE too. Do we need it? */
-           rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_PROG_VTX_SHADER_ENABLE /*| R200_VAP_SINGLE_BUF_STATE_ENABLE*/;
-        }
-        R200_STATECHANGE( rmesa, vpi[0] );
-        R200_STATECHANGE( rmesa, vpi[1] );
-        R200_STATECHANGE( rmesa, vpp[0] );
-        R200_STATECHANGE( rmesa, vpp[1] );
+        /* picked up later */
       }
       break;
 
index 339d360..ab9a64c 100644 (file)
@@ -991,6 +991,11 @@ void r200SetupVertexProg( GLcontext *ctx ) {
    TCL_FALLBACK(ctx, R200_TCL_FALLBACK_VERTEX_PROGRAM, fallback);
    if (fallback) return;
 
+   R200_STATECHANGE( rmesa, vap );
+   /* FIXME: fglrx sets R200_VAP_SINGLE_BUF_STATE_ENABLE too. Do we need it?
+             maybe only when using more than 64 inst / 96 param? */
+   rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_PROG_VTX_SHADER_ENABLE /*| R200_VAP_SINGLE_BUF_STATE_ENABLE*/;
+
    R200_STATECHANGE( rmesa, pvs );
 
    rmesa->hw.pvs.cmd[PVS_CNTL_1] = (0 << R200_PVS_CNTL_1_PROGRAM_START_SHIFT) |