Track dirty texture parameters and images separately.

TRAC #15703 Issue=86 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@590 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a9eb5dac
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 577
#define BUILD_REVISION 590
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -2031,27 +2031,33 @@ void Context::applyTextures()
Texture *texture = getSamplerTexture(textureUnit, textureType);
if (mAppliedTextureSerial[sampler] != texture->getSerial() || texture->isDirty())
if (mAppliedTextureSerial[sampler] != texture->getSerial() || texture->isDirtyParameter() || texture->isDirtyImage())
{
IDirect3DBaseTexture9 *d3dTexture = texture->getTexture();
if (d3dTexture)
{
GLenum wrapS = texture->getWrapS();
GLenum wrapT = texture->getWrapT();
GLenum minFilter = texture->getMinFilter();
GLenum magFilter = texture->getMagFilter();
device->SetSamplerState(sampler, D3DSAMP_ADDRESSU, es2dx::ConvertTextureWrap(wrapS));
device->SetSamplerState(sampler, D3DSAMP_ADDRESSV, es2dx::ConvertTextureWrap(wrapT));
device->SetSamplerState(sampler, D3DSAMP_MAGFILTER, es2dx::ConvertMagFilter(magFilter));
D3DTEXTUREFILTERTYPE d3dMinFilter, d3dMipFilter;
es2dx::ConvertMinFilter(minFilter, &d3dMinFilter, &d3dMipFilter);
device->SetSamplerState(sampler, D3DSAMP_MINFILTER, d3dMinFilter);
device->SetSamplerState(sampler, D3DSAMP_MIPFILTER, d3dMipFilter);
if (mAppliedTextureSerial[sampler] != texture->getSerial() || texture->isDirtyParameter())
{
GLenum wrapS = texture->getWrapS();
GLenum wrapT = texture->getWrapT();
GLenum minFilter = texture->getMinFilter();
GLenum magFilter = texture->getMagFilter();
device->SetSamplerState(sampler, D3DSAMP_ADDRESSU, es2dx::ConvertTextureWrap(wrapS));
device->SetSamplerState(sampler, D3DSAMP_ADDRESSV, es2dx::ConvertTextureWrap(wrapT));
device->SetSamplerState(sampler, D3DSAMP_MAGFILTER, es2dx::ConvertMagFilter(magFilter));
D3DTEXTUREFILTERTYPE d3dMinFilter, d3dMipFilter;
es2dx::ConvertMinFilter(minFilter, &d3dMinFilter, &d3dMipFilter);
device->SetSamplerState(sampler, D3DSAMP_MINFILTER, d3dMinFilter);
device->SetSamplerState(sampler, D3DSAMP_MIPFILTER, d3dMipFilter);
}
device->SetTexture(sampler, d3dTexture);
if (mAppliedTextureSerial[sampler] != texture->getSerial() || texture->isDirtyImage())
{
device->SetTexture(sampler, d3dTexture);
}
}
else
{
......
......@@ -45,7 +45,9 @@ Texture::Texture(GLuint id) : RefCountObject(id), mSerial(issueSerial())
mMagFilter = GL_LINEAR;
mWrapS = GL_REPEAT;
mWrapT = GL_REPEAT;
mDirty = true;
mDirtyParameter = true;
mDirtyImage = true;
mIsRenderable = false;
}
......@@ -75,7 +77,7 @@ bool Texture::setMinFilter(GLenum filter)
if (mMinFilter != filter)
{
mMinFilter = filter;
mDirty = true;
mDirtyParameter = true;
}
return true;
}
......@@ -95,7 +97,7 @@ bool Texture::setMagFilter(GLenum filter)
if (mMagFilter != filter)
{
mMagFilter = filter;
mDirty = true;
mDirtyParameter = true;
}
return true;
}
......@@ -116,7 +118,7 @@ bool Texture::setWrapS(GLenum wrap)
if (mWrapS != wrap)
{
mWrapS = wrap;
mDirty = true;
mDirtyParameter = true;
}
return true;
}
......@@ -137,7 +139,7 @@ bool Texture::setWrapT(GLenum wrap)
if (mWrapT != wrap)
{
mWrapT = wrap;
mDirty = true;
mDirtyParameter = true;
}
return true;
}
......@@ -847,7 +849,7 @@ void Texture::setImage(GLint unpackAlignment, const void *pixels, Image *image)
}
image->dirty = true;
mDirty = true;
mDirtyImage = true;
}
}
......@@ -871,7 +873,7 @@ void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *i
}
image->dirty = true;
mDirty = true;
mDirtyImage = true;
}
}
......@@ -905,7 +907,7 @@ bool Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
}
image->dirty = true;
mDirty = true;
mDirtyImage = true;
}
return true;
......@@ -952,7 +954,7 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
}
image->dirty = true;
mDirty = true;
mDirtyImage = true;
}
return true;
......@@ -1120,7 +1122,7 @@ void Texture::copyNonRenderable(Image *image, GLenum format, GLint xoffset, GLin
}
image->dirty = true;
mDirty = true;
mDirtyImage = true;
}
image->surface->UnlockRect();
......@@ -1150,14 +1152,20 @@ IDirect3DBaseTexture9 *Texture::getTexture()
return getBaseTexture();
}
bool Texture::isDirty() const
bool Texture::isDirtyParameter() const
{
return mDirtyParameter;
}
bool Texture::isDirtyImage() const
{
return mDirty;
return mDirtyImage;
}
void Texture::resetDirty()
{
mDirty = false;
mDirtyParameter = false;
mDirtyImage = false;
}
unsigned int Texture::getSerial() const
......@@ -1271,7 +1279,7 @@ void Texture2D::redefineTexture(GLint level, GLenum format, GLsizei width, GLsiz
{
mTexture->Release();
mTexture = NULL;
mDirty = true;
mDirtyImage = true;
mIsRenderable = false;
}
}
......@@ -1541,7 +1549,7 @@ void Texture2D::createTexture()
}
mTexture = texture;
mDirty = true;
mDirtyImage = true;
mIsRenderable = false;
}
......@@ -1648,7 +1656,7 @@ void Texture2D::convertToRenderTarget()
}
mTexture = texture;
mDirty = true;
mDirtyImage = true;
mIsRenderable = true;
}
......@@ -1999,7 +2007,7 @@ void TextureCubeMap::createTexture()
}
mTexture = texture;
mDirty = true;
mDirtyImage = true;
mIsRenderable = false;
}
......@@ -2108,7 +2116,7 @@ void TextureCubeMap::convertToRenderTarget()
}
mTexture = texture;
mDirty = true;
mDirtyImage = true;
mIsRenderable = true;
}
......@@ -2169,7 +2177,7 @@ void TextureCubeMap::redefineTexture(int face, GLint level, GLenum format, GLsiz
{
mTexture->Release();
mTexture = NULL;
mDirty = true;
mDirtyImage = true;
mIsRenderable = false;
}
}
......
......@@ -73,7 +73,8 @@ class Texture : public RefCountObject
virtual void generateMipmaps() = 0;
virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
bool isDirty() const;
bool isDirtyParameter() const;
bool isDirtyImage() const;
void resetDirty();
unsigned int getSerial() const;
......@@ -125,7 +126,9 @@ class Texture : public RefCountObject
GLenum mMagFilter;
GLenum mWrapS;
GLenum mWrapT;
bool mDirty;
bool mDirtyParameter;
bool mDirtyImage;
bool mIsRenderable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment