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 <andy.nichols@qt.io>
(cherry picked from commit 25394fab9a3a501311601e45af310b3949dff2c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2025-02-26 15:30:20 +01:00 committed by Qt Cherry-pick Bot
parent ffc55b734d
commit fb69590c81

View File

@ -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;