summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglfunctions.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-03-19 12:52:03 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-20 14:11:33 +0100
commit8adca56674bd51a39b278fb08f270624c825b002 (patch)
tree02d234e612ef1a74758566eb9c403e45c25664ad /src/gui/opengl/qopenglfunctions.cpp
parent33cac84df30770de2a2c27d4b1288a658db1b638 (diff)
Resurrect advanced bindTexture() features in QtOpenGL
During the Qt 4 -> 5 migration the setting of the extension flags in QOpenGLFunctions/Extensions suffered a regression: flags like GenerateMipmap were never set. This led to the unfortunate sitation that features that were tied to these flags, like compressed texture support or mipmap generation, got disabled. This is now corrected by checking for the extensions like Qt 4 did. Task-number: QTBUG-37588 Change-Id: I4a7beb1b435af11e05f5304aa04df2ec63b34c18 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/gui/opengl/qopenglfunctions.cpp')
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index fe6eb4c098..d52b1a314f 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -359,10 +359,37 @@ static int qt_gl_resolve_extensions()
{
int extensions = 0;
QOpenGLExtensionMatcher extensionMatcher;
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ QSurfaceFormat format = ctx->format();
+
if (extensionMatcher.match("GL_EXT_bgra"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
-
- if (QOpenGLContext::currentContext()->isES()) {
+ if (extensionMatcher.match("GL_ARB_texture_rectangle"))
+ extensions |= QOpenGLExtensions::TextureRectangle;
+ if (extensionMatcher.match("GL_SGIS_generate_mipmap"))
+ extensions |= QOpenGLExtensions::GenerateMipmap;
+ if (extensionMatcher.match("GL_ARB_texture_compression"))
+ extensions |= QOpenGLExtensions::TextureCompression;
+ if (extensionMatcher.match("GL_EXT_texture_compression_s3tc"))
+ extensions |= QOpenGLExtensions::DDSTextureCompression;
+ if (extensionMatcher.match("GL_OES_compressed_ETC1_RGB8_texture"))
+ extensions |= QOpenGLExtensions::ETC1TextureCompression;
+ if (extensionMatcher.match("GL_IMG_texture_compression_pvrtc"))
+ extensions |= QOpenGLExtensions::PVRTCTextureCompression;
+ if (extensionMatcher.match("GL_ARB_texture_mirrored_repeat"))
+ extensions |= QOpenGLExtensions::MirroredRepeat;
+ if (extensionMatcher.match("GL_EXT_stencil_two_side"))
+ extensions |= QOpenGLExtensions::StencilTwoSide;
+ if (extensionMatcher.match("GL_EXT_stencil_wrap"))
+ extensions |= QOpenGLExtensions::StencilWrap;
+ if (extensionMatcher.match("GL_NV_float_buffer"))
+ extensions |= QOpenGLExtensions::NVFloatBuffer;
+ if (extensionMatcher.match("GL_ARB_pixel_buffer_object"))
+ extensions |= QOpenGLExtensions::PixelBufferObject;
+
+ if (ctx->isES()) {
+ if (format.majorVersion() >= 2)
+ extensions |= QOpenGLExtensions::GenerateMipmap;
if (extensionMatcher.match("GL_OES_mapbuffer"))
extensions |= QOpenGLExtensions::MapBuffer;
if (extensionMatcher.match("GL_OES_packed_depth_stencil"))
@@ -375,7 +402,6 @@ static int qt_gl_resolve_extensions()
if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
} else {
- QSurfaceFormat format = QOpenGLContext::currentContext()->format();
extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer;
// Recognize features by extension name.
@@ -394,6 +420,19 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::PackedDepthStencil;
}
}
+
+ if (format.renderableType() == QSurfaceFormat::OpenGL && format.version() >= qMakePair(3, 2))
+ extensions |= QOpenGLExtensions::GeometryShaders;
+
+#ifndef QT_OPENGL_ES
+ if (extensionMatcher.match("GL_EXT_framebuffer_sRGB")) {
+ GLboolean srgbCapableFramebuffers = false;
+ ctx->functions()->glGetBooleanv(GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, &srgbCapableFramebuffers);
+ if (srgbCapableFramebuffers)
+ extensions |= QOpenGLExtensions::SRGBFrameBuffer;
+ }
+#endif
+
return extensions;
}