summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2014-04-13 12:37:31 +1200
committerChris Forbes <[email protected]>2014-04-21 10:12:00 +1200
commitc4a98e76d7dcb84ba6a0337dc975351966c4dac7 (patch)
tree1669b5393c799dc1447013a0f5f15bfd7d5ad62b
parentba6dcb3c2b8f516b120f591144bf6c3751f0e3f9 (diff)
mesa: Track max enabled tex image unit
This gives us a better bound for some hot loops in the drivers than MAX_COMBINED_TEXTURE_IMAGE_UNITS, which is ridiculously large on modern hardware, and only getting worse as more shader stages are added. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/texstate.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 4d014d1ee3a..66943836c5b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1402,6 +1402,9 @@ struct gl_texture_attrib
/** Bitwise-OR of all Texture.Unit[i]._GenFlags */
GLbitfield _GenFlags;
+
+ /** Upper bound on _ReallyEnabled texunits. */
+ GLint _MaxEnabledTexImageUnit;
};
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index fcae878cf84..b68920ce170 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -550,6 +550,7 @@ update_texture_state( struct gl_context *ctx )
ctx->Texture._GenFlags = 0x0;
ctx->Texture._TexMatEnabled = 0x0;
ctx->Texture._TexGenEnabled = 0x0;
+ ctx->Texture._MaxEnabledTexImageUnit = -1;
/*
* Update texture unit state.
@@ -636,6 +637,7 @@ update_texture_state( struct gl_context *ctx )
/* if we get here, we know this texture unit is enabled */
ctx->Texture._EnabledUnits |= (1 << unit);
+ ctx->Texture._MaxEnabledTexImageUnit = unit;
if (enabledTargetsByStage[MESA_SHADER_FRAGMENT])
enabledFragUnits |= (1 << unit);