gpu: keep A8_UNORM out of the R8 typeless family (port of VIctory#1390) #128

Closed
wilu222 wants to merge 0 commits from upstream-pr/128 into main
wilu222 commented 2026-11-26 21:39:52 +00:00 (Migrated from github.com)

Imported from uiliannn/VItoriaBr. Originally posted by wilu222 on 2026-11-26T21:39:52Z.


Port of Marvisak/VIctory#1390 (by AnoHunted), which this tree does not have yet.

family() in crates/victory-gpu/src/resource.rs put A8_UNORM (65) in R8_TYPELESS's range (60..=65). DXGI's R8 family is 60..=64, and A8 cannot be cast to R8. Two effects:

  • An R8 view of an A8 texture passed the family check in fits() and was given A8's format, so the shader read the value from alpha instead of red. The view is now refused.
  • A placed target that reinterprets R8 as A8 was made R8_TYPELESS, which has no A8 view. It is now made in the wanted format (element() gives both 1 byte).

The fix is the same one-line range change as upstream. The test, a8_unorm_stands_outside_the_r8_family, is new: it fails without the change (family(65) is 60) and passes with it.

Tested (RTX 5070, driver 617.42, Windows 10 19045, Rust 1.98.1)

  • cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: clean
  • cargo test --workspace --locked --no-fail-fast: the same tests fail on main (1361e19) and on this branch, 25 GPU tests in victory-shader (valu_tests, intersect_tests, waterfall_tests) and depth_bounds_pipeline_loads_and_filters_draws; no new failure. crash::tests::unwinds_like_the_system_walk is flaky here on both (passed 1 of 4 runs on main)

Not tested: in game.

<!-- greyfinch-sync:uiliannn/VItoriaBr:issue:5517502920 --> Imported from [uiliannn/VItoriaBr](https://github.com/uiliannn/VItoriaBr/pull/128). Originally posted by [wilu222](https://github.com/wilu222) on 2026-11-26T21:39:52Z. --- Port of Marvisak/VIctory#1390 (by AnoHunted), which this tree does not have yet. `family()` in `crates/victory-gpu/src/resource.rs` put A8_UNORM (65) in R8_TYPELESS's range (60..=65). DXGI's R8 family is 60..=64, and A8 cannot be cast to R8. Two effects: - An R8 view of an A8 texture passed the family check in `fits()` and was given A8's format, so the shader read the value from alpha instead of red. The view is now refused. - A placed target that reinterprets R8 as A8 was made R8_TYPELESS, which has no A8 view. It is now made in the wanted format (`element()` gives both 1 byte). The fix is the same one-line range change as upstream. The test, `a8_unorm_stands_outside_the_r8_family`, is new: it fails without the change (`family(65)` is 60) and passes with it. **Tested** (RTX 5070, driver 617.42, Windows 10 19045, Rust 1.98.1) - `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: clean - `cargo test --workspace --locked --no-fail-fast`: the same tests fail on `main` (`1361e19`) and on this branch, 25 GPU tests in `victory-shader` (`valu_tests`, `intersect_tests`, `waterfall_tests`) and `depth_bounds_pipeline_loads_and_filters_draws`; no new failure. `crash::tests::unwinds_like_the_system_walk` is flaky here on both (passed 1 of 4 runs on `main`) **Not tested:** in game.
wilu222 commented 2026-11-27 00:42:15 +00:00 (Migrated from github.com)

Imported from uiliannn/VItoriaBr. Originally posted by wilu222 on 2026-11-27T00:42:15Z.


Closing: an in-game check (RTX 5070, about 7 minutes of the prologue) found the title never reaches this case, so the change fixes nothing observable for it.

<!-- greyfinch-sync:uiliannn/VItoriaBr:comment:7206682526 --> Imported from [uiliannn/VItoriaBr](https://github.com/uiliannn/VItoriaBr/pull/128#issuecomment-7206682526). Originally posted by [wilu222](https://github.com/wilu222) on 2026-11-27T00:42:15Z. --- Closing: an in-game check (RTX 5070, about 7 minutes of the prologue) found the title never reaches this case, so the change fixes nothing observable for it.

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
uiliannn/VItoriaBr!128
No description provided.