-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS: Fix multiple issues with PVRTC import, disable ETC1 #38076
Conversation
I'm not sure that it will work for master, so make PR for 3.2 branch. |
7f41407
to
02eda97
Compare
Loading textures on iOS using GLES2 is still an issue. Is there a plan to merge this fix? |
+1 this is a big one for my project. |
@akien-mga I have cherry picked it to our 3.2.2 fork and it does seem to fix the GLES2 loading resource issue in iOS |
bool resize_to_po2 = false; | ||
|
||
if (p_compress_mode == COMPRESS_VIDEO_RAM && p_force_po2_for_compressed && (p_mipmaps || p_texture_flags & Texture::FLAG_REPEAT)) { | ||
resize_to_po2 = true; | ||
f->store_16(next_power_of_2(p_image->get_width())); | ||
f->store_16(p_image->get_width()); | ||
f->store_16(next_power_of_2(p_image->get_height())); | ||
f->store_16(p_image->get_height()); | ||
} else { | ||
f->store_16(p_image->get_width()); | ||
f->store_16(0); | ||
f->store_16(p_image->get_height()); | ||
f->store_16(0); | ||
} | ||
f->store_32(p_texture_flags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the only changes I'm not confident with as they impact all formats, so I want @reduz to review this more closely.
The rest of the changes seem good though (with some obvious bugfixes like in drivers/gles2
or platform/iphone/export/export.cpp
), so I'd suggest splitting the texture importer change to a dedicated PR and remove it here, so that the rest can be merged first.
Pretty good changes overall, thanks for your work and sorry for the late review.
02eda97
to
70570c1
Compare
70570c1
to
90b7674
Compare
Rebased to remove the unrelated CHANGELOG conflict, and made the commit log a bit more explicit. Could you check if the issues referenced as fixed by this PR are still all fixed, or if some of them are fixed by #42118 instead (or only fixed once both are merged)? |
editor/editor_export.cpp
Outdated
|
||
String driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name"); | ||
bool driver_fallback = ProjectSettings::get_singleton()->get("rendering/quality/driver/fallback_to_gles2"); | ||
bool etc_supported = ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess etc_supported
is not relevant for iOS (and now disabled by platform/iphone/export/export.cpp
changes), so maybe it can be removed from the checks / error messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed an amend that removes the etc_supported
check.
@akien-mga |
Fixes: godotengine#28683, godotengine#28621, godotengine#28596 and maybe others For iOS we enable pvrtc feature by default for both GLES2/GLES3 Etc1 for iOS doesn't have any sense, so it disabled. Fixed checks in export editor. Fixed pvrtc ability detection in GLES2 driver. Fixed pvrtc encoding procedure.
90b7674
to
f388ea0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me. I can't really assess the modules/pvr/texture_loader_pvr.cpp
changes but I trust that you tested them and that they make things work as they should. The rest is 👍
Fixes: godotengine#28683, godotengine#28621, godotengine#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 godotengine#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 <[email protected]>
I forward-ported the relevant changes for the |
As most users dont go iOS out of the box, I think disabling PVRTC by default is likely the best idea, and only enable it if you are planning to export to iOS. |
@reduz this PR don't change default enabled compressed textures formats. So PVRTC will be disabled until user enabled it. |
Yes @reduz seems to have misinterpreted the code, this doesn't change the fact that PVRTC is off by default (but it should be toggled on if you want to target iOS with GLES2, just like ETC1 needs to be toggled on manually if you want to target Android with GLES2). |
Thanks! |
Fixes: godotengine#28683, godotengine#28621, godotengine#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 godotengine#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 <[email protected]>
and some other VRAM compression formats.
For iOS we enable pvrtc feature by default for both GLES2/GLES3
Etc1 for iOS doesn't have any sense, so it disabled.
Fixed checks in export editor.
Fixed pvrtc ability detection in GLES2 driver.
Fixed pvrtc encoding procedure.
Compressed stream texture now saves right image dimensions for every compression format.
Also it allows to compressor resize image on it's side to make it more optimized.
So ETC1 format becames smaller then before. Pvrtc format always saves square texture.
Bugsquad edit: closes #28683, closes #28621, closes #28596 and maybe others
For #38040 and #35851, the fix has been moved to #42118.