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

@@ -233,24 +233,32 @@ void TextureCubeMap::apply(State& state) const
{
textureObject->bind();
if (getTextureParameterDirty(state.getContextID())) applyTexParameters(GL_TEXTURE_CUBE_MAP,state);
if (_subloadCallback.valid())
{
applyTexParameters(GL_TEXTURE_CUBE_MAP,state);
_subloadCallback->subload(*this,state);
}
else
{
bool applyParameters = true;
for (int n=0; n<6; n++)
{
const osg::Image* image = _images[n].get();
if (image && getModifiedCount((Face)n,contextID) != image->getModifiedCount())
{
getModifiedCount((Face)n,contextID) = image->getModifiedCount();
if (applyParameters)
{
applyTexParameters(GL_TEXTURE_CUBE_MAP,state);
applyParameters = false;
}
applyTexImage2D_subload( state, faceTarget[n], _images[n].get(), _textureWidth, _textureHeight, _internalFormat, _numMipmapLevels);
}
}
}
if (getTextureParameterDirty(state.getContextID()))
applyTexParameters(GL_TEXTURE_CUBE_MAP,state);
}
else if (_subloadCallback.valid())