feat(shader): add opt-in perspective-center barycentric inputs #281
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!281
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/281/head"
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?
@jeremygold02 on GitHub · 2026-11-24 02:01 UTC · original
jeremygold02:codex/pixel-barycentrics→main· +133 −7 · 4 files · 1 commits · closed without mergingWhat changes
A live read of the GFX10 perspective-center I or J register currently stops pixel-shader translation. With the new
victory-shader/experimental-barycentricsCargo feature, the emitter can assign the native triangle vertices D3D primitive order and loadSV_Barycentrics.yz. This emits the unpacked float3 input, the DXIL entry-point flag and the separate SFI0 capability bit. The emitter retries with that input only if a direct read reaches an effect. An unused read and ordinary paired interpolation keep their previous requirements.Why this is a draft
The chosen vertex order is explicit and opt-in. D3D defines barycentric component order in the API primitive, including odd triangles in a strip. AMD's raw I/J order can rotate relative to those vertices. The synthetic draw below verifies the D3D-order experiment. Matching the console's vertex order, or proving a given consumer is invariant to the permutation, is still open. D3D ordering · AMD raw-coordinate ordering
Local verification
Compared with main at
d2a4baeon Windows 11 and an RTX 5070.(0.26195815, 0.24601395, 0, 1)at the sampled pixel after fence completion. The CPU reference was(0.2619579, 0.24601403, 0, 1). A paired-interpolation control produced byte-identical validated DXIL in both builds.calculateLODon 2D-array textures. With the feature enabled, all three failed SDK validation. Applying only the spatial-coordinate hunk from #136 at8ae232fmade the same three pass (0/3 to 3/3). Compute and mesh totals were identical. This comparison ran on the CPU.cargo test -p victory-shader --lib direct_pixel_barycentricspasses with the feature off and on. The test covers a live center export, a dead read, rejection of the linear-center case, the SFI0 bit, and the input signature. The wider library run passed 59 tests in each configuration, with the WARP and differential GPU suites excluded. Shader formatting and Clippy passed.To build the executable with this experiment, use
cargo build -p victory --features victory-shader/experimental-barycentrics.Refs #97. Related signature work is in #136.
@jeremygold02 on GitHub · 2026-11-24 04:15 UTC · original
Tested PR #281 at head
d9bbff571eabf7defe6b106349acda49d1eaa3f8(state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged atd9bbff571eabf7defe6b106349acda49d1eaa3f8.cargo test --locked -p victory-shader --features experimental-barycentrics direct_pixel_barycentrics_require_a_live_perspective_center_read— passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 69 filtered out; finished in 0.00s ); cases: emit::lower::tests::direct_pixel_barycentrics_require_a_live_perspective_center_read.Behavior covered: Checks feature-gated perspective-center barycentric input is emitted only when a live center read exists.
Code: crates/victory-shader/src/emit/lower.rs, crates/victory-shader/src/emit/shader.rs
@Marvisak on GitHub · 2026-11-25 00:01 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #453. Draft: raw I/J reads as SV_Barycentrics.yz behind a new Cargo feature, with an assumed vertex order. #453 does the same and more without a feature; and the three pixel programs main still refuses for 'barycentrics read directly' are overwritten registers (#457), not real reads.
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