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 <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
+39
-31
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user