summaryrefslogtreecommitdiffstats
path: root/drivers/gles3
diff options
context:
space:
mode:
authorBlueCube3310 <53150244+BlueCube3310@users.noreply.github.com>2024-08-26 13:24:00 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-16 17:18:24 +0200
commit8e1d1a54fe9b44d7a509cb5ae52ee1e00e48e5ac (patch)
tree388c3d97d55b0412d0ecdb4aca8703cccd98c53b /drivers/gles3
parent99dde70ad39b8acecabca51cf80b2bfaa85cc44c (diff)
downloadredot-engine-8e1d1a54fe9b44d7a509cb5ae52ee1e00e48e5ac.tar.gz
Compatibility: Fix crash when initializing certain compressed layered textures
(cherry picked from commit e8b4568900c42544b79b3b17bfb80cd3f663021d)
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/storage/texture_storage.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp
index 3b1373c928..b074838ee8 100644
--- a/drivers/gles3/storage/texture_storage.cpp
+++ b/drivers/gles3/storage/texture_storage.cpp
@@ -1497,11 +1497,9 @@ void TextureStorage::_texture_set_data(RID p_texture, const Ref<Image> &p_image,
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
if (texture->target == GL_TEXTURE_2D_ARRAY) {
if (p_initialize) {
- glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, i, internal_format, w, h, texture->layers, 0,
- size * texture->layers, &read[ofs]);
- } else {
- glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, i, 0, 0, p_layer, w, h, 1, internal_format, size, &read[ofs]);
+ glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, i, internal_format, w, h, texture->layers, 0, size * texture->layers, nullptr);
}
+ glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, i, 0, 0, p_layer, w, h, 1, internal_format, size, &read[ofs]);
} else {
glCompressedTexImage2D(blit_target, i, internal_format, w, h, 0, size, &read[ofs]);
}