Skip to content

fix(shader): lower direct pixel barycentrics - #164

Merged
pragyaangaur merged 5 commits into
pragyaangaur:mainfrom
mikebuckets171:contrib/pixel-barycentrics
Nov 26, 2026
Merged

pragyaangaur merged 5 commits into
pragyaangaur:mainfrom
mikebuckets171:contrib/pixel-barycentrics

Conversation

@mikebuckets171

@mikebuckets171 mikebuckets171 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Decode D3D_NAME_BARYCENTRICS as a pixel-shader input with the default perspective/center mode.
  • Lower the six GFX10 direct perspective and affine sample, center, and centroid barycentric system values to DXIL SV_Barycentrics, including their component and interpolation modes.
  • Set the DXIL SFI0 barycentrics feature bit; keep unsupported pull-model and conflicting same-semantic sampling cases explicit.

This came from an unsupported direct-barycentrics translation observed in a local title log. I have no evidence that this shader caused the title corruption or null-write discussed in issue #50, and this change has not established world entry or gameplay.

Verification

  • cargo test --workspace --no-fail-fast (native): passed.
  • cargo test -p victory-shader (native): 169 passed, 2 ignored.
  • tools/macos/test-wine.sh -p victory-shader --no-fail-fast: 281 passed, 3 ignored.
  • cargo clippy --workspace --all-targets and cargo xtask policy: passed.
  • Full Wine-target workspace run failed in victory-gpu::shadow::tests::marks_of_shaders_using_title_memory_are_held_back (expected page marks (170, 0), observed (0, 0)); the isolated test passed on rerun and the shader package Wine-target suite passed.
  • cargo fmt --all -- --check reports existing workspace formatting drift, including untouched legacy lines in changed files. The added lines were checked against rustfmt output; the global formatter was not run in write mode.
  • Optional DXIL Validator checks were skipped because dxil.dll is not installed.

AI disclosure

Developed with AI assistance; the patch and local verification results were reviewed before submission.

Latest follow-up

  • Corrected the SFI0 Barycentrics feature mask to bit 17 (0x20000); bit 22 is typed 64-bit atomics and remains clear. The native and Wine-target shader suites above include this final correction.
  • GitHub Actions CI on final head 682cd00 passed, including Clippy, the diagnostics build, and tests: https://github.com/pragyaangaur/VIctory-macOS/actions/runs/45708254636.

@pragyaangaur

Copy link
Copy Markdown
Owner

Thanks, the lowering looks right. Please restore the negative coverage in the movreld loop test. The cases that must not be recognised should assert something that fails if the loop were wrongly accepted, for example that the output still reads the barycentric input. Please also rebase over #161 if that merges first.

@pragyaangaur
pragyaangaur merged commit aaa6bff into pragyaangaur:main Nov 26, 2026
1 check passed
@pragyaangaur

Copy link
Copy Markdown
Owner

I merged main into this branch and restored the negative coverage in the movreld loop test. The test now feeds the loop raw perspective pull-model values, which still have no direct translation, so the complete loops must lower and every bad-loop case must still fail with the barycentrics-read-directly error if the output reads the input. CI is green and this is merged. Thank you for the work.

@pragyaangaur pragyaangaur added area:shader Shader translator bug Something isn't working labels Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:shader Shader translator bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants