Files
mitch030504--Wiicompiled_VR…/aurora-main/lib/gfx/pipeline_cache.hpp
T

44 lines
1.6 KiB
C++

#pragma once
#include "common.hpp"
#include <functional>
namespace aurora::gfx::clear {
struct PipelineConfig;
} // namespace aurora::gfx::clear
namespace aurora::gx {
struct PipelineConfig;
} // namespace aurora::gx
namespace aurora::gfx {
using NewPipelineCallback = std::function<wgpu::RenderPipeline()>;
void initialize_pipeline_cache();
void shutdown_pipeline_cache();
void begin_pipeline_frame();
void end_pipeline_frame();
void set_skip_unready_pipelines(bool enabled) noexcept;
bool skip_unready_pipelines() noexcept;
uint32_t queued_pipeline_count() noexcept;
// Persists the pipeline caches now: Dawn's Vulkan pipeline cache when a pipeline was compiled
// since the last store, then every queued recipe row. Holds the device for the store, so call it
// where a stall is invisible (a race exit, process exit).
void store_pipeline_caches();
// Lets a drained first-use burst store the caches itself, rate-limited. Off by default; a host
// turns it on while a stall is acceptable (menus) and off again for a race.
void set_pipeline_cache_idle_store(bool allowed) noexcept;
template <typename Config>
PipelineRef find_pipeline(ShaderType type, const Config& config, NewPipelineCallback&& cb);
bool wait_pipeline(PipelineRef ref, wgpu::RenderPipeline& pipeline);
bool try_pipeline(PipelineRef ref, wgpu::RenderPipeline& pipeline);
// Waits indefinitely for a draw about to be committed to a persistent texture with no re-issue
// path. Separate from wait_pipeline so skip-unready mode never becomes blocking for other passes.
bool wait_pipeline_for_persistent_pass(PipelineRef ref, wgpu::RenderPipeline& pipeline);
} // namespace aurora::gfx