Keep the per-sample pixel shader test triangle inside clip space #68
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!68
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/68/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?
@philip-roy-jones on GitHub · 2026-11-21 22:39 UTC · original
test/per-sample-iteration-warp→main· +5 −2 · 1 files · 1 commits · closed without mergingLibrary / area:
d3d12_xspixel-shader option tests. Fixes the per-sample baseline failure reported in #59.Exports changed (exports.txt rows): None.
Source of the behaviour: The fixture generates HLSL in the translator's output form, applies the production pixel-shader option edit, compiles with DXC, and reads the first 32-bit word of a UAV. The shader increments that word once whenever the interpolated X coordinate is nonnegative (true throughout this draw). Pixel-frequency shading runs once per rasterized primitive covering a pixel, while sample-frequency shading runs once per covered sample. D3D12 permits drivers to use a guard band when clipping X and Y. Microsoft multisample rasterization rules · D3D12 clipping rules
The original triangle extended past two clip planes. WARP reported one input primitive and three clipper output primitives. A handwritten HLSL control found 4,032 full-coverage invocations and 128 partial ones, all on the 64-pixel diagonal
x + y == 63. The partial invocations split evenly between complementary sample masks0x5and0xa. That accounts for 4,160 atomic increments and all 16,384 covered samples. The per-sample variant agreed with a directSV_SampleIndexshader. The discrepancy comes from the test geometry.The test now draws one triangle inside clip space and doubles the viewport. It reaches the same framebuffer coordinates
(0,0),(128,0),(0,128)with the same 64×64 scissor. A single rasterized primitive covers all four samples of every test pixel. The test still requires exactly 4,096 base writes and 16,384 per-sample writes. #36 addresses interpolation linkage between shader stages. Both PSOs here were created and drew successfully on the baseline.Windows verification
Windows 11 Pro 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, system D3D12 and WARP 10.0.26100.9818.
GetAdapterLuidandEnumAdapterByLuididentified the test's default device as Microsoft Basic Render Driver (1414:008c). ExplicitEnumWarpAdapterproduced the same results. Each measurement repeated three times on each device selection.cd08e9d757cc13Ran on upstream
cd08e9da6c7d65cbc6b8cfb22541674871b02df6and branch757cc134a5e9452c17a719fb371aa00be038a39efrom the repository root.The focused test failed on all three baseline runs and passed on all three branch runs. With one test thread the unfiltered crate run went from 408 passed / 2 failed / 37 ignored to 409 passed / 1 failed / 37 ignored. The remaining failure is the pre-existing FXC
uint64_terror tracked by #63. The default parallel crate run also aborted intermittently on both revisions. On upstream one run aborted invmem_xand on the branch two runs exited0xc0000005after the per-sample test had passed.All six pixel-shader option tests passed. Filtering the FXC test passed the other 409 unit tests and both process-debug integration tests. The diff check passed. As a negative control, temporarily changing the variant's
PerSampleIterationoption from1to2made the exact assertion fail with(4096, 4096)against(4096, 16384).Upstream advanced during verification. The same focused and unfiltered serial commands on
e843998f0db8d59397eedd0df517b007a2b347a7and GitHub's merge preview90f02c41d20f36a857ef98b39531a75213cc4e24reproduced the comparison above.Reproduce the coverage and sample-ID measurements with standalone HLSL inputs
In a disposable checkout of either revision, append this test to
crates/compat/d3d12_xs/src/pso_ext_ps_tests.rs. It uses the existing D3D12 draw and readback fixture. Each shader compiles directly with DXC.The pixel counters are total increments, covered samples, full masks, mask
0x5, mask0xa, and partial masks on the diagonal, in that order. The control printed[4160, 16384, 4032, 64, 64, 128]on upstream and[4096, 16384, 4096, 0, 0, 0]on the branch.cargo test -p d3d12_xspasses (one independent baseline failure remains in #63).@QuentinDanblon on GitHub · 2026-11-22 00:07 UTC · original
NVIDIA numbers for this, since the description covers WARP only. RTX 5090, driver 32.0.16.1742, default D3D12 device,
--release. Main is838f43f; "this PR" is your branch merged onto it.per_sample_iteration_runs_the_translated_ps_once_per_sample_like_ps_iter_sample, 3 runssource_coverage_control, pixel counters[4096, 16384, 4096, 0, 0, 0][4096, 16384, 4096, 0, 0, 0][4096, 4096, 4096, 4096][4096, 4096, 4096, 4096]pso_ext::ps::testsSo on this driver the original triangle already produces a single primitive per pixel (no partial masks on the diagonal), which fits your guard-band explanation: the failure is specific to a rasterizer that clips the triangle, and the new geometry gives the same counts on both. The branch merges cleanly with #36, #55 and #61.
Not checked: WARP on my side (the test takes the default adapter), AMD, Intel.
Pull request closed