Moved the assignment of the ModifiedCount to before GL texture calls.

This commit is contained in:
Robert Osfield
2017-10-19 20:57:25 +01:00
parent 8965c9369e
commit 24c2a0ca60
7 changed files with 28 additions and 27 deletions

View File

@@ -202,12 +202,11 @@ void Texture2D::apply(State& state) const
}
else if (_image.valid() && getModifiedCount(contextID) != _image->getModifiedCount())
{
applyTexImage2D_subload(state,GL_TEXTURE_2D,_image.get(),
_textureWidth, _textureHeight, _internalFormat, _numMipmapLevels);
// update the modified tag to show that it is up to date.
getModifiedCount(contextID) = _image->getModifiedCount();
applyTexImage2D_subload(state,GL_TEXTURE_2D,_image.get(),
_textureWidth, _textureHeight, _internalFormat, _numMipmapLevels);
}
else if (_readPBuffer.valid())
{
@@ -224,6 +223,8 @@ void Texture2D::apply(State& state) const
applyTexParameters(GL_TEXTURE_2D,state);
if (_image.valid()) getModifiedCount(contextID) = _image->getModifiedCount();
_subloadCallback->load(*this,state);
textureObject->setAllocated(_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,_borderWidth);
@@ -235,7 +236,6 @@ void Texture2D::apply(State& state) const
//glBindTexture( GL_TEXTURE_2D, handle );
// update the modified tag to show that it is up to date.
if (_image.valid()) getModifiedCount(contextID) = _image->getModifiedCount();
}
else if (_image.valid() && _image->data())
{
@@ -255,6 +255,9 @@ void Texture2D::apply(State& state) const
applyTexParameters(GL_TEXTURE_2D,state);
// update the modified tag to show that it is up to date.
getModifiedCount(contextID) = image->getModifiedCount();
if (textureObject->isAllocated() && image->supportsTextureSubloading())
{
//OSG_NOTICE<<"Reusing texture object"<<std::endl;
@@ -270,9 +273,6 @@ void Texture2D::apply(State& state) const
textureObject->setAllocated(true);
}
// update the modified tag to show that it is up to date.
getModifiedCount(contextID) = image->getModifiedCount();
// unref image data?
if (isSafeToUnrefImageData(state) && image->getDataVariance()==STATIC)
{