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.9 6.8
Change-Id: If6808069dfc9f3df124e508e40abf8c3423289da
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2025-02-26 15:30:20 +01:00 committed by Laszlo Agocs
parent efc911aa58
commit 25394fab9a

View File

@ -4519,7 +4519,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;