From ff9c3e8e5a22597c83505479e918981377f8fdf4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 23 Apr 2014 17:14:26 -0700 Subject: mesa: Replace use of _ReallyEnabled as a boolean with use of _Current. I'm probably not the only person that has tried to kill _ReallyEnabled. This does the mechanical part of the work, and cleans _ReallyEnabled from i965. I think that using _Current makes texture management clearer: You can't have multiple targets in use in the same texture image unit at the same time, because there's just that one pointer. Reviewed-by: Matt Turner Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/radeon/radeon_state.c | 4 ++-- src/mesa/drivers/dri/radeon/radeon_state_init.c | 6 +++--- src/mesa/drivers/dri/radeon/radeon_tcl.c | 2 +- src/mesa/drivers/dri/radeon/radeon_texstate.c | 13 ++++--------- 4 files changed, 10 insertions(+), 15 deletions(-) (limited to 'src/mesa/drivers/dri/radeon') diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 4a19db4..414946b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -1935,7 +1935,7 @@ static void update_texturematrix( struct gl_context *ctx ) rmesa->TexMatColSwap = 0; for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { + if (ctx->Texture.Unit[unit]._Current) { GLboolean needMatrix = GL_FALSE; if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) { needMatrix = GL_TRUE; @@ -2016,7 +2016,7 @@ static GLboolean r100ValidateBuffers(struct gl_context *ctx) for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; ++i) { radeonTexObj *t; - if (!ctx->Texture.Unit[i]._ReallyEnabled) + if (!ctx->Texture.Unit[i]._Current) continue; t = rmesa->state.texture.unit[i].texobj; diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index f44dff0..c14407f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -211,9 +211,9 @@ CHECK( cube1_mm, (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_CUBE_BIT), 2 + 4 CHECK( cube2_mm, (ctx->Texture.Unit[2]._ReallyEnabled & TEXTURE_CUBE_BIT), 2 + 4*5 - CUBE_STATE_SIZE ) CHECK( fog_add4, ctx->Fog.Enabled, 4 ) TCL_CHECK( tcl_add4, GL_TRUE, 4 ) -TCL_CHECK( tcl_tex0_add4, ctx->Texture.Unit[0]._ReallyEnabled, 4 ) -TCL_CHECK( tcl_tex1_add4, ctx->Texture.Unit[1]._ReallyEnabled, 4 ) -TCL_CHECK( tcl_tex2_add4, ctx->Texture.Unit[2]._ReallyEnabled, 4 ) +TCL_CHECK( tcl_tex0_add4, ctx->Texture.Unit[0]._Current, 4 ) +TCL_CHECK( tcl_tex1_add4, ctx->Texture.Unit[1]._Current, 4 ) +TCL_CHECK( tcl_tex2_add4, ctx->Texture.Unit[2]._Current, 4 ) TCL_CHECK( tcl_lighting, ctx->Light.Enabled, 0 ) TCL_CHECK( tcl_lighting_add4, ctx->Light.Enabled, 4 ) TCL_CHECK( tcl_eyespace_or_lighting_add4, ctx->_NeedEyeCoords || ctx->Light.Enabled, 4 ) diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c index 21d54fb..271d5f9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c @@ -386,7 +386,7 @@ static GLboolean radeon_run_tcl_render( struct gl_context *ctx, } for (i = 0 ; i < ctx->Const.MaxTextureUnits; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled) { + if (ctx->Texture.Unit[i]._Current) { /* TODO: probably should not emit texture coords when texgen is enabled */ if (rmesa->TexGenNeedNormals[i]) { inputs |= VERT_BIT_NORMAL; diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index dac8aed..4600d34 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -257,12 +257,6 @@ static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit ) | RADEON_SCALE_1X | RADEON_CLAMP_TX; - /* texUnit->_Current can be NULL if and only if the texture unit is - * not actually enabled. - */ - assert( (texUnit->_ReallyEnabled == 0) - || (texUnit->_Current != NULL) ); - if ( RADEON_DEBUG & RADEON_TEXTURE ) { fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, (void *)ctx, unit ); } @@ -279,7 +273,7 @@ static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit ) rmesa->state.texture.unit[unit].format = 0; rmesa->state.texture.unit[unit].envMode = 0; - if ( !texUnit->_ReallyEnabled ) { + if ( !texUnit->_Current ) { color_combine = color_combine0; alpha_combine = alpha_combine0; } @@ -1082,13 +1076,14 @@ static GLboolean radeonUpdateTextureUnit( struct gl_context *ctx, int unit ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - if (ctx->Texture.Unit[unit]._ReallyEnabled & TEXTURE_3D_BIT) { + if (ctx->Texture.Unit[unit]._Current && + ctx->Texture.Unit[unit]._Current->Target == GL_TEXTURE_3D) { disable_tex_obj_state(rmesa, unit); rmesa->state.texture.unit[unit].texobj = NULL; return GL_FALSE; } - if (!ctx->Texture.Unit[unit]._ReallyEnabled) { + if (!ctx->Texture.Unit[unit]._Current) { /* disable the unit */ disable_tex_obj_state(rmesa, unit); rmesa->state.texture.unit[unit].texobj = NULL; -- cgit v1.1