diff options
author | Juan Casafranca <juan.casafranca@kdab.com> | 2020-11-03 13:43:56 +0100 |
---|---|---|
committer | Juan José Casafranca <juan.casafranca@kdab.com> | 2020-11-03 14:26:54 +0100 |
commit | c7c84944d7111b837544e22fe5a0a4fe2a150aeb (patch) | |
tree | c0aa1bb3a06c2155d8c9f234c7362aef3fc91e2e | |
parent | 59387766853e64e70efb911772ea5dfe04ff5aad (diff) |
Check if texture upload is full sized
This allows to upload full sized compressed textures which was not
working before if using the TextureDataUpdate API
Pick-to: 5.15
Change-Id: Ic87e99e60e56d5a10550ca8efdc4f75a7ae1f0b1
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r-- | src/plugins/renderers/opengl/textures/gltexture.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/plugins/renderers/opengl/textures/gltexture.cpp b/src/plugins/renderers/opengl/textures/gltexture.cpp index 804b20656..5b5e09582 100644 --- a/src/plugins/renderers/opengl/textures/gltexture.cpp +++ b/src/plugins/renderers/opengl/textures/gltexture.cpp @@ -94,7 +94,7 @@ void uploadGLData(QOpenGLTexture *glTex, const QByteArray &bytes, const QTextureImageDataPtr &data) { if (data->isCompressed()) { - qWarning() << Q_FUNC_INFO << "Uploading non full sized Compressed Data not supported yet"; + Q_UNREACHABLE(); } else { const auto alignment = data->alignment(); QOpenGLPixelTransferOptions uploadOptions; @@ -602,11 +602,28 @@ void GLTexture::uploadGLTextureData() // layer, face or mip level, unlike the QTextureGenerator case where // they are in a single blob. Hence QTextureImageData::data() is not suitable. - uploadGLData(m_gl, - update.mipLevel(), update.layer(), - static_cast<QOpenGLTexture::CubeMapFace>(update.face()), - xOffset, yOffset, zOffset, - bytes, imgData); + // Check if this is a full sized update + if (xOffset == 0 && + yOffset == 0 && + zOffset == 0 && + xExtent == m_gl->width() && + yExtent == m_gl->height() && + zExtent == m_gl->depth()) { + uploadGLData(m_gl, update.mipLevel(), update.layer(), + static_cast<QOpenGLTexture::CubeMapFace>(update.face()), + bytes, imgData); + } else { + if (imgData->isCompressed()) { + qWarning() << Q_FUNC_INFO << "Uploading non full sized Compressed Data not supported yet"; + } else { + + uploadGLData(m_gl, + update.mipLevel(), update.layer(), + static_cast<QOpenGLTexture::CubeMapFace>(update.face()), + xOffset, yOffset, zOffset, + bytes, imgData); + } + } } } |