GPU: reconstruct packed UNORM rectangle vertex colors #2241
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2243"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T08:36:13Z.
Rectangle expansion handles several unpacked vertex formats. For R10G10B10A2_UNORM, the generated fourth vertex currently keeps the color of the first vertex. This format is supported by the D3D12 input assembler. Format support.
Reconstruct each packed channel with the same fourth-corner formula used by the existing expansion, then clamp to its bit width. A packed element that crosses the vertex stride retains the first vertex's bytes.
The same synthetic vertex-buffer test failed before the change and passed after it. It checks all four channels and a packed element whose word crosses the stride.
Windows/WARP GPU library suite with the regression went from 145 passed, 2 failed, 2 ignored to 146 passed, 1 failed, 2 ignored. The placed-view texture-format test failed in both builds.
Clippy passed for victory-gpu all targets with warnings denied, with and without diagnostics.
Native D3D12 WARP control with the same synthetic vertex data on
940d32fandc53275b. It fed the expanded fourth vertex through the packed input assembler format, drew one point, and copied the float render target back. The pixel was [0.9384164, 0.21505377, 0.015640274, 0.33333334] before and [1.0, 0.2639296, 0.0, 1.0] after, matching the reconstructed channels.Coordination claim in #1633.
AI-assisted using Codex. Synthetic vertex data only.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T08:42:29Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib primitive::— 9 passed, 0 failed (includinga_packed_unorm_color_is_reconstructed_at_the_missing_corner)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean per-channel reconstruction of packed UNORM rectangle vertex colors at the missing fourth corner. Looks good.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:37Z.
Review: COMMENTED
Reconstruct packed UNORM (R10G10B10A2) rectangle vertex colors for the fourth vertex instead of reusing v0. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Imported from Marvisak/VIctory. Originally posted by MamaLeVrai on 2026-11-25T09:13:29Z.
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head
c53275b7intomain940d32fin a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with--all-features: clean.cargo test --workspace --locked: 702 passed, 0 failed, 10 ignored, two runs (mainalone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:31:52Z.
Automated triage for the maintainers.
Merge candidate (worth a look).
expand_rectsincrates/victory-gpu/src/primitive.rsnow computes the fourth rectangle corner forR10G10B10A2_UNORMelements per channel (packed_unorm_corner: v0 + v2 - v1 in integer units, clamped to each field's range), where before such an element, unknown tocomponents, kept the first vertex's value; it requires the whole 4-byte word inside the vertex, like the existing per-component bound. I checked the corner formula and clamping against the float path used for the other UNORM kinds (Kind::write) and the test's expected values; CI (check) passes, and a tester reports the workspace tests passing on RDNA2. Minor: the rest of the file matches formats by number, so thewindowsimport could be the literal24for consistency.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:07:15Z.
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because it is inconsistent with
8ff79135, which it predates. Every other element now computesget(a) + get(b) - get(right)with the right angle found from the position, while the packed path here always takes the right angle at v1, so rectangles with it at v0 or v2 would get the wrong colour. The test has no position element, so it does not see this. The function is also the CPU fallback, which practically never runs now that rectangle lists get a geometry shader.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed