mirror of https://github.com/godotengine/godot
Betsy: Fix stack-use-after-scope when using BC3 and BC5
This commit is contained in:
parent
fafc07335b
commit
b447eaa6a8
|
|
@ -545,7 +545,7 @@ Error BetsyCompressor::_compress(BetsyFormat p_format, Image *r_img) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RID *dst_texture_rid = &dst_texture_primary;
|
RID dst_texture_rid = dst_texture_primary;
|
||||||
|
|
||||||
if (needs_alpha_block) {
|
if (needs_alpha_block) {
|
||||||
// Set the destination texture width and size.
|
// Set the destination texture width and size.
|
||||||
|
|
@ -638,21 +638,21 @@ Error BetsyCompressor::_compress(BetsyFormat p_format, Image *r_img) {
|
||||||
compress_rd->sync();
|
compress_rd->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
dst_texture_rid = &dst_texture_combined;
|
dst_texture_rid = dst_texture_combined;
|
||||||
|
|
||||||
compress_rd->free(dst_texture_primary);
|
compress_rd->free(dst_texture_primary);
|
||||||
compress_rd->free(dst_texture_alpha);
|
compress_rd->free(dst_texture_alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy data from the GPU to the buffer.
|
// Copy data from the GPU to the buffer.
|
||||||
const Vector<uint8_t> texture_data = compress_rd->texture_get_data(*dst_texture_rid, 0);
|
const Vector<uint8_t> texture_data = compress_rd->texture_get_data(dst_texture_rid, 0);
|
||||||
int64_t dst_ofs = Image::get_image_mipmap_offset(r_img->get_width(), r_img->get_height(), dest_format, i);
|
int64_t dst_ofs = Image::get_image_mipmap_offset(r_img->get_width(), r_img->get_height(), dest_format, i);
|
||||||
|
|
||||||
memcpy(dst_data_ptr + dst_ofs, texture_data.ptr(), texture_data.size());
|
memcpy(dst_data_ptr + dst_ofs, texture_data.ptr(), texture_data.size());
|
||||||
|
|
||||||
// Free the source and dest texture.
|
// Free the source and dest texture.
|
||||||
compress_rd->free(src_texture);
|
compress_rd->free(src_texture);
|
||||||
compress_rd->free(*dst_texture_rid);
|
compress_rd->free(dst_texture_rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
src_images.clear();
|
src_images.clear();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue