-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Fix crash on startup for Vulkan projects on Android #103144
base: master
Are you sure you want to change the base?
Fix crash on startup for Vulkan projects on Android #103144
Conversation
deb2621
to
1fa8c35
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.
Tested Android editor, seems to be working fine:
There's another direct property check (only controls export warning and was missing rendering_method
check):
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index f253e11ec5..ca637bfdb0 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -2540,7 +2540,9 @@ bool EditorExportPlatformIOS::has_valid_export_configuration(const Ref<EditorExp
}
}
- if (GLOBAL_GET("rendering/rendering_device/driver.ios") == "metal") {
+ String rendering_method = GLOBAL_GET("rendering/renderer/rendering_method.mobile");
+ String rendering_driver = GLOBAL_GET("rendering/rendering_device/driver.ios");
+ if ((rendering_method == "forward_plus" || rendering_method == "mobile") && (rendering_driver == "metal" || rendering_driver == "auto")) {
float version = p_preset->get("application/min_ios_version").operator String().to_float();
if (version < 14.0) {
err += TTR("Metal renderer require iOS 14+.") + "\n";
1fa8c35
to
0f9c81f
Compare
0f9c81f
to
eef740f
Compare
String rendering_method = GLOBAL_GET("rendering/renderer/rendering_method.mobile"); | ||
String rendering_driver = GLOBAL_GET("rendering/rendering_device/driver.ios"); | ||
if ((rendering_method == "forward_plus" || rendering_method == "mobile") && (rendering_driver == "metal" || rendering_driver == "auto")) { |
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.
Nice catch. This should also fix an unreported bug of not being able to export a gl_compatibility
project to iOS < 14 due to the default override for the (unused in this case) RenderingDevice driver being metal
.
Just noting another direct property check for the Windows exporter:
This one should still be fine as And for the record, direct references to the opengl driver also changed in #103026:
Those should be fine for now, but if we were to make |
eef740f
to
49874ff
Compare
These are OK for default templates, and currently we have no way to detect how a custom template was build. For custom templates, there are These check probably should not be there at all, since default templates do no include external libs. It was added at early stages of D3D12 and ANGLE support development when libraries were necessary. |
String rendering_method = GLOBAL_GET("rendering/renderer/rendering_method.mobile"); | ||
String rendering_driver = GLOBAL_GET("rendering/rendering_device/driver.android"); |
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.
This is still a bit unsafe btw, as there are other potential overrides that may conflict, e.g. a user could choose to set rendering/renderer/rendering_method.android
or rendering/rendering_device/driver.mobile
. It's not the default overrides we register but they can be added from the project settings. Not sure which one would take precedence.
They could also remove any .mobile
and .android
override and just have rendering/rendering_device/driver
as the sole source of truth.
This isn't necessarily something that can be fixed here, I'm just pointing out how brittle our system is.
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.
On the other hand, one thing we could simplify here: Vulkan is the only possible driver for RenderingDevice-based rendering methods. Or conversely, it's only if it's using GL Compatibility that it's not going to use Vulkan.
So all this could be simplified to:
bool EditorExportPlatformAndroid::_uses_vulkan() {
return GLOBAL_GET("rendering/renderer/rendering_method.mobile") != "gl_compatibility";
}
Still with the above caveat that there could be a .android
override or no override if users added/removed them, so this could still break.
I assume the code was written as an explicit check of Vulkan being enabled instead of Vulkan not being enabled to future proof / not make assumptions on future available rendering methods and drivers, which is probably a good idea.
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 think I have old PR to resolve this kind of overrides on export.
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.
The non-standard override is relevant for any project setting, not just these.
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.
#71542 export plugin code is obviously outdated (I'll update it for 4.5), but core part should be OK.
Also, it is documented to work only if a specific renderer value is set:
|
IMO, rendering driver settings should be explicitly set by the user. Instead of relying on
Rather than treating settings like |
The problem is macOS, which have different defaults for Intel and ARM. I guess we can do Instead of a single driver it might be better to change the whole system to the priority list where users can only change the preferred order of the drivers, instead of picking one. |
See #103197 for now which should go back to a known working state and still fix the main issues we have. |
In practice it shouldn't be a big issue though I think.
Yeah for 4.5 I believe we could explore in that direction. |
Fixes a regression introduced by #103026 that caused crash on Android when running Vulkan projects.
Fixes #103156