summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-09-10 23:49:50 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-09-10 23:49:50 (GMT)
commitc5455e3aa004cc8ecf430b15def1d2000c886f45 (patch)
tree39498c1e17702d8d06eacb77f9dd9145deccbfba /src/opengl
parent7c52bd0b28eaf0b1d5435fda6140a9d05fddba19 (diff)
downloadQt-c5455e3aa004cc8ecf430b15def1d2000c886f45.zip
Qt-c5455e3aa004cc8ecf430b15def1d2000c886f45.tar.gz
Qt-c5455e3aa004cc8ecf430b15def1d2000c886f45.tar.bz2
Resolve ARB_framebuffer_object and OES_framebuffer_object extensions
Reviewed-by: trustme
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp9
-rw-r--r--src/opengl/qglextensions.cpp84
2 files changed, 75 insertions, 18 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 8a9ea1c..acb4d4f 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -4815,6 +4815,15 @@ void QGLExtensions::init_extensions()
glExtensions |= FramebufferObject;
glExtensions |= GenerateMipmap;
#endif
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL)
+ if (extensions.contains(QLatin1String("OES_framebuffer_object")))
+ glExtensions |= FramebufferObject;
+#endif
+ if (extensions.contains(QLatin1String("ARB_framebuffer_object"))) {
+ // ARB_framebuffer_object also includes EXT_framebuffer_blit.
+ glExtensions |= FramebufferObject;
+ glExtensions |= FramebufferBlit;
+ }
if (extensions.contains(QLatin1String("EXT_framebuffer_blit")))
glExtensions |= FramebufferBlit;
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index 8c8d46c..69946a1 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -43,6 +43,52 @@
QT_BEGIN_NAMESPACE
+static void *qt_gl_getProcAddress_search
+ (QGLContext *ctx, const char *name1, const char *name2,
+ const char *name3, const char *name4)
+{
+ void *addr;
+
+ addr = ctx->getProcAddress(QLatin1String(name1));
+ if (addr)
+ return addr;
+
+ addr = ctx->getProcAddress(QLatin1String(name2));
+ if (addr)
+ return addr;
+
+ addr = ctx->getProcAddress(QLatin1String(name3));
+ if (addr)
+ return addr;
+
+ if (name4)
+ return ctx->getProcAddress(QLatin1String(name4));
+
+ return 0;
+}
+
+// Search for an extension function starting with the most likely
+// function suffix first, and then trying the other variations.
+#if defined(QT_OPENGL_ES)
+#define qt_gl_getProcAddress(ctx,name) \
+ qt_gl_getProcAddress_search((ctx), name, name "OES", name "EXT", name "ARB")
+#define qt_gl_getProcAddressEXT(ctx,name) \
+ qt_gl_getProcAddress_search((ctx), name "OES", name, name "EXT", name "ARB")
+#define qt_gl_getProcAddressARB(ctx,name) \
+ qt_gl_getProcAddress_search((ctx), name "OES", name, name "ARB", name "EXT")
+#define qt_gl_getProcAddressOES(ctx,name) \
+ qt_gl_getProcAddress_search((ctx), name "OES", name, name "EXT", name "ARB")
+#else
+#define qt_gl_getProcAddress(ctx,name) \
+ qt_gl_getProcAddress_search((ctx), name, name "ARB", name "EXT", 0)
+#define qt_gl_getProcAddressEXT(ctx,name) \
+ qt_gl_getProcAddress_search((ctx), name "EXT", name, name "ARB", 0)
+#define qt_gl_getProcAddressARB(ctx,name) \
+ qt_gl_getProcAddress_search((ctx), name "ARB", name, name "EXT", 0)
+#define qt_gl_getProcAddressOES(ctx,name) \
+ qt_gl_getProcAddress_search((ctx), name "OES", name, name "EXT", name "ARB")
+#endif
+
bool qt_resolve_framebufferobject_extensions(QGLContext *ctx)
{
#if defined(QT_OPENGL_ES_2)
@@ -62,30 +108,32 @@ bool qt_resolve_framebufferobject_extensions(QGLContext *ctx)
}
- glBlitFramebufferEXT = (_glBlitFramebufferEXT) ctx->getProcAddress(QLatin1String("glBlitFramebufferEXT"));
+ glBlitFramebufferEXT = (_glBlitFramebufferEXT) qt_gl_getProcAddressEXT(ctx, "glBlitFramebuffer");
glRenderbufferStorageMultisampleEXT =
- (_glRenderbufferStorageMultisampleEXT) ctx->getProcAddress(QLatin1String("glRenderbufferStorageMultisampleEXT"));
+ (_glRenderbufferStorageMultisampleEXT) qt_gl_getProcAddressEXT(ctx, "glRenderbufferStorageMultisample");
#if !defined(QT_OPENGL_ES_2)
- glIsRenderbuffer = (_glIsRenderbuffer) ctx->getProcAddress(QLatin1String("glIsRenderbufferEXT"));
- glBindRenderbuffer = (_glBindRenderbuffer) ctx->getProcAddress(QLatin1String("glBindRenderbufferEXT"));
- glDeleteRenderbuffers = (_glDeleteRenderbuffers) ctx->getProcAddress(QLatin1String("glDeleteRenderbuffersEXT"));
- glGenRenderbuffers = (_glGenRenderbuffers) ctx->getProcAddress(QLatin1String("glGenRenderbuffersEXT"));
- glRenderbufferStorage = (_glRenderbufferStorage) ctx->getProcAddress(QLatin1String("glRenderbufferStorageEXT"));
+ glIsRenderbuffer = (_glIsRenderbuffer) qt_gl_getProcAddressEXT(ctx, "glIsRenderbuffer");
+ if (!glIsRenderbuffer)
+ return false; // Not much point searching for anything else.
+ glBindRenderbuffer = (_glBindRenderbuffer) qt_gl_getProcAddressEXT(ctx, "glBindRenderbuffer");
+ glDeleteRenderbuffers = (_glDeleteRenderbuffers) qt_gl_getProcAddressEXT(ctx, "glDeleteRenderbuffers");
+ glGenRenderbuffers = (_glGenRenderbuffers) qt_gl_getProcAddressEXT(ctx, "glGenRenderbuffers");
+ glRenderbufferStorage = (_glRenderbufferStorage) qt_gl_getProcAddressEXT(ctx, "glRenderbufferStorage");
glGetRenderbufferParameteriv =
- (_glGetRenderbufferParameteriv) ctx->getProcAddress(QLatin1String("glGetRenderbufferParameterivEXT"));
- glIsFramebuffer = (_glIsFramebuffer) ctx->getProcAddress(QLatin1String("glIsFramebufferEXT"));
- glBindFramebuffer = (_glBindFramebuffer) ctx->getProcAddress(QLatin1String("glBindFramebufferEXT"));
- glDeleteFramebuffers = (_glDeleteFramebuffers) ctx->getProcAddress(QLatin1String("glDeleteFramebuffersEXT"));
- glGenFramebuffers = (_glGenFramebuffers) ctx->getProcAddress(QLatin1String("glGenFramebuffersEXT"));
- glCheckFramebufferStatus = (_glCheckFramebufferStatus) ctx->getProcAddress(QLatin1String("glCheckFramebufferStatusEXT"));
- glFramebufferTexture2D = (_glFramebufferTexture2D) ctx->getProcAddress(QLatin1String("glFramebufferTexture2DEXT"));
- glFramebufferRenderbuffer = (_glFramebufferRenderbuffer) ctx->getProcAddress(QLatin1String("glFramebufferRenderbufferEXT"));
+ (_glGetRenderbufferParameteriv) qt_gl_getProcAddressEXT(ctx, "glGetRenderbufferParameteriv");
+ glIsFramebuffer = (_glIsFramebuffer) qt_gl_getProcAddressEXT(ctx, "glIsFramebuffer");
+ glBindFramebuffer = (_glBindFramebuffer) qt_gl_getProcAddressEXT(ctx, "glBindFramebuffer");
+ glDeleteFramebuffers = (_glDeleteFramebuffers) qt_gl_getProcAddressEXT(ctx, "glDeleteFramebuffers");
+ glGenFramebuffers = (_glGenFramebuffers) qt_gl_getProcAddressEXT(ctx, "glGenFramebuffers");
+ glCheckFramebufferStatus = (_glCheckFramebufferStatus) qt_gl_getProcAddressEXT(ctx, "glCheckFramebufferStatus");
+ glFramebufferTexture2D = (_glFramebufferTexture2D) qt_gl_getProcAddressEXT(ctx, "glFramebufferTexture2D");
+ glFramebufferRenderbuffer = (_glFramebufferRenderbuffer) qt_gl_getProcAddressEXT(ctx, "glFramebufferRenderbuffer");
glGetFramebufferAttachmentParameteriv =
- (_glGetFramebufferAttachmentParameteriv) ctx->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivEXT"));
- glGenerateMipmap = (_glGenerateMipmap) ctx->getProcAddress(QLatin1String("glGenerateMipmapEXT"));
+ (_glGetFramebufferAttachmentParameteriv) qt_gl_getProcAddressEXT(ctx, "glGetFramebufferAttachmentParameteriv");
+ glGenerateMipmap = (_glGenerateMipmap) qt_gl_getProcAddressEXT(ctx, "glGenerateMipmap");
- return glIsRenderbuffer;
+ return glIsRenderbuffer != 0;
#else
return true;
#endif