diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2010-06-30 12:33:38 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2010-06-30 12:50:03 (GMT) |
commit | 3a2a6e8746b5076b5b7f496444479fa40067731c (patch) | |
tree | b52a159bea4dc1af1e859c19e79daeebb3c30488 /src/opengl | |
parent | 0ee2330ec237cf5baeabe4833fb8b6cad503fb7c (diff) | |
download | Qt-3a2a6e8746b5076b5b7f496444479fa40067731c.zip Qt-3a2a6e8746b5076b5b7f496444479fa40067731c.tar.gz Qt-3a2a6e8746b5076b5b7f496444479fa40067731c.tar.bz2 |
support BGRA textures on SGX
Reviewed-by: Samuel
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b4c85ac..adc3aa3 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2331,9 +2331,6 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G && target == GL_TEXTURE_2D && (options & QGLContext::MipmapBindOption)) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - generating mipmaps (%d ms)\n", time.elapsed()); -#endif #if !defined(QT_OPENGL_ES_2) glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); #ifndef QT_OPENGL_ES @@ -2347,6 +2344,9 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #endif glTexParameterf(target, GL_TEXTURE_MIN_FILTER, options & QGLContext::LinearFilteringBindOption ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - generating mipmaps (%d ms)\n", time.elapsed()); +#endif } else { glTexParameterf(target, GL_TEXTURE_MIN_FILTER, filtering); } @@ -2371,7 +2371,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G if (premul) { img = img.convertToFormat(target_format = QImage::Format_ARGB32_Premultiplied); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting ARGB32 -> ARGB32_Premultiplied (%d ms) \n", time.elapsed()); + printf(" - converted ARGB32 -> ARGB32_Premultiplied (%d ms) \n", time.elapsed()); #endif } break; @@ -2379,7 +2379,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G if (!premul) { img = img.convertToFormat(target_format = QImage::Format_ARGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting ARGB32_Premultiplied -> ARGB32 (%d ms)\n", time.elapsed()); + printf(" - converted ARGB32_Premultiplied -> ARGB32 (%d ms)\n", time.elapsed()); #endif } break; @@ -2396,20 +2396,17 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G ? QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting to 32-bit alpha format (%d ms)\n", time.elapsed()); + printf(" - converted to 32-bit alpha format (%d ms)\n", time.elapsed()); #endif } else { img = img.convertToFormat(QImage::Format_RGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting to 32-bit (%d ms)\n", time.elapsed()); + printf(" - converted to 32-bit (%d ms)\n", time.elapsed()); #endif } } if (options & QGLContext::InvertedYBindOption) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - flipping bits over y (%d ms)\n", time.elapsed()); -#endif if (img.isDetached()) { int ipl = img.bytesPerLine() / 4; int h = img.height(); @@ -2426,17 +2423,20 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G // data twice. This version should only do it once. img = img.mirrored(); } +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - flipped bits over y (%d ms)\n", time.elapsed()); +#endif } if (externalFormat == GL_RGBA) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - doing byte swapping (%d ms)\n", time.elapsed()); -#endif // The only case where we end up with a depth different from // 32 in the switch above is for the RGB16 case, where we set // the format to GL_RGB Q_ASSERT(img.depth() == 32); qgl_byteSwapImage(img, pixel_type); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - did byte swapping (%d ms)\n", time.elapsed()); +#endif } #ifdef QT_OPENGL_ES // OpenGL/ES requires that the internal and external formats be @@ -2465,7 +2465,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #ifdef QGL_BIND_TEXTURE_DEBUG static int totalUploadTime = 0; totalUploadTime += time.elapsed(); - printf(" - upload done in (%d ms) time=%d\n", time.elapsed(), totalUploadTime); + printf(" - upload done in %d ms, (accumulated: %d ms)\n", time.elapsed(), totalUploadTime); #endif @@ -5161,6 +5161,8 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= NVFloatBuffer; if (extensions.match("GL_ARB_pixel_buffer_object")) glExtensions |= PixelBufferObject; + if (extensions.match("GL_IMG_texture_format_BGRA8888")) + glExtensions |= BGRATextureFormat; #if defined(QT_OPENGL_ES_2) glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; |