summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-01-08 11:09:49 -0800
committerEric Anholt <[email protected]>2013-01-18 13:03:46 -0800
commit1ec1b577f726a70dd787227260e61928e97474e5 (patch)
tree970de3e699759c83785484b644b96026f4b810ad /src/mesa
parent078727d41c1f1578704c830fce062bd0538802ab (diff)
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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texstate.c70
1 files changed, 39 insertions, 31 deletions
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);
}