From fb69590c814a542ada42f9a5564ff78a073968e4 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 26 Feb 2025 15:30:20 +0100 Subject: [PATCH] rhi: gl: Fix exposing 3D and array textures as load/store images The expectation, based on what the other backends do, is that all array layers and 3D texture slices are exposed (i.e., the whole texture). Same for cubemaps (all six faces), that at least was in place already. This is what the odd-named 'layered' argument of glBindImageTexture controls. Set it accordingly. Pick-to: 6.8 Change-Id: If6808069dfc9f3df124e508e40abf8c3423289da Reviewed-by: Andy Nichols (cherry picked from commit 25394fab9a3a501311601e45af310b3949dff2c6) Reviewed-by: Qt Cherry-pick Bot --- src/gui/rhi/qrhigles2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index a591adfa4bb..b76da0fc0ab 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -4463,7 +4463,10 @@ void QRhiGles2::bindShaderResources(QGles2CommandBuffer *cbD, { QGles2Texture *texD = QRHI_RES(QGles2Texture, b->u.simage.tex); Q_ASSERT(texD->m_flags.testFlag(QRhiTexture::UsedWithLoadStore)); - const bool layered = texD->m_flags.testFlag(QRhiTexture::CubeMap); + // arrays, cubemaps, and 3D textures expose the whole texture with all layers/slices + const bool layered = texD->m_flags.testFlag(QRhiTexture::CubeMap) + || texD->m_flags.testFlag(QRhiTexture::ThreeDimensional) + || texD->m_flags.testFlag(QRhiTexture::TextureArray); GLenum access = GL_READ_WRITE; if (b->type == QRhiShaderResourceBinding::ImageLoad) access = GL_READ_ONLY;