victory-shader: lower v_cvt_f32_f64 and image_sample_d_cl #978

Closed
github-bot wants to merge 5 commits from gh-pr/978/head into gh-pr/978/base
Owner

@⁠bartikele on GitHub · 2026-11-24 14:37 UTC · original
bartikele:shader-cvt-f64-and-sample-d-cl → main · +87 −2 · 3 files · 5 commits · closed without merging

Adds DXIL lowering for two missing GFX10 instructions:

  • \ _cvt_f32_f64: adds \TypeDef::Double, \Cast::FpTrunc, and the \DOUBLE\ shader flag/feature bit, lowering via \dx.op.makeDouble.f64\ + \ ptrunc\ (avoiding \INT64\ requirement). Includes unit test \ _cvt_f32_f64_lowers_with_double_flag.
  • \image_sample_d_cl: lowers via \dx.op.sampleGrad.f32\ with the trailing LOD clamp operand.

Verified with \cargo clippy -p victory-shader --all-targets --locked -- -D warnings, \cargo test -p victory-shader --locked, \cargo xtask policy, and \ ictory translate --validate.

**@⁠bartikele** on GitHub · 2026-11-24 14:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/978) `bartikele:shader-cvt-f64-and-sample-d-cl` → `main` · +87 −2 · 3 files · 5 commits · closed without merging Adds DXIL lowering for two missing GFX10 instructions: - \ _cvt_f32_f64\: adds \TypeDef::Double\, \Cast::FpTrunc\, and the \DOUBLE\ shader flag/feature bit, lowering via \dx.op.makeDouble.f64\ + \ ptrunc\ (avoiding \INT64\ requirement). Includes unit test \ _cvt_f32_f64_lowers_with_double_flag\. - \image_sample_d_cl\: lowers via \dx.op.sampleGrad.f32\ with the trailing LOD clamp operand. Verified with \cargo clippy -p victory-shader --all-targets --locked -- -D warnings\, \cargo test -p victory-shader --locked\, \cargo xtask policy\, and \ ictory translate --validate\.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:15:37 +00:00
github-bot closed this pull request 2026-11-26 04:15:37 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-11-24 14:39 UTC · original

Ran the new lowering test at c8c117a:

Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

cargo test -p victory-shader v_cvt_f32_f64
1 passed; 0 failed; 0 ignored      (exit 0)

emit::lower::tests::v_cvt_f32_f64_lowers_with_double_flag passes. This is a CPU-side lowering test, so the adapter is not the variable; the datapoint is the pinned 1.98.1 toolchain with DXC 1.9.2609.5 next to the author's run.

image_sample_d_cl has no test in this diff, so I could not exercise it without the title's shaders (no game data here). I also did not run the title: the README warns that entering the world on a real GPU can hang the adapter.

Not tested: image_sample_d_cl lowering, the world on a real GPU, RDNA2/RDNA4 and Intel GPUs.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the test, wrote this report; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-24 14:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/978#issuecomment-7134734982) Ran the new lowering test at `c8c117a`: Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` cargo test -p victory-shader v_cvt_f32_f64 1 passed; 0 failed; 0 ignored (exit 0) ``` `emit::lower::tests::v_cvt_f32_f64_lowers_with_double_flag` passes. This is a CPU-side lowering test, so the adapter is not the variable; the datapoint is the pinned 1.98.1 toolchain with DXC 1.9.2609.5 next to the author's run. `image_sample_d_cl` has no test in this diff, so I could not exercise it without the title's shaders (no game data here). I also did not run the title: the README warns that entering the world on a real GPU can hang the adapter. Not tested: `image_sample_d_cl` lowering, the world on a real GPU, RDNA2/RDNA4 and Intel GPUs. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash 1017** - checked out the PR's head commit in a detached worktree, built it, ran the test, wrote this report; no game data was used.
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 14:52 UTC · original

On c8c117a, a live register-pair conversion failed Microsoft DXV with a shader-flag mismatch. Double precision uses bit 2 in DXIL entry-point metadata and bit 0 in SFI0. With the metadata fixed, nine f64→f32 values matched on RTX 4090 under Wine/vkd3d-proton 3.2. A separate inline 1.0 case then exposed an operand-decoding issue. Four immediate cases passed with both corrections. Fix and regression test on this branch

The 32-bit-coordinate image_sample_d_cl path also passed a separate source-built check. Its emitted shader validated and matched an independently compiled DXC SampleGrad reference across 32 lanes, with 16 values from mip 0 and 16 from mip 1. This measures the PC lowering. A16 coordinates, console clamp behavior, and game rendering remain open.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 14:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/978#issuecomment-7135087522) On c8c117a, a live register-pair conversion failed Microsoft DXV with a shader-flag mismatch. Double precision uses bit 2 in DXIL entry-point metadata and bit 0 in SFI0. With the metadata fixed, nine f64→f32 values matched on RTX 4090 under Wine/vkd3d-proton 3.2. A separate inline 1.0 case then exposed an operand-decoding issue. Four immediate cases passed with both corrections. [Fix and regression test on this branch](https://github.com/bartikele/VIctory/pull/1) The 32-bit-coordinate image_sample_d_cl path also passed a separate source-built check. Its emitted shader validated and matched an independently compiled DXC SampleGrad reference across 32 lanes, with 16 values from mip 0 and 16 from mip 1. This measures the PC lowering. A16 coordinates, console clamp behavior, and game rendering remain open.
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 14:54 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at c8c117a: cargo test -p victory-shader passes, 121 passed / 0 failed, including v_cvt_f32_f64_lowers_with_double_flag. Workspace baseline on main (ffe310e) was green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 14:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/978#issuecomment-7135155226) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at c8c117a: `cargo test -p victory-shader` passes, 121 passed / 0 failed, including `v_cvt_f32_f64_lowers_with_double_flag`. Workspace baseline on main (ffe310e) was green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:29 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #416. image_sample_d_cl is in main. v_cvt_f32_f64 (makeDouble + fptrunc) is the same lowering as #416 (other batch), which adds abs/neg and a GPU test; main has no f64 at all yet.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/978#issuecomment-7148560829) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #416. image_sample_d_cl is in main. v_cvt_f32_f64 (makeDouble + fptrunc) is the same lowering as #416 (other batch), which adds abs/neg and a GPU test; main has no f64 at all yet. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!978
No description provided.