Restructured the way that applyTexParameters() is applied to address issues with Intel drivers not handling mipmap generations unless the tex parameters are reapplied on new upload of data.

This commit is contained in:
Robert Osfield
2018-02-27 17:35:13 +00:00
parent 39881b5576
commit 7b6eedbdf4
5 changed files with 45 additions and 13 deletions

View File

@@ -278,16 +278,16 @@ void Texture2DArray::apply(State& state) const
// bind texture object
textureObject->bind();
// if texture parameters changed, then reset them
if (getTextureParameterDirty(state.getContextID())) applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT,state);
// if subload is specified, then use it to subload the images to GPU memory
if (_subloadCallback.valid())
{
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT,state);
_subloadCallback->subload(*this,state);
}
else
{
bool applyParameters = true;
GLsizei n = 0;
for(Images::const_iterator itr = _images.begin();
itr != _images.end();
@@ -299,13 +299,23 @@ void Texture2DArray::apply(State& state) const
if (getModifiedCount(n,contextID) != image->getModifiedCount())
{
getModifiedCount(n,contextID) = image->getModifiedCount();
if (applyParameters)
{
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT,state);
applyParameters = false;
}
applyTexImage2DArray_subload(state, image, n, _textureWidth, _textureHeight, image->r(), _internalFormat, _numMipmapLevels);
}
n += image->r();
}
}
}
}
// if texture parameters changed, then reset them
if (getTextureParameterDirty(state.getContextID()))
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT,state);
}
// there is no texture object, but exists a subload callback, so use it to upload images