Shaders: centroid position with conservative depth #565

Merged
SAitken91 merged 1 commit from upstream-pr/565 into main 2026-11-24 08:18:04 +00:00
SAitken91 commented 2026-11-24 05:00:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SAitken91 on 2026-11-24T05:00:58Z.


Pixel programs that write SV_DepthLessEqual or SV_DepthGreaterEqual failed validation (14 in shaders.rpf, for example PS_OctaSLODReZ):

Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE

Change

When a pixel program's outputs include a conservative depth (kinds 18 and 19), its SV_Position input is declared linear_noperspective_centroid (5) instead of linear_noperspective (4). This matches what DXC declares for the same case. Without multisampling the position's value is the same.

Results

victory translate --validate shaders.rpf: vertex/pixel validated 12172 → 12186. The error is gone from the list.

Testing

  • cargo test -p victory-shader: 69 passed. Clippy and rustfmt are clean.
  • Not exercised at runtime.

This is independent of #539, #554 and #563.

Written with the help of Claude (AI).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6574990553 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/565). Originally posted by [SAitken91](https://github.com/SAitken91) on 2026-11-24T05:00:58Z. --- Pixel programs that write `SV_DepthLessEqual` or `SV_DepthGreaterEqual` failed validation (14 in shaders.rpf, for example `PS_OctaSLODReZ`): > Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE ## Change When a pixel program's outputs include a conservative depth (kinds 18 and 19), its `SV_Position` input is declared `linear_noperspective_centroid` (5) instead of `linear_noperspective` (4). This matches what DXC declares for the same case. Without multisampling the position's value is the same. ## Results `victory translate --validate shaders.rpf`: vertex/pixel validated 12172 → 12186. The error is gone from the list. ## Testing - `cargo test -p victory-shader`: 69 passed. Clippy and rustfmt are clean. - Not exercised at runtime. This is independent of #539, #554 and #563. Written with the help of Claude (AI). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
KoLolX3 commented 2026-11-24 06:56:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KoLolX3 on 2026-11-24T05:32:10Z.


Check on Linux, not Windows: pass. Head c249f02dd merged onto main d2a4bae1f (clean merge).

  • Native tests of the seven crates that build on Linux (core, formats, game, loader, pe, pipeline, shader): PR 92 passed, 7 failed, main 92 passed, 7 failed.
  • Windows cross type-check of the whole workspace (cargo xwin check --workspace --target x86_64-pc-windows-msvc, covers victory-gpu, victory-hle and the app): PR ok, main ok.
  • Tests this PR adds: 0 (so the native result only shows the existing tests still pass; the change itself is not covered by a test here).
  • rustfmt: unformatted hunks, PR 168, main 168.
  • Failing on main here as well (not this PR): 7 tests in victory-loader and victory-pe that parse their own test binary as a PE image, which is an ELF file on Linux.
  • Not run: victory-gpu / victory-hle tests and the game itself.

On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123038965 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/565#issuecomment-7123038965). Originally posted by [KoLolX3](https://github.com/KoLolX3) on 2026-11-24T05:32:10Z. --- Check on Linux, not Windows: **pass**. Head `c249f02dd` merged onto `main` `d2a4bae1f` (clean merge). - Native tests of the seven crates that build on Linux (`core`, `formats`, `game`, `loader`, `pe`, `pipeline`, `shader`): PR `92 passed, 7 failed`, `main` `92 passed, 7 failed`. - Windows cross type-check of the whole workspace (`cargo xwin check --workspace --target x86_64-pc-windows-msvc`, covers `victory-gpu`, `victory-hle` and the app): PR ok, `main` ok. - Tests this PR adds: 0 (so the native result only shows the existing tests still pass; the change itself is not covered by a test here). - rustfmt: unformatted hunks, PR 168, `main` 168. - Failing on `main` here as well (not this PR): 7 tests in `victory-loader` and `victory-pe` that parse their own test binary as a PE image, which is an ELF file on Linux. - Not run: `victory-gpu` / `victory-hle` tests and the game itself. On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.
iurysf commented 2026-11-24 06:56:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by iurysf on 2026-11-24T06:17:09Z.


Tested offline against main d2a4bae with victory translate --list --validate over the title's shaders.rpf + executable (26,096 programs), dxil.dll 1.9.2602.17: emission is unchanged (3,733 failures, 12,284 emitted), and validation improves as claimed. The "Interpolation mode for PS input position ... oDepthGE/oDepthLE" rejections disappear (14 -> 0), vertex+pixel validated 12,184 -> 12,198, and total rejected 185 -> 171. No program that validated on main fails now.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123775759 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/565#issuecomment-7123775759). Originally posted by [iurysf](https://github.com/iurysf) on 2026-11-24T06:17:09Z. --- Tested offline against main `d2a4bae` with `victory translate --list --validate` over the title's `shaders.rpf` + executable (26,096 programs), dxil.dll 1.9.2602.17: emission is unchanged (3,733 failures, 12,284 emitted), and validation improves as claimed. The "Interpolation mode for PS input position ... oDepthGE/oDepthLE" rejections disappear (14 -> 0), vertex+pixel validated 12,184 -> 12,198, and total rejected 185 -> 171. No program that validated on main fails now. AI-assisted.
mercuryVM commented 2026-11-24 07:01:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T06:56:47Z.

Review: APPROVED


Tested c249f02 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed). victory translate <title exe> --validate --pipelines gives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. None of these 12 programs writes conservative depth, so I could not reproduce the 12172 → 12186 figure.

  • The DXIL constants are right: semantic kinds 18/19 are DepthGreaterEqual/DepthLessEqual, and 3 is Position. Interpolation mode 5 is LinearNoperspectiveCentroid, the form the validator asks for when oDepthGE/LE is written.
  • Behaviour: without MSAA a centroid SV_Position equals the pixel centre. With MSAA it moves to the centroid of the covered samples on partially covered pixels. DXC makes the same trade-off, and the alternative is no pipeline at all.

