summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-08-04 07:57:46 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-08-04 07:57:46 (GMT)
commit0857745f8cb6a26528cecd6e07f0d9267fc75ac6 (patch)
tree3ee31f4755292a0077e10d723804491f2ba794d3 /src/opengl
parent1a1b2af1ce2cf9acfda80947f04718a7dc2fff35 (diff)
parent4fb3beaf326384cd85c159ceecd31a625913dcbb (diff)
downloadQt-0857745f8cb6a26528cecd6e07f0d9267fc75ac6.zip
Qt-0857745f8cb6a26528cecd6e07f0d9267fc75ac6.tar.gz
Qt-0857745f8cb6a26528cecd6e07f0d9267fc75ac6.tar.bz2
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-symbian-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-symbian-team: (217 commits) Fixed compile error in qwindowsurface_qws.cpp. Fixed regression introduced by 5842d19cf3dff37a85c. Remove DerivedSources.pro from WebKit. Support debuggable in the makefile build system QLabel documentation: add warning about sanitizing input runonphone: fix failure to terminate Fix license headers in new files from coda patch runonphone: command line args improperly passed to TRK after CODA patch Mark all Symbian debug binaries debuggable by default Preventing QSoftkeyManager giving false positive memory leaks Detect linked fonts by name (insead of via CLinkedTypeface* Api) Fixed memory leak in QMessageBox::setInformativeText in Symbian Revert "fix QFileInfo::isSymLink() for NTFS mount points" Fix typo for ifdef QT_NO_ACCESSIBILITY Call QAccessible::updateAccessibility when a widget is deleted Fix gamma corrected source color in GL Make macdeployqt more robust against usage of symbolic links. Memory leak fix in Symbian open file dialog Revert binary search in QTextEngine::findItem Runonphone with CODA support ...
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp198
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h10
-rw-r--r--src/opengl/qgl_qpa.cpp6
-rw-r--r--src/opengl/qglbuffer.cpp4
-rw-r--r--src/opengl/qglextensions.cpp33
-rw-r--r--src/opengl/qglextensions_p.h4
-rw-r--r--src/opengl/qpixmapdata_symbiangl.cpp4
7 files changed, 201 insertions, 58 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 52450b6..dbbb07c 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -90,10 +90,9 @@
QT_BEGIN_NAMESPACE
-inline static bool isPowerOfTwo(int x)
+inline static bool isPowerOfTwo(uint x)
{
- // Assumption: x >= 1
- return x == (x & -x);
+ return x && !(x & (x - 1));
}
#if defined(Q_WS_WIN)
@@ -248,16 +247,13 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
QGLTexture *tex = ctx->d_func()->bindTexture(currentBrushPixmap, GL_TEXTURE_2D, GL_RGBA,
QGLContext::InternalBindOption |
QGLContext::CanFlipNativePixmapBindOption);
-#if !defined(QT_NO_DEBUG) && defined(QT_OPENGL_ES_2)
- QGLFunctions funcs(QGLContext::currentContext());
- bool npotSupported = funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures);
- bool isNpot = !isPowerOfTwo(currentBrushPixmap.size().width())
- || !isPowerOfTwo(currentBrushPixmap.size().height());
- if (isNpot && !npotSupported) {
- qWarning("GL2 Paint Engine: This system does not support the REPEAT wrap mode for non-power-of-two textures.");
- }
+ GLenum wrapMode = GL_REPEAT;
+#ifdef QT_OPENGL_ES_2
+ // should check for GL_OES_texture_npot or GL_IMG_texture_npot extension
+ if (!isPowerOfTwo(currentBrushPixmap.width()) || !isPowerOfTwo(currentBrushPixmap.height()))
+ wrapMode = GL_CLAMP_TO_EDGE;
#endif
- updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform);
+ updateTextureFilter(GL_TEXTURE_2D, wrapMode, q->state()->renderHints & QPainter::SmoothPixmapTransform);
textureInvertedY = tex->options & QGLContext::InvertedYBindOption ? -1 : 1;
}
brushTextureDirty = false;
@@ -655,7 +651,7 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
if (newMode == mode)
return;
- if (mode == TextDrawingMode || mode == ImageDrawingMode || mode == ImageArrayDrawingMode) {
+ if (mode == TextDrawingMode || imageDrawingMode) {
lastTextureUsed = GLuint(-1);
}
@@ -665,14 +661,21 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
shaderManager->setHasComplexGeometry(false);
}
+ imageDrawingMode = false;
+
if (newMode == ImageDrawingMode) {
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray);
setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray);
+ imageDrawingMode = true;
}
- if (newMode == ImageArrayDrawingMode) {
+ if (newMode == ImageArrayDrawingMode || newMode == ImageArrayWithOpacityDrawingMode) {
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data());
setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data());
+ imageDrawingMode = true;
+ }
+
+ if (newMode == ImageArrayWithOpacityDrawingMode) {
setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data());
}
@@ -1100,7 +1103,7 @@ void QGL2PaintEngineExPrivate::resetClipIfNeeded()
bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
{
- if (brushTextureDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode)
+ if (brushTextureDirty && !imageDrawingMode)
updateBrushTexture();
if (compositionModeDirty)
@@ -1120,12 +1123,12 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
}
QGLEngineShaderManager::OpacityMode opacityMode;
- if (mode == ImageArrayDrawingMode) {
+ if (mode == ImageArrayWithOpacityDrawingMode) {
opacityMode = QGLEngineShaderManager::AttributeOpacity;
} else {
opacityMode = stateHasOpacity ? QGLEngineShaderManager::UniformOpacity
: QGLEngineShaderManager::NoOpacity;
- if (stateHasOpacity && (mode != ImageDrawingMode)) {
+ if (stateHasOpacity && !imageDrawingMode) {
// Using a brush
bool brushIsPattern = (currentBrush.style() >= Qt::Dense1Pattern) &&
(currentBrush.style() <= Qt::DiagCrossPattern);
@@ -1145,7 +1148,7 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
matrixUniformDirty = true;
}
- if (brushUniformsDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode)
+ if (brushUniformsDirty && !imageDrawingMode)
updateBrushUniforms();
if (opacityMode == QGLEngineShaderManager::UniformOpacity && opacityUniformDirty) {
@@ -1577,6 +1580,11 @@ static bool fontSmoothingApproximately(qreal target)
}
#endif
+static inline qreal qt_sRGB_to_linear_RGB(qreal f)
+{
+ return f > 0.04045 ? qPow((f + 0.055) / 1.055, 2.4) : f / 12.92;
+}
+
// #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO
void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType,
@@ -1696,6 +1704,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
}
int numGlyphs = vertexCoordinates->vertexCount() / 4;
+ if (numGlyphs == 0)
+ return;
if (elementIndices.size() < numGlyphs*6) {
Q_ASSERT(elementIndices.size() % 6 == 0);
@@ -1734,12 +1744,34 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
}
QBrush pensBrush = q->state()->pen.brush();
- setBrush(pensBrush);
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ bool srgbFrameBufferEnabled = false;
+ if (pensBrush.style() == Qt::SolidPattern &&
+ (ctx->d_ptr->extension_flags & QGLExtensions::SRGBFrameBuffer)) {
+#if defined(Q_WS_MAC)
+ if (glyphType == QFontEngineGlyphCache::Raster_RGBMask)
+#elif defined(Q_WS_WIN)
+ if (glyphType != QFontEngineGlyphCache::Raster_RGBMask || fontSmoothingApproximately(2.1))
+#else
+ if (false)
+#endif
+ {
+ QColor c = pensBrush.color();
+ qreal red = qt_sRGB_to_linear_RGB(c.redF());
+ qreal green = qt_sRGB_to_linear_RGB(c.greenF());
+ qreal blue = qt_sRGB_to_linear_RGB(c.blueF());
+ c = QColor::fromRgbF(red, green, blue, c.alphaF());
+ pensBrush.setColor(c);
+
+ glEnable(FRAMEBUFFER_SRGB_EXT);
+ srgbFrameBufferEnabled = true;
+ }
+ }
- // Subpixel antialiasing without gamma correction
+ setBrush(pensBrush);
+ if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ // Subpixel antialiasing with gamma correction
QPainter::CompositionMode compMode = q->state()->composition_mode;
Q_ASSERT(compMode == QPainter::CompositionMode_Source
|| compMode == QPainter::CompositionMode_SourceOver);
@@ -1846,21 +1878,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
}
}
- bool srgbFrameBufferEnabled = false;
- if (ctx->d_ptr->extension_flags & QGLExtensions::SRGBFrameBuffer) {
-#if defined(Q_WS_MAC)
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask)
-#elif defined(Q_WS_WIN)
- if (glyphType != QFontEngineGlyphCache::Raster_RGBMask || fontSmoothingApproximately(2.1))
-#else
- if (false)
-#endif
- {
- glEnable(FRAMEBUFFER_SRGB_EXT);
- srgbFrameBufferEnabled = true;
- }
- }
-
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
@@ -1883,23 +1900,46 @@ void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *frag
return;
}
+ QSize size = pixmap.size();
+
ensureActive();
int max_texture_size = d->ctx->d_func()->maxTextureSize();
- if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) {
+ if (size.width() > max_texture_size || size.height() > max_texture_size) {
QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
- d->drawPixmapFragments(fragments, fragmentCount, scaled, hints);
+ d->drawPixmapFragments(fragments, fragmentCount, scaled, size, hints);
} else {
- d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
+ d->drawPixmapFragments(fragments, fragmentCount, pixmap, size, hints);
}
}
+void QGL2PaintEngineEx::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap,
+ QPainter::PixmapFragmentHints hints)
+{
+ Q_D(QGL2PaintEngineEx);
+ // Use fallback for extended composition modes.
+ if (state()->composition_mode > QPainter::CompositionMode_Plus) {
+ QPaintEngineEx::drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, hints);
+ return;
+ }
+
+ QSize size = pixmap.size();
+
+ ensureActive();
+ int max_texture_size = d->ctx->d_func()->maxTextureSize();
+ if (size.width() > max_texture_size || size.height() > max_texture_size) {
+ QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
+ d->drawPixmapFragments(targetRects, sourceRects, fragmentCount, scaled, size, hints);
+ } else {
+ d->drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, size, hints);
+ }
+}
void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragment *fragments,
int fragmentCount, const QPixmap &pixmap,
- QPainter::PixmapFragmentHints hints)
+ const QSize &size, QPainter::PixmapFragmentHints hints)
{
- GLfloat dx = 1.0f / pixmap.size().width();
- GLfloat dy = 1.0f / pixmap.size().height();
+ GLfloat dx = 1.0f / size.width();
+ GLfloat dy = 1.0f / size.height();
vertexCoordinateArray.clear();
textureCoordinateArray.clear();
@@ -1960,7 +2000,7 @@ void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragmen
data[i].y = 1 - data[i].y;
}
- transferMode(ImageArrayDrawingMode);
+ transferMode(allOpaque ? ImageArrayDrawingMode : ImageArrayWithOpacityDrawingMode);
bool isBitmap = pixmap.isQBitmap();
bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque;
@@ -1983,6 +2023,77 @@ void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragmen
glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount);
}
+void QGL2PaintEngineExPrivate::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount,
+ const QPixmap &pixmap, const QSize &size,
+ QPainter::PixmapFragmentHints hints)
+{
+ GLfloat dx = 1.0f / size.width();
+ GLfloat dy = 1.0f / size.height();
+
+ vertexCoordinateArray.clear();
+ textureCoordinateArray.clear();
+
+ if (snapToPixelGrid) {
+ snapToPixelGrid = false;
+ matrixDirty = true;
+ }
+
+ for (int i = 0; i < fragmentCount; ++i) {
+ vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].bottom());
+ vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].top());
+ vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].top());
+ vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].top());
+ vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].bottom());
+ vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].bottom());
+
+ QRectF sourceRect = sourceRects ? sourceRects[i] : QRectF(0, 0, size.width(), size.height());
+
+ QGLRect src(sourceRect.left() * dx, sourceRect.top() * dy,
+ sourceRect.right() * dx, sourceRect.bottom() * dy);
+
+ textureCoordinateArray.addVertex(src.right, src.bottom);
+ textureCoordinateArray.addVertex(src.right, src.top);
+ textureCoordinateArray.addVertex(src.left, src.top);
+ textureCoordinateArray.addVertex(src.left, src.top);
+ textureCoordinateArray.addVertex(src.left, src.bottom);
+ textureCoordinateArray.addVertex(src.right, src.bottom);
+ }
+
+ glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
+ QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA,
+ QGLContext::InternalBindOption
+ | QGLContext::CanFlipNativePixmapBindOption);
+
+ if (texture->options & QGLContext::InvertedYBindOption) {
+ // Flip texture y-coordinate.
+ QGLPoint *data = textureCoordinateArray.data();
+ for (int i = 0; i < 6 * fragmentCount; ++i)
+ data[i].y = 1 - data[i].y;
+ }
+
+ transferMode(ImageArrayDrawingMode);
+
+ bool isBitmap = pixmap.isQBitmap();
+ bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint));
+
+ updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
+ q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id);
+
+ // Setup for texture drawing
+ currentBrush = noBrush;
+ shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc
+ : QGLEngineShaderManager::ImageSrc);
+ if (prepareForDraw(isOpaque))
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
+
+ if (isBitmap) {
+ QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col);
+ }
+
+ glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount);
+}
+
bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
{
Q_D(QGL2PaintEngineEx);
@@ -2003,6 +2114,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->width = sz.width();
d->height = sz.height();
d->mode = BrushDrawingMode;
+ d->imageDrawingMode = false;
d->brushTextureDirty = true;
d->brushUniformsDirty = true;
d->matrixUniformDirty = true;
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 2895d5a..80daf63 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -68,7 +68,8 @@ enum EngineMode {
ImageDrawingMode,
TextDrawingMode,
BrushDrawingMode,
- ImageArrayDrawingMode
+ ImageArrayDrawingMode,
+ ImageArrayWithOpacityDrawingMode
};
QT_BEGIN_NAMESPACE
@@ -126,6 +127,8 @@ public:
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
QPainter::PixmapFragmentHints hints);
+ virtual void drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap,
+ QPainter::PixmapFragmentHints hints);
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
Qt::ImageConversionFlags flags = Qt::AutoColor);
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
@@ -202,7 +205,9 @@ public:
void fill(const QVectorPath &path);
void stroke(const QVectorPath &path, const QPen &pen);
void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false);
- void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
+ void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, const QSize &size,
+ QPainter::PixmapFragmentHints hints);
+ void drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, const QSize &size,
QPainter::PixmapFragmentHints hints);
void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem);
@@ -255,6 +260,7 @@ public:
int width, height;
QGLContext *ctx;
EngineMode mode;
+ bool imageDrawingMode;
QFontEngineGlyphCache::Type glyphCacheType;
// Dirty flags
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 9ba8b75..518c860 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -53,6 +53,8 @@
QT_BEGIN_NAMESPACE
/*!
+ \since 4.8
+
Returns an OpenGL format for the platform window format specified by \a format.
*/
QGLFormat QGLFormat::fromPlatformWindowFormat(const QPlatformWindowFormat &format)
@@ -87,6 +89,8 @@ QGLFormat QGLFormat::fromPlatformWindowFormat(const QPlatformWindowFormat &forma
}
/*!
+ \since 4.8
+
Returns a platform window format for the OpenGL format specified by \a format.
*/
QPlatformWindowFormat QGLFormat::toPlatformWindowFormat(const QGLFormat &format)
@@ -387,6 +391,8 @@ QGLContext::QGLContext(QPlatformGLContext *platformContext)
}
/*!
+ \since 4.8
+
Returns a OpenGL context for the platform-specific OpenGL context given by
\a platformContext.
*/
diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp
index a1ec3ef..b5c6b83 100644
--- a/src/opengl/qglbuffer.cpp
+++ b/src/opengl/qglbuffer.cpp
@@ -543,6 +543,10 @@ void *QGLBuffer::map(QGLBuffer::Access access)
return 0;
if (!glMapBufferARB)
return 0;
+#ifdef QT_OPENGL_ES_2
+ if (access != QGLBuffer::WriteOnly)
+ return 0;
+#endif
return glMapBufferARB(d->type, access);
}
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index 98d2960..64f7526 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -191,23 +191,30 @@ bool qt_resolve_frag_program_extensions(QGLContext *ctx)
bool qt_resolve_buffer_extensions(QGLContext *ctx)
{
+ if (!QGLContextPrivate::extensionFuncs(ctx).qt_bufferFuncsResolved) {
#if defined(QGL_RESOLVE_BUFFER_FUNCS)
- if (glBindBuffer && glDeleteBuffers && glGenBuffers && glBufferData
- && glBufferSubData && glGetBufferParameteriv)
- return true;
+ glBindBuffer = (_glBindBuffer) qt_gl_getProcAddressARB(ctx, "glBindBuffer");
+ glDeleteBuffers = (_glDeleteBuffers) qt_gl_getProcAddressARB(ctx, "glDeleteBuffers");
+ glGenBuffers = (_glGenBuffers) qt_gl_getProcAddressARB(ctx, "glGenBuffers");
+ glBufferData = (_glBufferData) qt_gl_getProcAddressARB(ctx, "glBufferData");
+ glBufferSubData = (_glBufferSubData) qt_gl_getProcAddressARB(ctx, "glBufferSubData");
+ glGetBufferSubData = (_glGetBufferSubData) qt_gl_getProcAddressARB(ctx, "glGetBufferSubData");
+ glGetBufferParameteriv = (_glGetBufferParameteriv) qt_gl_getProcAddressARB(ctx, "glGetBufferParameteriv");
#endif
-#if defined(QGL_RESOLVE_BUFFER_FUNCS)
- glBindBuffer = (_glBindBuffer) qt_gl_getProcAddressARB(ctx, "glBindBuffer");
- glDeleteBuffers = (_glDeleteBuffers) qt_gl_getProcAddressARB(ctx, "glDeleteBuffers");
- glGenBuffers = (_glGenBuffers) qt_gl_getProcAddressARB(ctx, "glGenBuffers");
- glBufferData = (_glBufferData) qt_gl_getProcAddressARB(ctx, "glBufferData");
- glBufferSubData = (_glBufferSubData) qt_gl_getProcAddressARB(ctx, "glBufferSubData");
- glGetBufferSubData = (_glGetBufferSubData) qt_gl_getProcAddressARB(ctx, "glGetBufferSubData");
- glGetBufferParameteriv = (_glGetBufferParameteriv) qt_gl_getProcAddressARB(ctx, "glGetBufferParameteriv");
+#ifdef QT_OPENGL_ES_2
+ QGLExtensionMatcher extensions;
+ if (extensions.match("GL_OES_mapbuffer")) {
+ glMapBufferARB = (_glMapBufferARB) qt_gl_getProcAddressARB(ctx, "glMapBufferOES");
+ glUnmapBufferARB = (_glUnmapBufferARB) qt_gl_getProcAddressARB(ctx, "glUnmapBufferOES");
+ }
+#else
+ glMapBufferARB = (_glMapBufferARB) qt_gl_getProcAddressARB(ctx, "glMapBuffer");
+ glUnmapBufferARB = (_glUnmapBufferARB) qt_gl_getProcAddressARB(ctx, "glUnmapBuffer");
#endif
- glMapBufferARB = (_glMapBufferARB) qt_gl_getProcAddressARB(ctx, "glMapBuffer");
- glUnmapBufferARB = (_glUnmapBufferARB) qt_gl_getProcAddressARB(ctx, "glUnmapBuffer");
+
+ QGLContextPrivate::extensionFuncs(ctx).qt_bufferFuncsResolved = true;
+ }
#if defined(QGL_RESOLVE_BUFFER_FUNCS)
return glBindBuffer
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index 98433c3..f85c89b 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -332,6 +332,8 @@ struct QGLExtensionFuncs
qt_glMapBufferARB = 0;
qt_glUnmapBufferARB = 0;
+ qt_bufferFuncsResolved = false;
+
qt_glProgramParameteriEXT = 0;
qt_glFramebufferTextureEXT = 0;
qt_glFramebufferTextureLayerEXT = 0;
@@ -457,6 +459,8 @@ struct QGLExtensionFuncs
_glMapBufferARB qt_glMapBufferARB;
_glUnmapBufferARB qt_glUnmapBufferARB;
+ bool qt_bufferFuncsResolved;
+
// Geometry shaders...
_glProgramParameteriEXT qt_glProgramParameteriEXT;
_glFramebufferTextureEXT qt_glFramebufferTextureEXT;
diff --git a/src/opengl/qpixmapdata_symbiangl.cpp b/src/opengl/qpixmapdata_symbiangl.cpp
index 78e5ee7..a7e33e2 100644
--- a/src/opengl/qpixmapdata_symbiangl.cpp
+++ b/src/opengl/qpixmapdata_symbiangl.cpp
@@ -142,6 +142,7 @@ QGLPixmapData::QGLPixmapData(PixelType type)
QGLPixmapData::~QGLPixmapData()
{
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
if (m_sgImage) {
if (m_texture.id) {
QGLSgImageTextureCleanup::cleanupForContext(m_ctx)->remove(m_texture.id);
@@ -152,6 +153,7 @@ QGLPixmapData::~QGLPixmapData()
delete m_sgImage;
m_sgImage = 0;
}
+#endif
delete m_engine;
}
@@ -668,6 +670,7 @@ static inline bool knownGoodFormat(QImage::Format format)
}
}
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
static inline int symbianPixeFormatBitsPerPixel(TUidPixelFormat pixelFormat)
{
switch (pixelFormat) {
@@ -719,6 +722,7 @@ static inline int symbianPixeFormatBitsPerPixel(TUidPixelFormat pixelFormat)
return 32;
};
}
+#endif
void QGLPixmapData::fromNativeType(void* pixmap, NativeType type)
{