Build the core renderer before starting audio

This commit is contained in:
rdbtCVS
2026-10-17 23:50:46 +01:00
parent d9686faf35
commit a3cf97f2fa
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -11277,12 +11277,6 @@ impl Loading {
let mut options = self.options.take().ok_or("loading already finished")?;
options.resources = loaded.root.clone();
let gui = self.gui.take().ok_or("missing menu bundle")?;
// Audio is created on the main thread, after the core is ready.
let audio = if options.dedicated.is_some() {
Audio::silent(&options.resources)
} else {
Audio::new(&options.resources)
};
let window = self.window.clone().ok_or("window closed")?;
// Keep the loader's device and swap in the real textures in one step.
if let Some(renderer) = &mut self.renderer {
@@ -11299,6 +11293,12 @@ impl Loading {
"Horizon: world renderer ready after {} ms",
self.started.elapsed().as_millis()
);
// Audio is created on the main thread, after the core is ready.
let audio = if options.dedicated.is_some() {
Audio::silent(&options.resources)
} else {
Audio::new(&options.resources)
};
let pack_error = loaded.pack_error.or_else(|| self.pack_error.take());
// The game borrows its shared resources for the process's lifetime,
// like the single copy an integrated server would share.
+1 -1
View File
@@ -21,9 +21,9 @@ const CRASH_DETAILS: [&str; 3] = ["Horizon Version", "Graphics Adapter", "Render
static STARTED: OnceLock<Instant> = OnceLock::new();
/// When the menu bundle became ready, so the time to the title screen measures
/// the menu and not the world bundle loaded behind it.
static UI_READY_MS: AtomicU32 = AtomicU32::new(u32::MAX);
static CORE_READY_MS: AtomicU32 = AtomicU32::new(u32::MAX);
static REST_READY_MS: AtomicU32 = AtomicU32::new(u32::MAX);
static UI_READY_MS: AtomicU32 = AtomicU32::new(u32::MAX);
/// The GPU's name, driver and backend, once the renderer has its adapter.
static GPU: Mutex<Option<(String, String, String)>> = Mutex::new(None);