opengl: fix creating compressed array textures with > 1 layer.

Fixes #1817.
This commit is contained in:
slime
2022-08-09 20:37:48 -03:00
parent 870021b8bd
commit 8495cefd3b
+4 -6
View File
@@ -116,16 +116,14 @@ void Image::loadData()
{
if (isCompressed() && (texType == TEXTURE_2D_ARRAY || texType == TEXTURE_VOLUME))
{
int mipslices = data.getSliceCount(mip);
size_t mipsize = 0;
if (texType == TEXTURE_2D_ARRAY || texType == TEXTURE_VOLUME)
{
for (int slice = 0; slice < data.getSliceCount(mip); slice++)
mipsize += data.get(slice, mip)->getSize();
}
for (int slice = 0; slice < mipslices; slice++)
mipsize += data.get(slice, mip)->getSize();
GLenum gltarget = OpenGL::getGLTextureType(texType);
glCompressedTexImage3D(gltarget, mip, fmt.internalformat, w, h, d, 0, mipsize, nullptr);
glCompressedTexImage3D(gltarget, mip, fmt.internalformat, w, h, mipslices, 0, mipsize, nullptr);
}
for (int slice = 0; slice < slicecount; slice++)