From 31e234931c60bb78579440fa5cdea281107e497e Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Mon, 8 Aug 2022 17:01:10 +0200 Subject: 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 (cherry picked from commit 28b919688ed989d73ba48892b4e010a422c398be) Reviewed-by: Qt Cherry-pick Bot --- src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- cgit v1.2.3