No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6034943033 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/565#pullrequestreview-6034943033). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T06:56:47Z. **Review:** APPROVED --- Tested c249f02 on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (264 passed, 0 failed). `victory translate <title exe> --validate --pipelines` gives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. None of these 12 programs writes conservative depth, so I could not reproduce the 12172 → 12186 figure. - The DXIL constants are right: semantic kinds 18/19 are `DepthGreaterEqual`/`DepthLessEqual`, and 3 is `Position`. Interpolation mode 5 is `LinearNoperspectiveCentroid`, the form the validator asks for when oDepthGE/LE is written. - Behaviour: without MSAA a centroid `SV_Position` equals the pixel centre. With MSAA it moves to the centroid of the covered samples on partially covered pixels. DXC makes the same trade-off, and the alternative is no pipeline at all. No issues found. AI-assisted (Claude Code).
slint6614-dev commented 2026-11-24 08:02:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T07:47:14Z.


Measured on the full retail shader pack (26,503 containers) with victory translate --validate, against main d2a4bae (emitted / validated). Windows 11, dxil.dll from SDK 10.0.26100.

VS/PS MS validator failures changed
main 12272 / 12172 8191 / 8129
#554 12272 / 12214 8191 / 8130 clears all 49 "interpolation mode that differs from another element packed into the same row"; "Program Input Signature does not match" 21 → 23, "Program Output Signature does not match" 25 → 29
#565 12272 / 12186 8191 / 8129 clears the 14 "Interpolation mode for PS input position must be linear_noperspective_centroid…"
#381 12272 / 12172 8191 / 8129 none on this pack
#306 12316 / 12316 8191 / 8138 clears both kinds above and the signature mismatches (all VS/PS that emit validate)

cargo test -p victory-shader passes on all four.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125370101 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/565#issuecomment-7125370101). Originally posted by [slint6614-dev](https://github.com/slint6614-dev) on 2026-11-24T07:47:14Z. --- Measured on the full retail shader pack (26,503 containers) with `victory translate --validate`, against main d2a4bae (emitted / validated). Windows 11, dxil.dll from SDK 10.0.26100. | | VS/PS | MS | validator failures changed | |---|---|---|---| | main | 12272 / 12172 | 8191 / 8129 | | | #554 | 12272 / 12214 | 8191 / 8130 | clears all 49 "interpolation mode that differs from another element packed into the same row"; "Program Input Signature does not match" 21 → 23, "Program Output Signature does not match" 25 → 29 | | #565 | 12272 / 12186 | 8191 / 8129 | clears the 14 "Interpolation mode for PS input position must be linear_noperspective_centroid…" | | #381 | 12272 / 12172 | 8191 / 8129 | none on this pack | | #306 | 12316 / 12316 | 8191 / 8138 | clears both kinds above and the signature mismatches (all VS/PS that emit validate) | `cargo test -p victory-shader` passes on all four.
upstream-sync closed this pull request 2026-11-24 09:05:39 +00:00
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
Marvisak/VIctory!565
No description provided.