Skip to content

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

Closed
CwWwWwW wants to merge 1 commit into
fxceless:mainfrom
CwWwWwW:port/shader-cache-unwritable
Closed

CwWwWwW wants to merge 1 commit into
fxceless:mainfrom
CwWwWwW:port/shader-cache-unwritable

Conversation

@CwWwWwW

@CwWwWwW CwWwWwW commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

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.)

…tream #2055)

Ported from upstream VIctory commit bca3ecd (pull request #2055, Flare):
a cache entry that cannot be written (its folder is a file, the disk is
full, a scanner holds it) made victory_pipeline::Cache::get_or_convert
fail, and cached propagated that error: the shader was translated once
and then lost for the run - every pipeline behind it dropped, though the
translation itself had been made.

The converter keeps the translation it just made (Translate.made), the
cache error leaves the entry for a later run instead of failing the
shader, and the caller gets the translation without reading the entry
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).

Adapted to this fork: its encode takes a HostShader (a refusal is not
cached), so the made translation is stored only when the conversion
succeeds.

Test: a_translation_is_made_once_when_its_entry_cannot_be_written (the
cache root is a file). It fails before the change ("when the file
already exists ... os error 183") and passes after; the translation runs
once.

cargo test -p victory-gpu --lib: 218 passed, 0 failed, 6 ignored;
cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
@CwWwWwW CwWwWwW closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant