sample mask: port OMSetSampleMaskX (masked pixel shader twins) from main to amd #183
No reviewers
Labels
No labels
accessibility
bug
crash
documentation
duplicate
enhancement
good first issue
graphics
help wanted
invalid
needs logs
performance
question
rdna2
rdna3
rdna4
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/eikkapine--victory-amd!183
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-183"
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?
@mahhnameisjeff on GitHub · 2026-12-03 15:15 UTC · original
mahhnameisjeff:amd-sample-mask→amd· +539 −12 · 10 files · 1 commits · openBase: origin/amd (
0902398). Independent of the other PRs from this batch.Command list slot 142 (0x470) is
OMSetSampleMaskX(u64 QuadSampleMask). On amd it wasignored. The title fades between an object's levels of detail with it: the two levels are
drawn with complementary masks, a pixel of each 2x2 quad more every few frames. Ignored, both
levels draw every pixel.
This ports origin/main's implementation (itself from upstream 0938dd9, GPL-3.0-or-later):
with_pixel_mask/PixelMask: a second form of a pixel program that discards,at entry, each pixel whose place in its 2x2 quad has its bit clear in a host-set dword
(
USER_PIXEL_MASK= 0x10a, as main). A program withoutSV_Positionis given it in the rowthe vertex or mesh program writes it (
position_row).quad_pixels/quad_place.mask_key); plain keys are unchanged,so nothing cached before is translated again.
Shader::masked, keyed apart inPending::new) and of the pipeline (host_pipeline_masked), made on the first draw undera mask without waiting (
make::masked_for); the title's pipeline draws meanwhile.GraphicsStategets aClonethat copies its input names.State::pixel_mask, cleared by a graphics pipeline set and by a list reset;graphics_pipelinepicks the twin for draws and indirect draws; the dword inhost_word.sample_mask_xand, withJAXE_THIN=1, is recorded in the stream(
SAMPLE_MASK), in order with the draws and pipelines; set at the call instead, thereplayed
SET_PIPELINEafter it cleared it before any draw (first run: 0 masked shaders).JAXE_SAMPLE_MASK=0: ignored, as before.Not ported: main's twin also follows the bound targets' formats; amd's pipelines do not vary
by bound formats, so the twin keeps the title pipeline's.
Measured on RX 6700 XT (Series S profile, JAXE_THIN=1), one run of ~150 s: 131,072
OMSetSampleMaskX calls, 62,799 leaving pixels out; 65 pixel shaders translated in the masked
form, none failed; 94 pipelines made in the run (the twins, kept in the pipeline library
after); draws per frame at the end 5,613; no crash. Visibly fewer visual problems in play.
main's tests for the mask bits, the draw state, the switch and the keys are ported and pass;
jaxe-shader's tests pass.
🤖 Generated with Claude Code
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.