QOpenGLTexture: revamp the feature list

OpenGL ES 3 adds lots of useful stuff in there, so we should
start using it. Since we're there, properly reorganize the other
feature checks.

Note that by starting using immutable storage on GLES2, we may
work around the issue reported in QTBUG-41822 (we're still
not 100% sure if it's an ANGLE bug or a Qt bug).

Task-number: QTBUG-41822
Change-Id: Id8cdbaaf93bc263e663db06b6fd2fee012cb29ad
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Giuseppe D'Angelo 2014-11-12 13:02:02 +01:00
parent 302b6235eb
commit ef828b89ab

View File

@ -2826,7 +2826,8 @@ bool QOpenGLTexture::hasFeature(Feature feature)
case ImmutableStorage:
supported = f.version() >= qMakePair(4, 2)
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage"));
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage"))
|| ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_storage"));
break;
case TextureCubeMapArrays:
@ -2873,9 +2874,6 @@ bool QOpenGLTexture::hasFeature(Feature feature)
case MaxFeatureFlag:
break;
default:
break;
}
}
@ -2883,21 +2881,59 @@ bool QOpenGLTexture::hasFeature(Feature feature)
#endif
{
switch (feature) {
case Texture3D:
supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"));
case ImmutableStorage:
supported = f.version() >= qMakePair(3, 0)
|| ctx->hasExtension(QByteArrayLiteral("EXT_texture_storage"));
break;
case ImmutableMultisampleStorage:
supported = f.version() >= qMakePair(3, 1);
break;
case TextureRectangle:
break;
case TextureArrays:
supported = f.version() >= qMakePair(3, 0);
break;
case Texture3D:
supported = f.version() >= qMakePair(3, 0)
|| ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"));
break;
case TextureMultisample:
supported = f.version() >= qMakePair(3, 1);
break;
case TextureBuffer:
break;
case TextureCubeMapArrays:
break;
case Swizzle:
supported = f.version() >= qMakePair(3, 0);
break;
case StencilTexturing:
break;
case AnisotropicFiltering:
supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic"));
break;
case NPOTTextures:
case NPOTTextureRepeat:
supported = f.version() >= qMakePair(3,0);
if (!supported) {
supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot"));
if (!supported)
supported = ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two"));
}
default:
supported = f.version() >= qMakePair(3,0)
|| ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot"))
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two"));
break;
case Texture1D:
break;
case MaxFeatureFlag:
break;
}
}