Moved applied texture and sampler caching from Context into the Renderers.
TRAC #22248
Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch
Author: Geoff Lang
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1698 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 45537dd..f85ec9a 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -307,16 +307,6 @@
// This function will set all of the state-related dirty flags, so that all state is set during next pre-draw.
void Context::markAllStateDirty()
{
- for (int t = 0; t < MAX_TEXTURE_IMAGE_UNITS; t++)
- {
- mAppliedTextureSerialPS[t] = 0;
- }
-
- for (int t = 0; t < MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF; t++)
- {
- mAppliedTextureSerialVS[t] = 0;
- }
-
mDxUniformsDirty = true;
}
@@ -1795,7 +1785,6 @@
ProgramBinary *programBinary = getCurrentProgramBinary();
int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF; // Range of Direct3D 9 samplers of given sampler type
- unsigned int *appliedTextureSerial = (type == SAMPLER_PIXEL) ? mAppliedTextureSerialPS : mAppliedTextureSerialVS;
int samplerRange = programBinary->getUsedSamplerRange(type);
for (int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
@@ -1805,53 +1794,32 @@
if (textureUnit != -1)
{
TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex);
-
Texture *texture = getSamplerTexture(textureUnit, textureType);
- unsigned int texSerial = texture->getTextureSerial();
- if (appliedTextureSerial[samplerIndex] != texSerial || texture->hasDirtyParameters() || texture->hasDirtyImages())
+ if (texture->isSamplerComplete())
{
- if (texture->isSamplerComplete())
- {
- if (appliedTextureSerial[samplerIndex] != texSerial || texture->hasDirtyParameters())
- {
- SamplerState samplerState;
- texture->getSamplerState(&samplerState);
+ SamplerState samplerState;
+ texture->getSamplerState(&samplerState);
+ mRenderer->setSamplerState(type, samplerIndex, samplerState);
- mRenderer->setSamplerState(type, samplerIndex, samplerState);
- }
+ mRenderer->setTexture(type, samplerIndex, texture);
- if (appliedTextureSerial[samplerIndex] != texSerial || texture->hasDirtyImages())
- {
- mRenderer->setTexture(type, samplerIndex, texture);
- }
- }
- else
- {
- mRenderer->setTexture(type, samplerIndex, getIncompleteTexture(textureType));
- }
-
- appliedTextureSerial[samplerIndex] = texSerial;
texture->resetDirty();
}
+ else
+ {
+ mRenderer->setTexture(type, samplerIndex, getIncompleteTexture(textureType));
+ }
}
else
{
- if (appliedTextureSerial[samplerIndex] != 0)
- {
- mRenderer->setTexture(type, samplerIndex, NULL);
- appliedTextureSerial[samplerIndex] = 0;
- }
+ mRenderer->setTexture(type, samplerIndex, NULL);
}
}
for (int samplerIndex = samplerRange; samplerIndex < samplerCount; samplerIndex++)
{
- if (appliedTextureSerial[samplerIndex] != 0)
- {
- mRenderer->setTexture(type, samplerIndex, NULL);
- appliedTextureSerial[samplerIndex] = 0;
- }
+ mRenderer->setTexture(type, samplerIndex, NULL);
}
}