GPU: an unwritable shader cache still hands back its translation (port of upstream #2055) #1322

Closed
CwWwWwW wants to merge 1 commit from upstream-pr/1325 into main
CwWwWwW commented 2026-11-26 15:29:57 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-26T15:29:57Z.


Problem

A shader cache entry that cannot be written - its folder replaced by a file, the disk full, a scanner holding the file - makes victory_pipeline::Cache::get_or_convert return an error after the translation has already run. shader_cache::cached propagated that error with ?, so the translation was made once and then lost: the shader never got a host pipeline for the run, and its draws were dropped even though the work had succeeded.

Upstream VIctory fixed this in commit bca3ecd (pull request #2055, by Flare); this is that fix ported and adapted to the fork.

Change

  • Translate keeps the HostShader its conversion made.
  • A cache error is logged and the entry left for a later run instead of failing the shader.
  • An entry that was just written is handed back from the converter rather than read back (the first read of a new file costs about as much as a small translation where a virus scanner looks at it: 0.5-3 ms here).
  • Fork difference: this fork's encode takes a HostShader (a refusal is not cached), so only a successful translation is kept.

Tests

  • New a_translation_is_made_once_when_its_entry_cannot_be_written: the cache root is replaced by a file, so create_dir_all fails. Before the change this test fails with Err(... os error 183); with it the translation is returned and the converter ran exactly once.
  • cargo test -p victory-gpu --lib --locked: 218 passed, 0 failed, 6 ignored.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.
  • No game or GPU needed: the test drives cached and a cache folder only.

(CI note: the check job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)

<!-- greyfinch-sync:fxceless/victory-fork:issue:6629941930 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1325). Originally posted by [CwWwWwW](https://github.com/CwWwWwW) on 2026-11-26T15:29:57Z. --- ## Problem A shader cache entry that cannot be written - its folder replaced by a file, the disk full, a scanner holding the file - makes `victory_pipeline::Cache::get_or_convert` return an error after the translation has already run. `shader_cache::cached` propagated that error with `?`, so the translation was made once and then lost: the shader never got a host pipeline for the run, and its draws were dropped even though the work had succeeded. Upstream VIctory fixed this in [commit bca3ecd](https://github.com/Marvisak/VIctory/commit/bca3ecd) (pull request #2055, by **Flare**); this is that fix ported and adapted to the fork. ## Change - `Translate` keeps the `HostShader` its conversion made. - A cache error is logged and the entry left for a later run instead of failing the shader. - An entry that was just written is handed back from the converter rather than read back (the first read of a new file costs about as much as a small translation where a virus scanner looks at it: 0.5-3 ms here). - Fork difference: this fork's `encode` takes a `HostShader` (a refusal is not cached), so only a successful translation is kept. ## Tests - New `a_translation_is_made_once_when_its_entry_cannot_be_written`: the cache root is replaced by a file, so `create_dir_all` fails. Before the change this test fails with `Err(... os error 183)`; with it the translation is returned and the converter ran exactly once. - `cargo test -p victory-gpu --lib --locked`: **218 passed, 0 failed, 6 ignored**. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean. - No game or GPU needed: the test drives `cached` and a cache folder only. (CI note: the `check` job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)
upstream-sync closed this pull request 2026-11-26 16:06:34 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1322
No description provided.