mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 01:16:46 -04:00
renderer manager: enqueue async preparing directly after sync preparing and wait after all were enqueued.
Async renderers can now already complete their preparing when others are still preparing in their sync phase. This should reduce the frame time a bit. It can even be enhanced with some feedback/task scheduler (track what time it takes avg and queue that one first next frame or so).
This commit is contained in:
parent
88df92ce84
commit
13037f4e0a
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -96,16 +96,16 @@ class RendererManager(
|
||||
}
|
||||
|
||||
private fun prepare() {
|
||||
val latch = SimpleLatch(0)
|
||||
val worker = UnconditionalWorker(autoWork = true)
|
||||
|
||||
for (renderer in list) {
|
||||
renderer.prePrepareDraw()
|
||||
if (renderer is AsyncRenderer) {
|
||||
worker += UnconditionalTask(priority = ThreadPool.HIGHER) { renderer.prepareDrawAsync() }
|
||||
}
|
||||
}
|
||||
|
||||
val latch = SimpleLatch(0)
|
||||
val worker = UnconditionalWorker()
|
||||
for (renderer in list) {
|
||||
if (renderer !is AsyncRenderer) continue
|
||||
worker += UnconditionalTask(priority = ThreadPool.HIGHER) { renderer.prepareDrawAsync() }
|
||||
}
|
||||
worker.work(latch)
|
||||
|
||||
for (renderer in list) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user