summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-09 17:56:51 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-09 17:56:52 +0200
commit881ceeff428c377d02ae3881beccdbb028385075 (patch)
tree65bd4335d7f67b81b04e33f2cbb17a41cf966dd8 /src/gui/opengl
parentb3d2c867ed14cd6337d5e32b8750f198b5b7d331 (diff)
parent106487387d493dab934e19b33bfed55b8df62d67 (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Diffstat (limited to 'src/gui/opengl')
-rw-r--r--src/gui/opengl/qopengldebug.cpp10
-rw-r--r--src/gui/opengl/qopenglextensions_p.h15
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp18
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp12
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp6
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp4
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject_p.h10
7 files changed, 39 insertions, 36 deletions
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index dcab3a5c52..88f00128da 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE
QOpenGLDebugLogger supports both these modes of operation. Refer to the
following sections to find out the differences between them.
- \section1 Creating an OpenGL debug context
+ \section1 Creating an OpenGL Debug Context
For efficiency reasons, OpenGL implementations are allowed not to create
any debug output at all, unless the OpenGL context is a debug context. In order
@@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE
version, as it relies on the availability of the \c{GL_KHR_debug} extension
(see below).
- \section1 Creating and initializing a QOpenGLDebugLogger
+ \section1 Creating and Initializing a QOpenGLDebugLogger
QOpenGLDebugLogger is a simple QObject-derived class. Just like all QObject
subclasses, you create an instance (and optionally specify a parent
@@ -163,7 +163,7 @@ QT_BEGIN_NAMESPACE
where \c{ctx} is a valid QOpenGLContext. If the extension is not available,
initialize() will return false.
- \section1 Reading the internal OpenGL debug log
+ \section1 Reading the Internal OpenGL Debug Log
OpenGL implementations keep an internal log of debug messages. Messages
stored in this log can be retrieved by using the loggedMessages() function:
@@ -237,7 +237,7 @@ QT_BEGIN_NAMESPACE
OpenGL log), it is important to always check if it contains any message
after calling startLogging().
- \section1 Inserting messages in the debug log
+ \section1 Inserting Messages in the Debug Log
It is possible for applications and libraries to insert custom messages in
the debug log, for instance for marking a group of related OpenGL commands
@@ -262,7 +262,7 @@ QT_BEGIN_NAMESPACE
this length by calling the maximumMessageLength() method; messages longer
than the limit will automatically get truncated.
- \section1 Controlling the debug output
+ \section1 Controlling the Debug Output
QOpenGLDebugMessage is also able to apply filters to the debug messages, and
therefore limit the amount of messages logged. You can enable or disable
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index b4e90b3d84..23cfe16467 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -49,18 +49,6 @@
QT_BEGIN_NAMESPACE
-
-#if 0
-#ifndef GL_ARB_vertex_buffer_object
-typedef ptrdiff_t GLintptrARB;
-typedef ptrdiff_t GLsizeiptrARB;
-#endif
-#endif
-
-#ifndef GL_VERSION_2_0
-typedef char GLchar;
-#endif
-
class QOpenGLExtensionsPrivate;
class Q_GUI_EXPORT QOpenGLExtensions : public QOpenGLFunctions
@@ -92,7 +80,8 @@ public:
SRGBFrameBuffer = 0x00020000,
MapBuffer = 0x00040000,
GeometryShaders = 0x00080000,
- MapBufferRange = 0x00100000
+ MapBufferRange = 0x00100000,
+ Sized8Formats = 0x00200000
};
Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension)
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index f33d4df280..b185e332e6 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -452,13 +452,7 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
if (!funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
|| !funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit)) {
samples = 0;
- }
-
- // On GLES 2.0 multisampled framebuffers are available through vendor-specific extensions
- const bool msaaES2 = ctx->isOpenGLES() && (ctx->hasExtension("GL_ANGLE_framebuffer_multisample")
- || ctx->hasExtension("GL_NV_framebuffer_multisample"));
-
- if (!ctx->isOpenGLES() || msaaES2) {
+ } else if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
GLint maxSamples;
funcs.glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
samples = qBound(0, int(samples), int(maxSamples));
@@ -483,11 +477,15 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
initTexture(texture_target, internal_format, size, mipmap);
} else {
GLenum storageFormat = internal_format;
+ // ES requires a sized format. The older desktop extension does not. Correct the format on ES.
+ if (ctx->isOpenGLES() && internal_format == GL_RGBA) {
#ifdef GL_RGBA8_OES
- // Correct the internal format used by the render buffer when using ES with extensions
- if (msaaES2 && internal_format == GL_RGBA)
- storageFormat = GL_RGBA8_OES;
+ if (funcs.hasOpenGLExtension(QOpenGLExtensions::Sized8Formats))
+ storageFormat = GL_RGBA8_OES;
+ else
#endif
+ storageFormat = GL_RGBA4;
+ }
mipmap = false;
funcs.glGenRenderbuffers(1, &color_buffer);
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 5ee72f54bf..44b56699df 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -385,7 +385,8 @@ static int qt_gl_resolve_extensions()
| QOpenGLExtensions::ElementIndexUint
| QOpenGLExtensions::MapBufferRange
| QOpenGLExtensions::FramebufferBlit
- | QOpenGLExtensions::FramebufferMultisample;
+ | QOpenGLExtensions::FramebufferMultisample
+ | QOpenGLExtensions::Sized8Formats;
} else {
// Recognize features by extension name.
if (extensionMatcher.match("GL_OES_packed_depth_stencil"))
@@ -400,6 +401,8 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::FramebufferBlit;
if (extensionMatcher.match("GL_NV_framebuffer_multisample"))
extensions |= QOpenGLExtensions::FramebufferMultisample;
+ if (extensionMatcher.match("GL_OES_rgb8_rgba8"))
+ extensions |= QOpenGLExtensions::Sized8Formats;
}
if (extensionMatcher.match("GL_OES_mapbuffer"))
@@ -419,9 +422,10 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::GenerateMipmap;
if (format.majorVersion() >= 3 || extensionMatcher.match("GL_ARB_framebuffer_object")) {
- extensions |= QOpenGLExtensions::FramebufferMultisample |
- QOpenGLExtensions::FramebufferBlit |
- QOpenGLExtensions::PackedDepthStencil;
+ extensions |= QOpenGLExtensions::FramebufferMultisample
+ | QOpenGLExtensions::FramebufferBlit
+ | QOpenGLExtensions::PackedDepthStencil
+ | QOpenGLExtensions::Sized8Formats;
} else {
// Recognize features by extension name.
if (extensionMatcher.match("GL_EXT_framebuffer_multisample"))
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 849d94365a..5ea7a10e0d 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
\snippet code/src_gui_qopenglshaderprogram.cpp 0
- \section1 Writing portable shaders
+ \section1 Writing Portable Shaders
Shader programs can be difficult to reuse across OpenGL implementations
because of varying levels of support for standard vertex attributes and
@@ -95,7 +95,7 @@ QT_BEGIN_NAMESPACE
to just features that are present in GLSL/ES, and avoid
standard variable names that only work on the desktop.
- \section1 Simple shader example
+ \section1 Simple Shader Example
\snippet code/src_gui_qopenglshaderprogram.cpp 1
@@ -104,7 +104,7 @@ QT_BEGIN_NAMESPACE
\snippet code/src_gui_qopenglshaderprogram.cpp 2
- \section1 Binary shaders and programs
+ \section1 Binary Shaders and Programs
Binary shaders may be specified using \c{glShaderBinary()} on
the return value from QOpenGLShader::shaderId(). The QOpenGLShader instance
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index 0b4eca0411..d8979fd98f 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -61,6 +61,7 @@ void qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper,
helper->GenVertexArrays = ::glGenVertexArrays;
helper->DeleteVertexArrays = ::glDeleteVertexArrays;
helper->BindVertexArray = ::glBindVertexArray;
+ helper->IsVertexArray = ::glIsVertexArray;
tryARB = false;
} else
#endif
@@ -68,6 +69,7 @@ void qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper,
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES")));
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES")));
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES")));
+ helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glIsVertexArrayOES")));
tryARB = false;
}
} else if (context->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object")) &&
@@ -75,6 +77,7 @@ void qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper,
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysAPPLE")));
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysAPPLE")));
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayAPPLE")));
+ helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glIsVertexArrayAPPLE")));
tryARB = false;
}
@@ -82,6 +85,7 @@ void qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper,
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArrays")));
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArrays")));
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glBindVertexArray")));
+ helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glIsVertexArray")));
}
}
diff --git a/src/gui/opengl/qopenglvertexarrayobject_p.h b/src/gui/opengl/qopenglvertexarrayobject_p.h
index 3c06254baa..366d7ae2f6 100644
--- a/src/gui/opengl/qopenglvertexarrayobject_p.h
+++ b/src/gui/opengl/qopenglvertexarrayobject_p.h
@@ -67,13 +67,14 @@ public:
: GenVertexArrays(Q_NULLPTR)
, DeleteVertexArrays(Q_NULLPTR)
, BindVertexArray(Q_NULLPTR)
+ , IsVertexArray(Q_NULLPTR)
{
qtInitializeVertexArrayObjectHelper(this, context);
}
inline bool isValid() const
{
- return GenVertexArrays && DeleteVertexArrays && BindVertexArray;
+ return GenVertexArrays && DeleteVertexArrays && BindVertexArray && IsVertexArray;
}
inline void glGenVertexArrays(GLsizei n, GLuint *arrays) const
@@ -91,6 +92,11 @@ public:
BindVertexArray(array);
}
+ inline GLboolean glIsVertexArray(GLuint array) const
+ {
+ return IsVertexArray(array);
+ }
+
private:
friend void Q_GUI_EXPORT qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, QOpenGLContext *context);
@@ -98,10 +104,12 @@ private:
typedef void (QOPENGLF_APIENTRYP qt_GenVertexArrays_t)(GLsizei n, GLuint *arrays);
typedef void (QOPENGLF_APIENTRYP qt_DeleteVertexArrays_t)(GLsizei n, const GLuint *arrays);
typedef void (QOPENGLF_APIENTRYP qt_BindVertexArray_t)(GLuint array);
+ typedef GLboolean (QOPENGLF_APIENTRYP qt_IsVertexArray_t)(GLuint array);
qt_GenVertexArrays_t GenVertexArrays;
qt_DeleteVertexArrays_t DeleteVertexArrays;
qt_BindVertexArray_t BindVertexArray;
+ qt_IsVertexArray_t IsVertexArray;
};
QT_END_NAMESPACE