1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +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:
Fabio Alessandrelli
2022-09-08 09:44:14 +02:00
parent c658fa8b77
commit 27f22b29f8
7 changed files with 51 additions and 11 deletions

View File

@@ -133,6 +133,8 @@ class GodotProcessor extends AudioWorkletProcessor {
this.running = false;
this.output = null;
this.input = null;
this.lock = null;
this.notifier = null;
} else if (p_cmd === 'start_nothreads') {
this.output = new RingBuffer(p_data[0], p_data[0].length, false);
} else if (p_cmd === 'chunk') {

View File

@@ -339,16 +339,21 @@ const GodotAudioWorklet = {
if (GodotAudioWorklet.promise === null) {
return;
}
GodotAudioWorklet.promise.then(function () {
const p = GodotAudioWorklet.promise;
p.then(function () {
GodotAudioWorklet.worklet.port.postMessage({
'cmd': 'stop',
'data': null,
});
GodotAudioWorklet.worklet.disconnect();
GodotAudioWorklet.worklet.port.onmessage = null;
GodotAudioWorklet.worklet = null;
GodotAudioWorklet.promise = null;
resolve();
}).catch(function (err) { /* aborted? */ });
}).catch(function (err) {
// Aborted?
GodotRuntime.error(err);
});
});
},
},

View File

@@ -106,12 +106,14 @@ autoAddDeps(GodotConfig, '$GodotConfig');
mergeInto(LibraryManager.library, GodotConfig);
const GodotFS = {
$GodotFS__deps: ['$ERRNO_CODES', '$FS', '$IDBFS', '$GodotRuntime'],
$GodotFS__deps: ['$FS', '$IDBFS', '$GodotRuntime'],
$GodotFS__postset: [
'Module["initFS"] = GodotFS.init;',
'Module["copyToFS"] = GodotFS.copy_to_fs;',
].join(''),
$GodotFS: {
// ERRNO_CODES works every odd version of emscripten, but this will break too eventually.
ENOENT: 44,
_idbfs: false,
_syncing: false,
_mount_points: [],
@@ -138,8 +140,9 @@ const GodotFS = {
try {
FS.stat(dir);
} catch (e) {
if (e.errno !== ERRNO_CODES.ENOENT) {
throw e;
if (e.errno !== GodotFS.ENOENT) {
// Let mkdirTree throw in case, we cannot trust the above check.
GodotRuntime.error(e);
}
FS.mkdirTree(dir);
}
@@ -208,8 +211,9 @@ const GodotFS = {
try {
FS.stat(dir);
} catch (e) {
if (e.errno !== ERRNO_CODES.ENOENT) {
throw e;
if (e.errno !== GodotFS.ENOENT) {
// Let mkdirTree throw in case, we cannot trust the above check.
GodotRuntime.error(e);
}
FS.mkdirTree(dir);
}