Files
niakw--Prospero.Eden-Encore/headless/dev_vulkan.h
T

76 lines
4.1 KiB
C++

// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <atomic>
#include <cstdint>
// Development A/B switches for Vulkan device features, set from /app0/dev-settings.txt
// before the renderer creates its device (tools/prepare-vulkan-port.py applies them).
namespace Eden::DevVulkan {
inline bool disable_null_descriptor = false;
inline bool disable_descriptor_buffer = false;
inline bool robustness2 = false; // robustBufferAccess2 + robustImageAccess2
inline bool trace_pipelines = false; // report first pipeline uses to klog
// Experimental PS5 all-on: build a usable non-optimized Vulkan pipeline first
// for new runtime shaders, then optimize with one background worker. Never
// rebuild disk-preloaded pipelines (those already have optimized binaries).
#if defined(EDEN_DEV_PROFILE)
inline bool fast_first_pipelines = true;
#else
inline bool fast_first_pipelines = false;
#endif
inline bool disable_sparse = false; // no sparse binding: multi-range SSBOs are gathered copies
inline bool disable_multi_range = false; // bind multi-range SSBOs the pre-2026 way
// Standard border colours only (no RADV border table). On by default: with custom colours
// some games fault the GPU at page 0. Not the driver: RADV's custom border colours read back
// exactly on the console; the cause is open. The three
// standard colours stay exact, others go to the nearest one. dev-settings custom_border=on
// restores them.
inline bool disable_custom_border = true;
inline bool sync_submissions = false; // wait for the GPU after every scheduler flush
inline bool gpu_time = false; // EDEN_GPU_TIME: GPU execution time of scheduler submissions
// PS5 launches multiple titles in one process. A VkQueryPool belongs to the
// old VkDevice after title teardown and MUST NOT be reused by the next title.
// This epoch changes once before each title's GPU workers start.
inline std::atomic<std::uint64_t> gpu_time_session{0};
// No VK_EXT_conditional_rendering (dev-settings conditional_rendering=off). The extension is on:
// RADV's predication is correct on the console (2.7M predicated conditions in one game, 45k
// skipped, correct output). LOD swaps and wrong draws blamed on it came from compute
// synchronization and Eden's host path (hcr_mode).
inline bool disable_conditional_rendering = false;
// Barriers around compute dispatches: indirect dispatches had none, and nothing made a
// dispatch's writes visible to later indirect arguments, vertex fetch, shaders or copies, which
// AMD runs concurrently. Games then swapped whole LOD sets for tens of seconds (racing
// culling/streaming feedback; none with RADV_DEBUG=syncshaders). dev-settings compute_barriers=off restores Eden's original synchronization.
inline bool compute_barriers = true;
// Host conditional rendering. 1 (default): Eden's evaluation, except that the
// cases it approximates take the exact CPU evaluation. Upstream (0, dev-settings hcr=eden) draws
// unconditionally when both compared values are pending host queries or accuracy is low, and
// predicates from buffers a pending query has not reached yet: in one measured game exactly the
// 1/60 of conditions that should skip. 2 (hcr=cpu): every condition evaluated on the CPU and the
// driver predicates the draws from constant 0/1 buffers (the driver check with exact inputs).
inline int hcr_mode = 1;
// Development-only per-title A/B overrides are globals because generated
// Vulkan source refers to them directly, but their lifetime is NOT a whole
// multi-game process. Reset before reading the NEXT title's dev-settings.txt,
// while the previous VkDevice and its worker threads are already destroyed.
inline void ResetForTitle() noexcept {
disable_null_descriptor = false;
disable_descriptor_buffer = false;
robustness2 = false;
trace_pipelines = false;
#if defined(EDEN_DEV_PROFILE)
fast_first_pipelines = true;
#else
fast_first_pipelines = false;
#endif
disable_sparse = false;
disable_multi_range = false;
disable_custom_border = true;
sync_submissions = false;
gpu_time = false;
disable_conditional_rendering = false;
compute_barriers = true;
hcr_mode = 1;
}
} // namespace Eden::DevVulkan