mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
[Web] Small fixes and enhancements.
- "Definitive" fix for ENOENT randomly disappearing from emscripten. - Proper shutdown when setup fails. - Re-enable WebGL explicit buffer swap. - Re-enable optional per-pixel transparency. - Add type cast to make closure compiler happy. - Remove emscripten Safari WebGL workaround. - Improve AudioWorklet cleanup.
This commit is contained in:
parent
c658fa8b77
commit
27f22b29f8
7 changed files with 51 additions and 11 deletions
|
|
@ -55,6 +55,18 @@ void cleanup_after_sync() {
|
|||
emscripten_set_main_loop(exit_callback, -1, false);
|
||||
}
|
||||
|
||||
void early_cleanup() {
|
||||
emscripten_cancel_main_loop(); // After this, we can exit!
|
||||
int exit_code = OS_Web::get_singleton()->get_exit_code();
|
||||
memdelete(os);
|
||||
os = nullptr;
|
||||
emscripten_force_exit(exit_code); // No matter that we call cancel_main_loop, regular "exit" will not work, forcing.
|
||||
}
|
||||
|
||||
void early_cleanup_sync() {
|
||||
emscripten_set_main_loop(early_cleanup, -1, false);
|
||||
}
|
||||
|
||||
void main_loop_callback() {
|
||||
uint64_t current_ticks = os->get_ticks_usec();
|
||||
|
||||
|
|
@ -87,7 +99,19 @@ extern EMSCRIPTEN_KEEPALIVE int godot_web_main(int argc, char *argv[]) {
|
|||
// We must override main when testing is enabled
|
||||
TEST_MAIN_OVERRIDE
|
||||
|
||||
Main::setup(argv[0], argc - 1, &argv[1]);
|
||||
Error err = Main::setup(argv[0], argc - 1, &argv[1]);
|
||||
|
||||
// Proper shutdown in case of setup failure.
|
||||
if (err != OK) {
|
||||
int exit_code = (int)err;
|
||||
if (err == ERR_HELP) {
|
||||
exit_code = 0; // Called with --help.
|
||||
}
|
||||
os->set_exit_code(exit_code);
|
||||
// Will only exit after sync.
|
||||
godot_js_os_finish_async(early_cleanup_sync);
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
// Ease up compatibility.
|
||||
ResourceLoader::set_abort_on_missing_resources(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue