mirror of https://github.com/godotengine/godot
fix compatibility gles3 driver load of compressed layered GL_TEXTURE_2D_ARRAY
This commit is contained in:
parent
bdc0316217
commit
07c15ef3c8
|
|
@ -1495,14 +1495,18 @@ void TextureStorage::_texture_set_data(RID p_texture, const Ref<Image> &p_image,
|
||||||
for (int i = 0; i < mipmaps; i++) {
|
for (int i = 0; i < mipmaps; i++) {
|
||||||
int size, ofs;
|
int size, ofs;
|
||||||
img->get_mipmap_offset_and_size(i, ofs, size);
|
img->get_mipmap_offset_and_size(i, ofs, size);
|
||||||
|
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
|
if (texture->target == GL_TEXTURE_2D_ARRAY) {
|
||||||
int bw = w;
|
if (p_initialize) {
|
||||||
int bh = h;
|
glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, i, internal_format, w, h, texture->layers, 0,
|
||||||
|
size * texture->layers, &read[ofs]);
|
||||||
glCompressedTexImage2D(blit_target, i, internal_format, bw, bh, 0, size, &read[ofs]);
|
} else {
|
||||||
|
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]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
if (texture->target == GL_TEXTURE_2D_ARRAY) {
|
if (texture->target == GL_TEXTURE_2D_ARRAY) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue