aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Nichols <nezticle@gmail.com>2022-08-08 17:01:10 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-08 19:48:28 +0000
commit31e234931c60bb78579440fa5cdea281107e497e (patch)
treec2693c4b9eabe5a344d4da72487f8dd48907877b
parente3b28942304a874e8275a5da3f093c0b0f9664d4 (diff)
Do not try to create unsupported compressed textures with Metal
The previous logic attempts to create the texture anyway and will handle it gracefuly if the texture creation fails, but trying to create an unsupported texture on Metal causes a validation failure, so now the code should bail out earily and print a warning instead for the Metal backend. Change-Id: I9cd8a4c4b15107f4a819cb108b578db9a7a4e643 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 28b919688ed989d73ba48892b4e010a422c398be) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
index 40f03e6b89..0e33312a9e 100644
--- a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
+++ b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
@@ -349,6 +349,12 @@ void QSGCompressedTexture::commitTextureOperations(QRhi *rhi, QRhiResourceUpdate
if (!rhi->isTextureFormatSupported(fmt.rhiFormat, texFlags)) {
qCDebug(QSG_LOG_TEXTUREIO, "Compressed texture format possibly unsupported: 0x%x",
m_textureData.glInternalFormat());
+ // For the Metal backend, don't even try to create an unsupported texture
+ // since trying to do so is invalid.
+ if (rhi->backend() == QRhi::Metal) {
+ qWarning("Unsupported compressed texture format 0x%x", m_textureData.glInternalFormat());
+ return;
+ }
}
m_texture = rhi->newTexture(fmt.rhiFormat, m_size, 1, texFlags);