Shaders: unpack 16-bit vertex inputs into the low half #1518
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1519"
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 Bloh09 on 2026-11-24T18:42:43Z.
Unpack 16-bit vertex attributes into the low half of the VGPR, the way the fetch shader leaves them. Host loadInput is 32-bit, so float16 goes through legacyF32ToF16 and integers are masked to 16 bits.
Part of #1512.
Tested on a Linux box with no GPU and no game files:
cargo test --frozen -p victory-shader(97 passed, 1 ignored) andcargo xtask policy(154 files ok). The new test fails on main with "a 16-bit input is not supported".Untested on hardware; would appreciate someone running a vertex shader with 16-bit inputs.
AI-assisted (Grok Bot), reviewed by me.
Skipped: packed fetch (two 16-bit values per dword). VsInput has no pack flags, so that stays refused until the stage data carries them.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T18:57:08Z.
Review: APPROVED
Verified locally merged onto
origin/main(Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-shader --lib a_16_bit_vertex_input_is_unpacked_to_the_low_half— passedcargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— okClean low-half unpacking of 16-bit vertex inputs (
legacyF32ToF16for float16 and0xFFFFmask for integer formats) with targeted unit test coverage. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T18:53:20Z.
The requested hardware check passed on
55bf86fwith an RTX 4090 under Wine/GE 3.2. The test input layout used actualR16_FLOAT,R16_SINT, andR16_UINTelements. The translated vertex shader converted each resulting VGPR word as an unsigned 32-bit integer to an exactly representable float, and a passthrough pixel shader exposed it for readback. Microsoft’s DXIL validator accepted the vertex shader.0x0000bb00,0x0000fb2e,0x0000fedc0x00003e00,0x00007fff,0x00008123In particular, the negative signed input retained its low 16 bits and cleared the upper half. This exercises unpacked inputs, one attribute per VGPR. Packed pairs and title rendering remain unmeasured.
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-24T19:33:51Z.
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count changes against
main, and the tests pass on Ada.Offline. I merged head
55bf86fontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 on both, 0 gained, 0 lost. No program changes its failure reason either.This is the expected result for a correctness fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests. With the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T19:34:32Z.
Verified commit
55bf86fon Windows 11 / AMD Radeon RX 9060 XT (RDNA4,gfx1200, SM 6.6) + WARP:cargo test -p victory-shader --lib: 121 passed, 0 failed, 1 ignored (all 16-bit vertex input unpacking and GPU tests pass).AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T03:48:09Z.
Review: CHANGES_REQUESTED
Merge with current main (
940d32f69b) breaks compilation — verified locally aftergit merge origin/main:Main added the
view_marksfield toPartsafter this PR was opened; a rebase that initializes the new field should fix it. Unpack 16-bit vertex inputs into the low half looks like the right direction — I will re-test after the rebase.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:29:17Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-shader/src/emit/bitcode.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (merge-candidate) was for an older state ofmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Bloh09 on 2026-11-25T03:43:15Z.
Test now asserts the unpacked low-half values for float16 and int; victory-shader tests and policy pass on
2d3537f.Imported from Marvisak/VIctory. Originally posted by Bloh09 on 2026-11-25T04:05:30Z.
Rebased on
940d32fand set view_marks in the test's Parts; victory-shader tests (145 pass), clippy and policy clean.upstream-sync referenced this pull request2026-11-25 07:03:17 +00:00
Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T09:21:04Z.
Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at
1f658a6.cargo test --workspace --locked --no-fail-fast-> 697 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T12:15:26Z.
The current-main branch at
dd9c239merges exact PR head1f658a6with63bcca4and preserves both original commits. It resolves the conflicts inbitcode.rsandlower.rs. The test inspects the instructions selected by the current writer, retainsview_marks: false, and lives in a separate test module to leave room below the file-size limit.With the same fixture on
63bcca4, lowering stops ata 16-bit input is not supported. The branch passed the fixture for FP16, signed and unsigned 16-bit inputs.dxil.dllvalidated all three vertex shaders. The forced-WARP shader suite was 299 passed / 4 failed / 3 ignored, compared with 297 / 6 / 3 on main with the fixture. All four failures also appear on main. Strict shader Clippy and the asset policy passed.@catminou4, this is the branch you can use to recheck the earlier build issue. @Bloh09, it can be fast-forwarded from
1f658a6. If you fold in the merge-resolution changes, please retain Git attribution or addCo-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex. Synthetic tests only.
Imported from Marvisak/VIctory. Originally posted by Bloh09 on 2026-11-28T16:03:21Z.
Rebased on
63bcca4(head1bb2d44), conflicts were the new test fields and tests in lower.rs/bitcode.rs. victory-shader lib tests (173 pass), clippy and policy clean on Linux.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T16:14:45Z.
I checked the rebased head
1bb2d44on Windows with app-local WARP 1.0.22 and Agility SDK 1.620.2. With a generated full-screen triangle, main63bcca4stops at “a 16-bit input is not supported.” The rebased head produces a DXIL vertex shader that passes the validator and creates a pipeline with actual R16_FLOAT, R16_SINT and R16_UINT inputs.The three attributes were converted to exactly representable float values after unpacking, passed through the pixel shader and read back. All four pixels in each row matched these full VGPR words:
The rebased unit test and all 34 lowerer tests pass. Strict shader Clippy, the asset policy and Windows CI on this head are green. This covers the unpacked vertex-input path on WARP. MichaelSmithAI's earlier RTX 4090 result is on
55bf86f.The head is current and mergeable. The next step is for the maintainer to revisit the review after the rebase.
AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by Bloh09 on 2026-11-28T22:26:27Z.
Closing, moving my work elsewhere.
Pull request closed