Repository navigation
Shaders: quad reads at a triangle edge without the console's compiler - #3583
kilolimaVI wants to merge 4 commits into
Conversation
flow_tests draws the derivative and quad-read cases from console-compiled HLSL, so it needs the console SDK's dxc.exe and most machines skip it. quad_read_tests hand-assembles the same shapes: each pixel computes a key from its position and reads its x, y and diagonal neighbours' keys with DPP quad_perm, on a triangle whose edge crosses quads (helper lanes), and again after the console's form of a discard (v_cmpx, s_andn2 of the live mask, s_cbranch_scc0 to a null export, s_wqm), whose killed pixels stay helpers and must not be written. wave32 and wave64, hardware and WARP. Radeon 780M (RDNA3) and WARP at 63bcca4: edge 136 pixels, discard 104, 0 wrong in all eight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lod_tests takes image_get_lod of coordinates linear in the pixel position (u = 0.3 x, v = 0.11 y of a 16x16 texture, so log2(4.8) at every pixel) next to a triangle edge and next to pixels the console's form of a discard killed: their helper lanes must compute the coordinates the derivatives take. wave32 and wave64, hardware and WARP, tolerance 0.02 of a level. Radeon 780M (RDNA3): 2.2617 at all 136 / 104 pixels (the level in 1/256 steps); WARP 2.2630; 0 wrong in all eight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified exact production/test head c7661dd on a physical RTX 4060 Laptop under Linux/Wine. This is the updated triangle-edge LOD head, not earlier 2169264. Linux 6.17, i7-13620H/16 GiB, RTX 4060 Laptop 8 GiB/NVIDIA 590.48.1, Wine 11.0, diagnostic-relaxed-vtable vkd3d-proton 2576c0b4adfae4a+ (not stock certification), DXVK NVIDIA masking disabled. Local edits are test-only: mandatory SDK DXIL validator and non-software NVIDIA/dedicated-VRAM checks, removal of duplicate Wine-WARP legs, full coverage counters, and explicit finite-value checks for both LOD outputs (NaN must not pass tolerance comparisons). Owner instructions and expected values unchanged. cargo-victory-wine.sh test -p victory-shader --features host --lib triangle_edge -- --nocapture --test-threads=1 2/2 pass, zero ignored, 1.39 s after fresh intended-worktree compilation 5.90 s. Both quad-neighbour and LOD tests execute wave32/wave64 x edge/discard: 8 hardware draws, 10 mandatory shader validations, 2048 pixel slots inspected. Each test has 136 drawn pixels per edge case and 104 per discard case, 480 drawn pixels total, zero wrong. Quad checks 2464 scalar components; LOD checks 1984 (4448 combined). LOD expected unclamped 2.2630, actual 2.2656 in all four cases within the owner's 0.02 tolerance; clamped output 0. Evidence: .compat-runtime/logs/verify-verify-victory3583-triangle-edge-20261127T192814Z/{console.log,result.json,command.json,resources.jsonl}. Sampled GPU peak147 MiB, available RAM minimum11227 MiB, disk minimum12.145 GiB; guards unchanged. These are synthetic helper/discard/derivative pixel oracles, not native 64-lane hardware, WARP coverage, a matched-parent regression result, or retail rendering/FPS proof. No production lowering modified and no title launched. |
A NaN compares false with the tolerance, so it passed; the levels must also be finite (pointed out by pickles976). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, the RTX 4060 numbers are a useful pair with the 780M: NVIDIA rounds the level up to 580/256 (2.2656), RDNA3 down to 579/256 (2.2617), both inside the 0.02 tolerance. And you're right that a NaN compared false and passed; the LOD test now also requires both levels to be finite. AI-assisted (Claude). |
|
Added
The exact cases are 0 wrong on both. So RDNA3 snaps a gather's coordinate more coarsely than a point sample's (it rounds up from 1/1024 below), and WARP doesn't: near texel boundaries a gather ( AI-assisted (Claude). |
gather_tests looks up at t = x + d texels in u and v over a 16x16 texture whose texels hold their index, with image_gather4_lz (footprint at floor(t), half a texel back) and image_sample_lz with a point sampler (texel at floor(t)). At d 0.25 and 0.75 every host must take floor(t). Just below a boundary (d = -1/1024) it reports, without failing, whether the host rounds t up to x or keeps it below. Radeon 780M (RDNA3): gathers 256 of 256 round up, point samples 256 of 256 stay below; WARP: both stay below. Exact cases 0 wrong everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Follow-up for the gather numbers: #3613 fixes the boundary case this PR's On the 780M + WARP: before, WARP took the footprint one texel back at 1/1024 and at the 1/512 tie below an edge; after, both hosts are 256/256 in all six cases. @pickles976 if you still have the 4060 set up, the most useful run is on #3613's branch: AI-assisted (Claude). |
flow_testsanddiff_testsdraw the derivative, quad-read and level-of-detail cases (including the triangle-edge ones from 4015a18) from console-compiled HLSL, so they need the console SDK'sdxc.exe, and most contributors' machines skip them silently. This adds hand-assembled versions that run anywhere.Quad reads (
emit/quad_read_tests.rs)quad_reads_at_a_triangle_edge_reach_helpers_and_killed_pixels: each pixel computes a key from its position and reads its x, y and diagonal neighbours' keys with DPPquad_perm([1,0,3,2],[2,3,0,1],[3,2,1,0]), as the console compiler takesddx_fine/ddy_fineandQuadReadAcross*. Drawn as a triangle whose edge crosses quads (16x16):v_cmpxof the killed lanes,s_andn2of the live mask,s_cbranch_scc0to a null export,s_wqmof the live mask). Killed pixels stay helpers: their neighbours read their keys, and they must not be written.Levels of detail (
emit/lod_tests.rs)levels_of_detail_at_a_triangle_edge_and_after_a_discard:image_get_lodof coordinates linear in the pixel position (u = 0.3 x,v = 0.11 yon a 16x16 texture, so log2(4.8) = 2.2630 everywhere), next to the same edge and after the same discard, so the helper lanes must compute the coordinates the derivatives take. Tolerance 0.02 of a level.Results at main 63bcca4
Both in wave32 and wave64, on the hardware adapter and WARP:
(Before 4015a18 the edge case is where an RX 6700 XT read 0 from helpers.)
Only the two new files and their
modlines; no change in behaviour. Clippy clean with default and all features.AI-assisted (Claude).