shader: lower pull-model barycentrics and supply 1/W for pixel POS_W_FLOAT #562
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!562
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-558"
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?
@Sheffy007 on GitHub · 2026-11-28 04:30 UTC · original
Sheffy007:feat/pull-model-barycentrics-pos-w→main· +246 −8 · 4 files · 1 commits · openCloses #561
Refs #258, #410, #525
cc @Olima34
Summary
Barycentric::PerspectivePullModel(SPI_PS_INPUT_ADDRbit 3:<I / W, J / W, 1 / W>).PERSP_PULL_MODEL_ENAloads pixel-centre<I / W, J / W, 1 / W>into three entry VGPRs, which shaders read as data to evaluate screen-space derivatives/offsets and recover perspective(I, J).Lower::barycentricpreviously returnedVal::Missing(BARYCENTRICS_READ)forB::PerspectivePullModel(the remaining"barycentrics read directly"pixel-shader refusals in #525).0and1as perspective-centreSV_Barycentrics.yz / SV_Position.wand index2as1.0 / SV_Position.w, declaringSV_PositioninISG1(or widening an unshared narrowSV_Positionrow to 4 columns) when the input signature does not yet carrySV_Position.w.1.0 / SV_Position.w(1 / W) forInput::Position(3)(POS_W_FLOAT,SPI_PS_INPUT_ADDRbit 11).POS_W_FLOATholds1 / W(which console shaders invert withv_rcp_f32to read HLSLSV_Position.w), whereas DXILloadInputonSV_Positionchannel 3 returnsW. Returning1.0 / SV_Position.wavoids theW^2error when console pixel shaders executev_rcp_f32onPOS_W_FLOAT.Verification
cargo test -p victory-shader --locked(424 passed, includingpull_model_barycentrics_and_pos_w_emit_with_or_without_sv_position)cargo test -p victory-gpu --lib mesh_tests --locked -- --test-threads=1(24 passed on Metal GPU, includingpull_model_barycentrics_and_pixel_pos_w_match_perspective_weightsacross a perspective triangle with vertexw = 1, 2, 4)cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo xtask policybb2b0f3a8cto88470c9d41@AnastasisKon on GitHub · 2026-11-28 18:31 UTC · original · approved these changes
Reviewed and verified locally on head
88470c9d(worktree /private/tmp/review-558):The lowering is right: pull-model indices 0/1 become perspective-centre SV_Barycentrics divided by SV_Position.w, index 2 becomes 1/W, and SV_Position is declared in ISG1 (widened to 4 columns when it shares its row) when the signature lacks .w; POS_W_FLOAT (kind 3, col 3) now returns 1/W so console shaders that run v_rcp_f32 on it get W back without the W^2 error. The two-barycentric-modes rule is now "same perspective-ness", which matches D3D's constraint better than a flat count of two. Approving — this clears the remaining "barycentrics read directly" pixel-shader refusals from #525 and closes #561.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.