From 91650469aeb01f249bcd553d9d309b3016c2f93c Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 1 Sep 2006 20:21:12 +0000 Subject: make sure vertex programs are only enabled on the hw when they are really enabled, not just when a program enables vertex progs (could still be not enabled due to some error). Otherwise the hw potentially would try to execute a not valid (not set up at all) vertex program, likely leading to lockups. Hopefully fixes #8060. --- src/mesa/drivers/dri/r200/r200_state.c | 15 ++++++--------- src/mesa/drivers/dri/r200/r200_vertprog.c | 5 +++++ 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/mesa/drivers/dri/r200') diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index d266e78910e..452d354f6e9 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -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; diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 339d3603a48..ab9a64ca0b0 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -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) | -- cgit v1.2.3