diff options
author | Marek Olšák <[email protected]> | 2017-06-09 23:27:41 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-06-22 01:51:02 +0200 |
commit | 68a0e15f44cf351eab97a734b1cffeade1873fdf (patch) | |
tree | 99162f29dc09f7f0c11e89d5508d9f7c337f6892 /src/mesa/drivers/dri/r200 | |
parent | 585c5cf8a514783d9ed31dba3aa432797dd5f0e8 (diff) |
mesa: replace VP/FP/ATIfs _Enabled flags with helper functions
These are only used in the GL compatibility profile.
Reviewed-by: Nicolai Hähnle <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/r200')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_maos_arrays.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state_init.c | 15 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_tcl.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_texstate.c | 7 |
5 files changed, 20 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 9b16cf84cf5..60f851be56c 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -36,6 +36,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/mtypes.h" #include "main/imports.h" #include "main/macros.h" +#include "main/state.h" #include "swrast_setup/swrast_setup.h" #include "math/m_translate.h" @@ -114,7 +115,7 @@ void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev ) /* special handling to fix up fog. Will get us into trouble with vbos...*/ assert(attrib == VERT_ATTRIB_FOG); if (!rmesa->radeon.tcl.aos[i].bo) { - if (ctx->VertexProgram._Enabled) + if (_mesa_arb_vertex_program_enabled(ctx)) rcommon_emit_vector( ctx, &(rmesa->radeon.tcl.aos[nr]), (char *)VB->AttribPtr[attrib]->data, diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index b157572832c..2705d224b95 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/light.h" #include "main/framebuffer.h" #include "main/fbobject.h" +#include "main/state.h" #include "main/stencil.h" #include "main/viewport.h" @@ -2265,7 +2266,7 @@ GLboolean r200ValidateState( struct gl_context *ctx ) _NEW_MODELVIEW|_NEW_PROJECTION|_NEW_TRANSFORM| _NEW_LIGHT|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX| _NEW_FOG|_NEW_POINT|_NEW_TRACK_MATRIX)) { - if (ctx->VertexProgram._Enabled) { + if (_mesa_arb_vertex_program_enabled(ctx)) { r200SetupVertexProg( ctx ); } else TCL_FALLBACK(ctx, R200_TCL_FALLBACK_VERTEX_PROGRAM, 0); @@ -2328,7 +2329,8 @@ static void r200WrapRunPipeline( struct gl_context *ctx ) if (!r200ValidateState( ctx )) FALLBACK(rmesa, RADEON_FALLBACK_TEXTURE, GL_TRUE); - has_material = !ctx->VertexProgram._Enabled && ctx->Light.Enabled && check_material( ctx ); + has_material = !_mesa_arb_vertex_program_enabled(ctx) && + ctx->Light.Enabled && check_material( ctx ); if (has_material) { TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE ); diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 8e14ba73ff9..4f584d3677b 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -35,6 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/enums.h" #include "main/api_arrayelt.h" +#include "main/state.h" #include "swrast/swrast.h" #include "vbo/vbo.h" @@ -229,7 +230,7 @@ static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \ static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ - return (!rmesa->radeon.TclFallback && !ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ + return (!rmesa->radeon.TclFallback && !_mesa_arb_vertex_program_enabled(ctx) && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ } #define TCL_OR_VP_CHECK( NM, FLAG, ADD ) \ @@ -244,18 +245,18 @@ static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ (void) atom; \ - return (!rmesa->radeon.TclFallback && ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ + return (!rmesa->radeon.TclFallback && _mesa_arb_vertex_program_enabled(ctx) && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ } CHECK( always, GL_TRUE, 0 ) CHECK( always_add4, GL_TRUE, 4 ) CHECK( never, GL_FALSE, 0 ) CHECK( tex_any, ctx->Texture._MaxEnabledTexImageUnit != -1, 0 ) -CHECK( tf, (ctx->Texture._MaxEnabledTexImageUnit != -1 && !ctx->ATIFragmentShader._Enabled), 0 ); -CHECK( pix_zero, !ctx->ATIFragmentShader._Enabled, 0 ) -CHECK( texenv, (rmesa->state.envneeded & (1 << (atom->idx)) && !ctx->ATIFragmentShader._Enabled), 0 ) -CHECK( afs_pass1, (ctx->ATIFragmentShader._Enabled && (ctx->ATIFragmentShader.Current->NumPasses > 1)), 0 ) -CHECK( afs, ctx->ATIFragmentShader._Enabled, 0 ) +CHECK( tf, (ctx->Texture._MaxEnabledTexImageUnit != -1 && !_mesa_ati_fragment_shader_enabled(ctx)), 0 ); +CHECK( pix_zero, !_mesa_ati_fragment_shader_enabled(ctx), 0 ) +CHECK( texenv, (rmesa->state.envneeded & (1 << (atom->idx)) && !_mesa_ati_fragment_shader_enabled(ctx)), 0 ) +CHECK( afs_pass1, (_mesa_ati_fragment_shader_enabled(ctx) && (ctx->ATIFragmentShader.Current->NumPasses > 1)), 0 ) +CHECK( afs, _mesa_ati_fragment_shader_enabled(ctx), 0 ) CHECK( tex_cube, rmesa->state.texture.unit[atom->idx].unitneeded & TEXTURE_CUBE_BIT, 3 + 3*5 - CUBE_STATE_SIZE ) CHECK( tex_cube_cs, rmesa->state.texture.unit[atom->idx].unitneeded & TEXTURE_CUBE_BIT, 2 + 4*5 - CUBE_STATE_SIZE ) TCL_CHECK( tcl_fog_add4, ctx->Fog.Enabled, 4 ) diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 26968afc644..662c041c79f 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -383,7 +383,7 @@ static GLboolean r200_run_tcl_render( struct gl_context *ctx, if (!r200ValidateState( ctx )) return GL_TRUE; /* fallback to sw t&l */ - if (!ctx->VertexProgram._Enabled) { + if (!_mesa_arb_vertex_program_enabled(ctx)) { /* NOTE: inputs != tnl->render_inputs - these are the untransformed * inputs. */ @@ -553,7 +553,7 @@ static void transition_to_hwtnl( struct gl_context *ctx ) rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_TCL_ENABLE; rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~R200_VAP_FORCE_W_TO_ONE; - if (ctx->VertexProgram._Enabled) { + if (_mesa_arb_vertex_program_enabled(ctx)) { rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_PROG_VTX_SHADER_ENABLE; } diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 441ac730d4c..dcf211f521e 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -36,6 +36,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/context.h" #include "main/macros.h" +#include "main/state.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/enums.h" @@ -1480,7 +1481,7 @@ void r200UpdateTextureState( struct gl_context *ctx ) atoms. */ R200_NEWPRIM( rmesa ); - if (ctx->ATIFragmentShader._Enabled) { + if (_mesa_ati_fragment_shader_enabled(ctx)) { GLuint i; for (i = 0; i < R200_MAX_TEXTURE_UNITS; i++) { if (ctx->Texture.Unit[i]._Current) @@ -1502,7 +1503,7 @@ void r200UpdateTextureState( struct gl_context *ctx ) r200UpdateTextureUnit( ctx, 5 )); } - if (ok && ctx->ATIFragmentShader._Enabled) { + if (ok && _mesa_ati_fragment_shader_enabled(ctx)) { r200UpdateFragmentShader(ctx); } @@ -1528,7 +1529,7 @@ void r200UpdateTextureState( struct gl_context *ctx ) rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK; rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] |= R200_TXFORMAT_LOOKUP_DISABLE; } - else if (!ctx->ATIFragmentShader._Enabled) { + else if (!_mesa_ati_fragment_shader_enabled(ctx)) { if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_1_ENABLE) && (rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] & R200_TXFORMAT_LOOKUP_DISABLE)) { R200_STATECHANGE(rmesa, tex[1]); |