Set bind options before uploading to give hints to the driver
authorGunnar Sletta <gunnar.sletta@nokia.com>
Thu, 1 Mar 2012 11:34:48 +0000 (12:34 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 1 Mar 2012 12:26:10 +0000 (13:26 +0100)
This can prevent allocation of unused mipmap levels on some
drivers.

Change-Id: I2d730c04e120872367078b17a344c01b4d4aa87a
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/quick/scenegraph/util/qsgtexture.cpp

index 7ccedc4..4dff1b2 100644 (file)
@@ -496,6 +496,8 @@ void QSGPlainTexture::bind()
                  ? m_image
                  : m_image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
 
+    updateBindOptions(m_dirty_bind_options);
+
 #ifdef QT_OPENGL_ES
         swizzleBGRAToRGBA(&tmp);
         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmp.constBits());
@@ -512,7 +514,6 @@ void QSGPlainTexture::bind()
     m_texture_size = QSize(w, h);
     m_texture_rect = QRectF(0, 0, 1, 1);
 
-    updateBindOptions(m_dirty_bind_options);
     m_dirty_bind_options = false;
 }