Skip to content

Shaders: centroid position with conservative depth - #565

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
SAitken91:shader/conservative-depth-position
Nov 24, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
SAitken91:shader/conservative-depth-position

Conversation

@SAitken91

Copy link
Copy Markdown
Contributor

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

Pixel programs that write SV_DepthLessEqual or SV_DepthGreaterEqual
failed validation: "Interpolation mode for PS input position must be
linear_noperspective_centroid or linear_noperspective_sample when
outputting oDepthGE or oDepthLE". The position is now declared
linear_noperspective_centroid in those programs, as DXC declares it;
without multisampling the value is the same.

translate --validate on shaders.rpf: vertex/pixel 12172 -> 12186
validated; the error is gone from the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KoLolX3

KoLolX3 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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

iurysf commented Nov 24, 2026

Copy link
Copy Markdown

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 mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

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.

@Marvisak
Marvisak merged commit a4d7b16 into Marvisak:main Nov 24, 2026
Yaekai pushed a commit to Yaekai/VIctory that referenced this pull request Nov 24, 2026
suirentakamura pushed a commit to suirentakamura/VIctory that referenced this pull request Nov 24, 2026
…pth-position

Shaders: centroid position with conservative depth
itsonlysimbo pushed a commit to itsonlysimbo/VIctory that referenced this pull request Nov 24, 2026
…pth-position

Shaders: centroid position with conservative depth
geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
…mirror

GPU: mirror descriptor slots copied directly inside title heap memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants