From Ulrich Hertlein, "not sure how severe this is but I believe there's a bug in

Texture.cpp:applyTexImage2D_subload:

<code>
unsigned char* data = = (unsigned char*)image->data();
if (needImageRescale) {
 // allocates rescale buffer
 data = new unsigned char[newTotalSize];

 // calls gluScaleImage into the data buffer
}

const unsigned char* dataPtr = image->data();
// subloads 'dataPtr'

// deletes 'data'
</code>

In effect, the scaled data would never be used.

I've also replaced bits of duplicate code in Texture1D/2D/2DArray/3D/Cubemap/Rectangle
that checks if the texture image can/should be unref'd with common functionality in
Texture.cpp.

"
This commit is contained in:
Robert Osfield
2010-09-14 13:19:55 +00:00
parent d55ada3790
commit 551d2b6479
9 changed files with 34 additions and 54 deletions

View File

@@ -298,10 +298,11 @@ void Texture3D::apply(State& state) const
_textureObjectBuffer[contextID] = textureObject;
if (state.getMaxTexturePoolSize()==0 && _unrefImageDataAfterApply && areAllTextureObjectsLoaded() && _image->getDataVariance()==STATIC)
// unref image data?
if (isSafeToUnrefImageData(state) && _image->getDataVariance()==STATIC)
{
Texture3D* non_const_this = const_cast<Texture3D*>(this);
non_const_this->_image = 0;
non_const_this->_image = NULL;
}
}