Repository navigation
Conversation
…uring stalls (Fixes Revivedx#591)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Fixes #591.
In Alpha 5, inline pipeline links (
link_now) were introduced to link ready shader stage libraries (0.2 ms each withVK_EXT_graphics_pipeline_library) directly on the render thread up to a budget (SAVAGEWIND_PIPE_LINK_MS, default 3 ms per frame), queuing any remaining pipeline creations to the background worker pool to be skipped while building.However, for unskippable draws—such as one-shot targets (
one_shot_target(), which includes blur capture and texture targets drawn once when opening the pause/inventory menu) and terrain arrays (draw_must_happen()):link_nowreturnedfalseand queued the pipelines to the worker threads.if (atomic_load(&pp->state) == 0 && (one_shot_target() || draw_must_happen())) wait_built(&pp->state);.wait_built, stalling in awhile (atomic_load(state) == 0) SDL_Delay(1);loop for every single unskippable pipeline while workers slowly processed the queue. On setups where worker threads were busy or where hundreds of menu items queued, this caused a 5-to-10-second freeze every time TAB was pressed.This patch:
must_happen(one_shot_target() || draw_must_happen()) tolink_now(pp, must_happen). When a draw cannot be skipped anyway, it bypasses the 3 ms budget to link inline immediately in ~0.2 ms rather than queuing to a worker and then blocking the render thread on it.wait_built(), allows the calling thread (the render queue thread) to help execute pending build jobs fromjobs_head(job_run_one()) and spin briefly withexec_relax()before sleepingSDL_Delay(1). If the job being waited on is queued, it is executed immediately on the spot, completely eliminating the idle stall.How it was tested
make runtime-objs -j8compiled with 0 warnings or errors under MSYS2 UCRT64 / Clang.make test-pc-controls: PASSgit diff --check: PASSChecklist
testand opened againsttest