Files
Triforce-Source/docs/pipeline-cache-save-check.md
ruckus7382sfgsgdf 6f338c8f56 Triforce v0.5.0
In-game mods (GameBanana browser, search and installs, with the Mask Salesman), code-patch and cheat mods, the devs' test18 to test45 work (full performance overlay, frame pacing on, steady frame rate, save export and import, bug capture, new options rows, Setup's Mods page and Add to Steam), occlusion queries and new defaults, Auto resolution that scales, replay helper threads and robust buffers off by default, the options in sections.
2026-11-17 22:40:50 -06:00

37 lines
2.5 KiB
Markdown

# Pipeline cache save failures
`pipeline_cache_save` writes a temporary file before replacing the existing cache. Allocation failures in its
background worker must stay in that worker, release its busy flag and leave later saves possible. Starting the
worker can fail too. The synchronous prepare-only save follows the same exception handling.
Run the game-free check with a C++20 compiler and its runtime libraries available:
```sh
python -I -B tests/test_pipeline_cache_save.py --cxx clang++
```
The fixture compiles the actual function with Vulkan API spies, real C++ containers/threads, and authored temporary
file bytes. It injects allocation failures into the vector, temporary path and thread startup; an oversized vector
checks `length_error`. Each fault case checks that the old file survives and a subsequent save completes. Success,
the 32-pipeline threshold, a single forced-waiter scheduling smoke, Vulkan empty/error returns and a failed write
are covered too. The waiter smoke is not a deterministic concurrency proof.
`--baseline-source /path/to/original/vk_draw.cpp` additionally compares the original success path and runs six
original-failure negatives in separate, bounded processes. Uncaught worker exceptions terminate those children;
an independent authored thread control identifies the exact MSVC fail-fast result where its custom terminate
handler is bypassed. Fixed children must always exit successfully.
These checks use no driver or real cache and do not reproduce issue #1022's reported session. They do not establish
its root cause, validate saving a multi-gigabyte driver cache, force an OS thread-resource failure, or change cache
size/retry policy. The existing wait-then-store protocol for concurrent forced callers is unchanged; the current
force call is in prepare-only startup. Driver/native faults and thread-detach failures are outside this change.
## The file's bound
The cache's size has a rule since: `gpu/vk/pcache_bound.h`. A file over the bound is not read (the cache starts
empty), and data over the bound is neither fetched nor written, so the file keeps its last save
(`RX_VK_PCACHE_MAX_MB`, in the development guide's switches). The fixture's `over-bound` case runs the save's side
against the actual function: under and at the bound the data is written as ever, over it the old file stays, in a
forced save and on the worker, and with the bound lifted the same data is written. The read's side is
`tests/test_pcache_bound.py`. A read that ends early is refused whole by the header; no test makes a read end early.