Repository navigation
Conversation
A float a pixel program exports to a colour target gets NaN as 0 and an infinity as +-65504; typed image and buffer stores get the same for the NaN the GPU makes (0x7FC00000) and infinities, so integer bits pass. One bad pixel no longer stays in a history blended into every frame. VICTORY_NAN_GUARD=0 turns it off; part of the shader cache fingerprint.
|
I independently checked
AI-assisted using Codex. |
|
Two notes; I haven't run this in the game. From reading the diff, integer bits do not always pass untouched. Typed stores all go out as
They can be ordinary data: Tests on an RX 9070 XT (driver 32.0.32029.2010, Windows 11 26200), 23da1ac: AI-assisted (Claude Code); run on my machine. |
…; colour exports stay guarded by default Typed stores go out as .f32 whatever the view's format, so the integer words 0x7F800000, 0xFF800000, 0x7FC00000 and 0xFFC00000 were changed too (found in review by avt0m4t48 and eazyves). Until the view's format is known at that point, only float colour exports are guarded by default.
|
Thank you both @avt0m4t48 and @eazyves, very careful reviews. You are right: typed stores go out as
We will re-run our AMD tests with the default and with |
|
I reran the original 20 synthetic shader fixtures on
The untouched PR head passed the Linux shader library suite (171 passed, 2 ignored) and Windows MSVC cross-target test compilation. The fixture check inspects emitted operands and container bytes. Windows execution, DXIL validation, and GPU readback are still open. |
|
Thanks @avt0m4t48 for re-running the fixtures on 45c5924, that confirms the three settings behave as intended. The in-game A/B on our RX 9070 XT (default vs |
|
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head AI-assisted (Claude Code); no game data. |
|
In-game check on our RX 9070 XT (Adrenalin 32.0.32029.2010, Series S mode with AMD FSR, 45c5924 on top of our AMD branch): two 14 min runs, one with the default (colour exports only) and one with |
…xports and typed stores
Asked for on #3: this ports the NaN guard from KLBF Lab, our AMD-focused build (commit
0e5f4b2, test builds in KLBF Lab Beta), onto currentmain, on its own.What it does. A float a pixel program exports to a colour target has NaN turned into 0 and an infinity into ±65504. Typed image and buffer stores get the same treatment, but only for the NaN the GPU itself produces (
0x7FC00000, either sign) and infinities, so integer bits written through a typed store pass untouched. Raw buffer stores are left alone (there is no type to go by). The idea: a NaN produced by a 32-lane program running on a 64-lane AMD wave can no longer stay in a temporal buffer the title blends into every frame and spread as purple.Switch.
VICTORY_NAN_GUARD, on by default;VICTORY_NAN_GUARD=0turns it off. On currentmainthe translation-cache key picks up every"VICTORY_*"literal invictory-shaderthroughbuild.rs, so the switch joins the key without editing a list (the manual list mentioned on #3 is no longer there), andshader_cache.rsis unchanged.Measured. On an RX 9070 XT, by us and by IxMxAMAR (see #3; related: #318). This was the change that removed the remaining purple in both cases.
Caveats. This probably hides the symptom rather than fixing the root cause (whatever produces the NaN in the first place), so it may be worth keeping only until that is found. We have a single machine, so results on other cards are unknown.
Checks.
cargo build --release,cargo clippy(no new warnings),cargo test --release -p victory-shader: 215 passed, 0 failed.