[Mesa-dev] [PATCH 3/6] mesa: don't use _NEW_TEXTURE mainly in mesa/main
Marek Olšák
maraeo at gmail.com
Thu Mar 23 23:42:03 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/drivers/dri/i965/brw_state_upload.c | 3 ++-
src/mesa/main/attrib.c | 2 +-
src/mesa/main/debug.c | 3 ++-
src/mesa/main/state.c | 10 +++++-----
src/mesa/main/texstate.c | 11 ++++++-----
5 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index f22567d..9c0b82c 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -578,23 +578,24 @@ static struct dirty_bit_map mesa_bits[] = {
DEFINE_BIT(_NEW_FOG),
DEFINE_BIT(_NEW_HINT),
DEFINE_BIT(_NEW_LIGHT),
DEFINE_BIT(_NEW_LINE),
DEFINE_BIT(_NEW_PIXEL),
DEFINE_BIT(_NEW_POINT),
DEFINE_BIT(_NEW_POLYGON),
DEFINE_BIT(_NEW_POLYGONSTIPPLE),
DEFINE_BIT(_NEW_SCISSOR),
DEFINE_BIT(_NEW_STENCIL),
- DEFINE_BIT(_NEW_TEXTURE),
+ DEFINE_BIT(_NEW_TEXTURE_OBJECT),
DEFINE_BIT(_NEW_TRANSFORM),
DEFINE_BIT(_NEW_VIEWPORT),
+ DEFINE_BIT(_NEW_TEXTURE_STATE),
DEFINE_BIT(_NEW_ARRAY),
DEFINE_BIT(_NEW_RENDERMODE),
DEFINE_BIT(_NEW_BUFFERS),
DEFINE_BIT(_NEW_CURRENT_ATTRIB),
DEFINE_BIT(_NEW_MULTISAMPLE),
DEFINE_BIT(_NEW_TRACK_MATRIX),
DEFINE_BIT(_NEW_PROGRAM),
DEFINE_BIT(_NEW_PROGRAM_CONSTANTS),
DEFINE_BIT(_NEW_BUFFER_OBJECT),
DEFINE_BIT(_NEW_FRAG_CLAMP),
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index ada2203..8e738c9 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1378,21 +1378,21 @@ _mesa_PopAttrib(void)
ctx->Transform.DepthClamp);
if (ctx->Extensions.ARB_clip_control)
_mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode);
}
break;
case GL_TEXTURE_BIT:
{
struct texture_state *texstate
= (struct texture_state *) attr->data;
pop_texture_group(ctx, texstate);
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE;
}
break;
case GL_VIEWPORT_BIT:
{
unsigned i;
const struct gl_viewport_attrib *vp;
vp = (const struct gl_viewport_attrib *) attr->data;
for (i = 0; i < ctx->Const.MaxViewports; i++) {
_mesa_set_viewport(ctx, i, vp[i].X, vp[i].Y, vp[i].Width,
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 3471b26..f909f83 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -84,23 +84,24 @@ _mesa_print_state( const char *msg, GLuint state )
(state & _NEW_FOG) ? "ctx->Fog, " : "",
(state & _NEW_HINT) ? "ctx->Hint, " : "",
(state & _NEW_LIGHT) ? "ctx->Light, " : "",
(state & _NEW_LINE) ? "ctx->Line, " : "",
(state & _NEW_PIXEL) ? "ctx->Pixel, " : "",
(state & _NEW_POINT) ? "ctx->Point, " : "",
(state & _NEW_POLYGON) ? "ctx->Polygon, " : "",
(state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "",
(state & _NEW_SCISSOR) ? "ctx->Scissor, " : "",
(state & _NEW_STENCIL) ? "ctx->Stencil, " : "",
- (state & _NEW_TEXTURE) ? "ctx->Texture, " : "",
+ (state & _NEW_TEXTURE_OBJECT) ? "ctx->Texture(Object), " : "",
(state & _NEW_TRANSFORM) ? "ctx->Transform, " : "",
(state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "",
+ (state & _NEW_TEXTURE_STATE) ? "ctx->Texture(State), " : "",
(state & _NEW_ARRAY) ? "ctx->Array, " : "",
(state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "",
(state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
}
/**
* Print information about this Mesa version and build options.
*/
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 71265a5..07629d8 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -377,46 +377,46 @@ _mesa_update_state_locked( struct gl_context *ctx )
* state matches one or more bits in 'computed_states'.
*/
if ((new_state & computed_states) == 0)
goto out;
if (MESA_VERBOSE & VERBOSE_STATE)
_mesa_print_state("_mesa_update_state", new_state);
/* Determine which state flags effect vertex/fragment program state */
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
- prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG |
+ prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE_OBJECT | _NEW_FOG |
_NEW_VARYING_VP_INPUTS | _NEW_LIGHT | _NEW_POINT |
_NEW_RENDERMODE | _NEW_PROGRAM | _NEW_FRAG_CLAMP |
- _NEW_COLOR);
+ _NEW_COLOR | _NEW_TEXTURE_STATE);
}
if (ctx->VertexProgram._MaintainTnlProgram) {
- prog_flags |= (_NEW_VARYING_VP_INPUTS | _NEW_TEXTURE |
+ prog_flags |= (_NEW_VARYING_VP_INPUTS | _NEW_TEXTURE_OBJECT |
_NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT |
- _NEW_FOG | _NEW_LIGHT |
+ _NEW_FOG | _NEW_LIGHT | _NEW_TEXTURE_STATE |
_MESA_NEW_NEED_EYE_COORDS);
}
/*
* Now update derived state info
*/
if (new_state & prog_flags)
update_program_enables( ctx );
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
_mesa_update_modelview_project( ctx, new_state );
if (new_state & _NEW_TEXTURE_MATRIX)
_mesa_update_texture_matrices(ctx);
- if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM))
+ if (new_state & (_NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE | _NEW_PROGRAM))
_mesa_update_texture_state(ctx);
if (new_state & _NEW_POLYGON)
update_frontbit( ctx );
if (new_state & _NEW_BUFFERS)
_mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
_mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 87c4d4a..ada0dfd 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -343,22 +343,22 @@ _mesa_ClientActiveTexture(GLenum texture)
/**********************************************************************/
/***** State management *****/
/**********************************************************************/
/**
* \note This routine refers to derived texture attribute values to
* compute the ENABLE_TEXMAT flags, but is only called on
- * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT
- * flags are updated by _mesa_update_textures(), below.
+ * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE_OBJECT/STATE,
+ * the ENABLE_TEXMAT flags are updated by _mesa_update_textures(), below.
*
* \param ctx GL context.
*/
void
_mesa_update_texture_matrices(struct gl_context *ctx)
{
GLuint u;
ctx->Texture._TexMatEnabled = 0x0;
@@ -679,22 +679,23 @@ update_ff_texture_state(struct gl_context *ctx,
ctx->Texture._EnabledCoordUnits |= 1 << unit;
update_tex_combine(ctx, texUnit);
}
}
/**
* \note This routine refers to derived texture matrix values to
* compute the ENABLE_TEXMAT flags, but is only called on
- * _NEW_TEXTURE. On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT
- * flags are updated by _mesa_update_texture_matrices, above.
+ * _NEW_TEXTURE_OBJECT/STATE. On changes to _NEW_TEXTURE_MATRIX,
+ * the ENABLE_TEXMAT flags are updated by _mesa_update_texture_matrices,
+ * above.
*
* \param ctx GL context.
*/
void
_mesa_update_texture_state(struct gl_context *ctx)
{
struct gl_program *prog[MESA_SHADER_STAGES];
int i;
int old_max_unit = ctx->Texture._MaxEnabledTexImageUnit;
BITSET_DECLARE(enabled_texture_units, MAX_COMBINED_TEXTURE_IMAGE_UNITS);
@@ -704,21 +705,21 @@ _mesa_update_texture_state(struct gl_context *ctx)
prog[i] = ctx->_Shader->CurrentProgram[i];
} else {
if (i == MESA_SHADER_FRAGMENT && ctx->FragmentProgram._Enabled)
prog[i] = ctx->FragmentProgram.Current;
else
prog[i] = NULL;
}
}
/* TODO: only set this if there are actual changes */
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE;
ctx->Texture._GenFlags = 0x0;
ctx->Texture._TexMatEnabled = 0x0;
ctx->Texture._TexGenEnabled = 0x0;
ctx->Texture._MaxEnabledTexImageUnit = -1;
ctx->Texture._EnabledCoordUnits = 0x0;
memset(&enabled_texture_units, 0, sizeof(enabled_texture_units));
/* First, walk over our programs pulling in all the textures for them.
--
2.7.4
More information about the mesa-dev
mailing list