diff options
author | Vasiliy Makarov <drmoriarty.0@gmail.com> | 2020-09-16 18:07:54 +0300 |
---|---|---|
committer | Vasiliy Makarov <drmoriarty.0@gmail.com> | 2020-09-23 11:22:51 +0200 |
commit | 313006adb81a859662cf25e86c6e1b3b98c5f6f0 (patch) | |
tree | d0ded756b3bfaa6393b89ae641bfe55f1bdc5f2b /modules | |
parent | 78304b904ffd4816a3f2957fb3ddf2b20a13d66a (diff) |
iOS: Fix multiple issues with PVRTC import, disable ETC1
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 <rverschelde@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/pvr/texture_loader_pvr.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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<unsigned char> *dp = bm.GetData(); for (int j = 0; j < size / 4; j++) { - Javelin::ColorRgba<unsigned char> *dp = bm.GetData(); - /* red and Green colors are swapped. */ - new (dp) Javelin::ColorRgba<unsigned char>(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); |