mirror of
https://github.com/DoubleGhosty/cool_fox.git
synced 2026-12-06 09:18:36 +00:00
Pipelines: a dispatch waits for its compute pipeline until it is made (VICTORY_PIPELINE_COMPUTE_WAIT=0: within the frame's budget, as before) (#1312)
A dropped draw is drawn again in the next frame; a dropped dispatch may not be. In the prison corridor a compute program met for the first time took 4.4 s to make on a 16 GB machine; its one dispatch was dropped after the half second of budget, and the room's windows from before stayed blended over the whole picture for minutes (run 195). Co-authored-by: Exopus <230622659+Exopus-0x65f7ad0@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -267,10 +267,11 @@ pub(crate) fn ready(p: &Arc<Pending>) -> Option<&HostPipeline> {
|
||||
let age_at_request = p.made.get().is_none().then(|| p.created_at.elapsed().as_millis() as u64);
|
||||
if age_at_request.is_some() {
|
||||
start(p, REQUESTED);
|
||||
if p.required_initialization {
|
||||
if p.required_initialization || (p.graphics.is_none() && compute_waits()) {
|
||||
// OnceLock waits for a worker already compiling this pipeline,
|
||||
// or compiles it here if workers have not taken it yet. The
|
||||
// ordinary shared frame budget cannot discard a one-time write.
|
||||
// ordinary shared frame budget cannot discard a one-time write
|
||||
// or a compute dispatch.
|
||||
p.make();
|
||||
} else {
|
||||
wait(p, crate::frame::current());
|
||||
@ -296,6 +297,26 @@ pub(crate) fn ready(p: &Arc<Pending>) -> Option<&HostPipeline> {
|
||||
p.made.get()?.as_ref()
|
||||
}
|
||||
|
||||
/// Whether a dispatch waits for its compute pipeline until it is made,
|
||||
/// whatever the frame's budget ([`wait_budget`]); a draw still waits within
|
||||
/// the budget and is dropped while its pipeline is not there.
|
||||
///
|
||||
/// A dropped draw is drawn again in the next frame. A dropped dispatch may
|
||||
/// not be: the title runs some compute passes once, when a scene changes
|
||||
/// (a buffer reset or cleared), and what they leave is read for as long as
|
||||
/// the scene lasts. In the prison corridor a compute program met for the
|
||||
/// first time took 4.4 s to make on a 16 GB machine; its one dispatch was
|
||||
/// dropped after the half second of budget, and the windows of the room
|
||||
/// before stayed blended over the whole picture for minutes (run 195).
|
||||
/// A wait of seconds once (the pipeline library has it on the next run)
|
||||
/// against a picture wrong until the scene ends.
|
||||
/// On by default; `VICTORY_PIPELINE_COMPUTE_WAIT=0`: within the budget, as
|
||||
/// before.
|
||||
fn compute_waits() -> bool {
|
||||
static ON: OnceLock<bool> = OnceLock::new();
|
||||
*ON.get_or_init(|| std::env::var_os("VICTORY_PIPELINE_COMPUTE_WAIT").is_none_or(|v| v != "0"))
|
||||
}
|
||||
|
||||
/// Makes `p` on this thread if it is not made yet (waiting for a worker
|
||||
/// that is making it); whether it has a host pipeline.
|
||||
pub(crate) fn now(p: &Arc<Pending>) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user