From 313006adb81a859662cf25e86c6e1b3b98c5f6f0 Mon Sep 17 00:00:00 2001 From: Vasiliy Makarov Date: Wed, 16 Sep 2020 18:07:54 +0300 Subject: iOS: Fix multiple issues with PVRTC import, disable ETC1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: #28683, #28621, #28596 and maybe others For iOS we enable pvrtc feature by default for all backends Etc1 for iOS doesn't have any sense, so it disabled. Fixed checks in export editor. Fixed pvrtc encoding procedure. Edit by Akien: Forward-ported from #38076, this may not make sense as is for Godot 4.0, but it's important that we have the latest code in sync with 3.2 for when more rendering backends and proper iOS support are added back. Co-authored-by: Rémi Verschelde --- modules/pvr/texture_loader_pvr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 36c0913f62..050dce1aab 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -213,10 +213,12 @@ static void _compress_pvrtc4(Image *p_img) { int ofs, size, w, h; img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h); Javelin::RgbaBitmap bm(w, h); + void *dst = (void *)bm.GetData(); + copymem(dst, &r[ofs], size); + Javelin::ColorRgba *dp = bm.GetData(); for (int j = 0; j < size / 4; j++) { - Javelin::ColorRgba *dp = bm.GetData(); - /* red and Green colors are swapped. */ - new (dp) Javelin::ColorRgba(r[ofs + 4 * j + 2], r[ofs + 4 * j + 1], r[ofs + 4 * j], r[ofs + 4 * j + 3]); + /* red and blue colors are swapped. */ + SWAP(dp[j].r, dp[j].b); } new_img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h); Javelin::PvrTcEncoder::EncodeRgba4Bpp(&wr[ofs], bm); -- cgit v1.2.3