Lower implicit 2D compute samples to quad gradients on Metal #568
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!568
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-564"
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?
@fruvs on GitHub · 2026-11-28 05:15 UTC · original
fruvs:codex/metal-compute-texture-gradients→main· +185 −1 · 2 files · 1 commits · openProblem
Apple Metal Shader Converter rejects
dx.op.sample.f32in multidimensional compute threadgroups with IR error 7. The native host then drops the dispatch.Change
For implicit 2D texture samples in 8×4×1, 8×8×1 and 4×4×2 groups on the 32-lane native target, read neighboring coordinates within each 2×2 tile and pass the resulting X and Y gradients to
sampleGrad. All three lanes needed for a coarse gradient fit in one host wave for these shapes. This retains mip selection instead of forcing level zero. The D3D12 path and other shapes keep their existing lowering.Verification
2f4d81e0and passes with this change.The fixture verifies Metal output against explicit mip expectations. Console-hardware parity for divergent sampling remains open.
Shader Model 6.6 derivative and sampling rules
@AnastasisKon on GitHub · 2026-11-28 17:12 UTC · original · approved these changes
Read the diff: implicit 2D
sample.f32in the listed compute group shapes is lowered to a 2x2-tile neighbor read feedingsampleGrad(X/Y gradients), keeping mip selection — 43 lines inlower.rsplus 142 lines of tests. Verified on the head49e9b1f1: the newshader_tests(incl.a_2d_compute_sample_selects_the_mip_from_both_quad_gradientsacross the 8x4x1 / 8x8x1 / 4x4x2 shapes and wave64) pass under the darwin target (7/7 shader_tests), and the workspace windows clippy with-D warningsis clean. Approving.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.