rhi: gl: Specify 3D textures with mipmaps correctly
When used with load/store, it is already correct due to using glTexStorage3D. On the other code path however, individually calling glTexImage3D for all the mip levels requires adjusting the depth for each level, as it is done for width and height. Pick-to: 6.9 6.8 Change-Id: I440cc10303687b686d78da4c614da4325840803a Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
ff7dfd7216
commit
efc911aa58
@ -5866,8 +5866,8 @@ bool QGles2Texture::create()
|
||||
rhiD->glTexImage1D(target, level, GLint(glintformat), mipSize.width(), 0,
|
||||
glformat, gltype, nullptr);
|
||||
}
|
||||
} else if (is3D || isArray) {
|
||||
const int layerCount = is3D ? qMax(1, m_depth) : qMax(0, m_arraySize);
|
||||
} else if (isArray) {
|
||||
const int layerCount = qMax(0, m_arraySize);
|
||||
if (hasMipMaps) {
|
||||
for (int level = 0; level != mipLevelCount; ++level) {
|
||||
const QSize mipSize = rhiD->q->sizeForMipLevel(level, size);
|
||||
@ -5878,6 +5878,19 @@ bool QGles2Texture::create()
|
||||
rhiD->f->glTexImage3D(target, 0, GLint(glintformat), size.width(), size.height(), layerCount,
|
||||
0, glformat, gltype, nullptr);
|
||||
}
|
||||
} else if (is3D) {
|
||||
if (hasMipMaps) {
|
||||
const int depth = qMax(1, m_depth);
|
||||
for (int level = 0; level != mipLevelCount; ++level) {
|
||||
const QSize mipSize = rhiD->q->sizeForMipLevel(level, size);
|
||||
const int mipDepth = rhiD->q->sizeForMipLevel(level, QSize(depth, depth)).width();
|
||||
rhiD->f->glTexImage3D(target, level, GLint(glintformat), mipSize.width(), mipSize.height(), mipDepth,
|
||||
0, glformat, gltype, nullptr);
|
||||
}
|
||||
} else {
|
||||
rhiD->f->glTexImage3D(target, 0, GLint(glintformat), size.width(), size.height(), qMax(1, m_depth),
|
||||
0, glformat, gltype, nullptr);
|
||||
}
|
||||
} else if (hasMipMaps || isCube) {
|
||||
const GLenum faceTargetBase = isCube ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : target;
|
||||
for (int layer = 0, layerCount = isCube ? 6 : 1; layer != layerCount; ++layer) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user