Files
Triforce-Source/gpu/vk/vk_jobs.h
ruckus7382sfgsgdf 4fa4f9188b Triforce v0.8.0
Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
2026-11-25 10:21:32 -06:00

28 lines
1.6 KiB
C++

// Background work of the back end (vk_jobs.cpp): shader translation and pipeline builds run on a few worker threads
// at below-normal priority while the replay goes on, after totk-pc-recomp's vk_pipeline.c background builds. A draw
// whose program or pipeline is not ready yet is left out of its frame, or waits for it (vk_draw.cpp decides).
#pragma once
#include <atomic>
#include <functional>
namespace mkwvk {
/// Queues fn for a worker (urgent: ahead of the others, for work a draw waits on)
/// flag: what the job sets when it is done. A jobs_wait on it while the job is still queued runs the job there and then
/// on_failure: publishes the resource's failed/completed state if fn throws; must not throw.
/// A completion flag alone does not imply success: its resource must describe the failure too.
void jobs_push(std::function<void()> fn, bool urgent = false, const std::atomic<bool>* flag = nullptr,
std::function<void()> on_failure = {});
/// Queues fn for the one thread that runs such jobs one at a time, in order
void jobs_push_serial(std::function<void()> fn, std::function<void()> on_failure = {});
/// Waits until flag is set by a job (which calls jobs_notify after setting it)
void jobs_wait(const std::atomic<bool>& flag);
/// (Triforce) Waits at most ms for flag (vk_draw.cpp, pipe_wait.h: a wait from a frame's budget). Its job, still queued, goes
/// to the front for the next worker, and is not run on the waiting thread: a compile could outlast any bound. True: it is set
bool jobs_wait_for(const std::atomic<bool>& flag, int ms);
void jobs_notify();
int jobs_pending();
} // namespace mkwvk