From: Eric Anholt Date: Tue, 8 Jan 2013 19:09:49 +0000 (-0800) Subject: mesa: Skip updating texgen when not doing fixed function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1ec1b577f726a70dd787227260e61928e97474e5;p=mesa.git mesa: Skip updating texgen when not doing fixed function. Between the previous commit and this one, improves GLBenchmark 2.1 offscreen performance by 0.48% +/- 0.24% (n=22, throttling outliers removed). Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick --- diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index a2541fc9f1c..87b26aed59b 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -480,6 +480,43 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit) } } +static void +update_texgen(struct gl_context *ctx) +{ + GLuint unit; + + /* Setup texgen for those texture coordinate sets that are in use */ + for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + + texUnit->_GenFlags = 0x0; + + if (!(ctx->Texture._EnabledCoordUnits & (1 << unit))) + continue; + + if (texUnit->TexGenEnabled) { + if (texUnit->TexGenEnabled & S_BIT) { + texUnit->_GenFlags |= texUnit->GenS._ModeBit; + } + if (texUnit->TexGenEnabled & T_BIT) { + texUnit->_GenFlags |= texUnit->GenT._ModeBit; + } + if (texUnit->TexGenEnabled & R_BIT) { + texUnit->_GenFlags |= texUnit->GenR._ModeBit; + } + if (texUnit->TexGenEnabled & Q_BIT) { + texUnit->_GenFlags |= texUnit->GenQ._ModeBit; + } + + ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); + ctx->Texture._GenFlags |= texUnit->_GenFlags; + } + + ASSERT(unit < Elements(ctx->TextureMatrixStack)); + if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) + ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); + } +} /** * \note This routine refers to derived texture matrix values to @@ -633,37 +670,8 @@ update_texture_state( struct gl_context *ctx ) ctx->Texture._EnabledCoordUnits = enabledFragUnits; } - /* Setup texgen for those texture coordinate sets that are in use */ - for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - - texUnit->_GenFlags = 0x0; - - if (!(ctx->Texture._EnabledCoordUnits & (1 << unit))) - continue; - - if (texUnit->TexGenEnabled) { - if (texUnit->TexGenEnabled & S_BIT) { - texUnit->_GenFlags |= texUnit->GenS._ModeBit; - } - if (texUnit->TexGenEnabled & T_BIT) { - texUnit->_GenFlags |= texUnit->GenT._ModeBit; - } - if (texUnit->TexGenEnabled & R_BIT) { - texUnit->_GenFlags |= texUnit->GenR._ModeBit; - } - if (texUnit->TexGenEnabled & Q_BIT) { - texUnit->_GenFlags |= texUnit->GenQ._ModeBit; - } - - ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); - ctx->Texture._GenFlags |= texUnit->_GenFlags; - } - - ASSERT(unit < Elements(ctx->TextureMatrixStack)); - if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) - ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); - } + if (!fprog || !vprog) + update_texgen(ctx); }