Repository navigation
dxil: emulate explicit-LOD gather4_l(_o) and support UNORM=1 non-cube sampling - #1951
raylitebull wants to merge 1 commit into
Conversation
|
Checked on an RTX 3070 (Ampere, driver 616.56, Windows 11, debug build) at The batch run is clean:
The last row comes from Overlap: #1812 (brothernog, open and mergeable) already does explicit-LOD AI-assisted (Claude Code). Synthetic tests only. |
940c51b to
e201efe
Compare
|
Thanks for the thorough pixel check and catch, Updated
Verified locally with Re |
|
Regression run for this PR: head main this PR: No device removals or crashes; 99 % of main's frames, 102 % of its peak commit. Not tested: the whole suite; the direct DXIL path this PR changes (these runs use the default HLSL path, Written with Claude Code (Claude Opus 5.5) from runs on this machine. |
|
Quick overlap note: full credit to #1812 (@brothernog), which already implements explicit-LOD #1951 adds Direct DXIL support for |
|
Re-checked
Both points are fixed on hardware. The overlap with #1812 for the AI-assisted (Claude Code). Synthetic tests only. |
|
Heads-up on overlap, from reading the diff, not from a run: #1812, opened earlier, emulates the same Two differences:
One way to split it: #1812 for the uncompared This comment was AI-assisted. |
|
Thanks for the detailed comparison, @brothernog! Agreed on the clean split: once #1812 lands for uncompared explicit-LOD \gather4_l\ / _l_o\ across HLSL and Direct DXIL (including \T# MIN_LOD\ floor handling), we will rebase and trim #1951 strictly down to the non-overlapping \gather4_c_l\ / _c_l_o\ compare forms and non-cube \UNORM=1\ sampling paths. |
… guard, and UNORM=1 sampling
e201efe to
ff184be
Compare
|
Thanks for catching the missing T# Updated
Pushed |
|
Re-checked AI-assisted (Claude Code). Synthetic tests only. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Tested Verified PR #1951 from a clean checkout at
cargo test -p xcl --lib gpu::dxil::lower_image::gather4_lod_tests::non_cube_unorm_sampling_translates_and_validate -- --exact --nocapture1 passed, 0 failed, 0 ignored, 0 skipped (1,066 filtered out, Cargo exit 0). The one fixture translated seven synthetic Not tested GPU execution, numerical sampling or pixel parity, bounds behavior, the explicit-mip AI use T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixture and wrote this report. |
Emulates explicit-LOD
image_gather4_l/image_gather4_l_o/image_gather4_c_l/image_gather4_c_l_o(plus_clclamp,A16,D16, andUNORM=1/FORCE_UNORMALIZED) in the direct RDNA2 -> DXIL translator across all 8 RDNA2 address modes, and adds non-cubeUNORM=1coordinate normalization forsample*andgather4*.Part of #1269 and #1833.
What is in it
crates/xcl/src/gpu/dxil/lower_image.rs(mimg_gather4_lod,apply_rdna2_addr_mode,apply_depth_compare): emulate explicit-LODgather4_l(_o)onTexture2DandTexture2DArrayvia 4 mip-leveldx.op.textureLoadtaps in hardware gather order(-,+), (+,+), (+,-), (-,-)honoring all 8SQ_TEX_CLAMPaddress modes, S# signed S5.8LOD_BIAS(s2[13:0] / 256.0), T#MIN_LOD(tw1[19:8], u4.8 /256.0—MIP_FILTER=nonereadsfloor(T# MIN_LOD)at every LOD, and filtered samplers raise S#-clamped LOD toT# MIN_LODbefore half-up rounding), S#[min_lod, max_lod]+mip_filter == 0clamping, RDNA2 half-up mip rounding (floor(lod + 0.501953125)=257/512,0x3F00_8000) +GetDimensionsmip count, signed 6-bit texel offsets (has_o), S# border color types (s3[31:30]),SQ_TEX_DEPTH_COMPARE(s0[14:12]), and#1969's MIMG heap-bounds guard (self.guarded(run, ...)).crates/xcl/src/gpu/dxil/lower_image.rs(mimg_unorm_sample): normalize unnormalized texel coordinates (and optional signed 6-bit offsets) via mipGetDimensionsfor non-cube textures (D1,D2,D3,D1Array,D2Array) before DXIL sample/gather emission, with#1969heap-bounds guard (safe_tw0forimplicit_lod).gather4_lod_tests:gather4_lod_variants_translate_and_validate,gather4_lod_emits_bias_and_rdna2_half_up_rounding,gather4_lod_honors_tsharp_min_lod_and_mip_filter_none, andnon_cube_unorm_sampling_translates_and_validate.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased cleanly ontoae0518c(ff184be).ff184beintegrates the T#MIN_LODfix (@brothernogcatch) and#1969heap-bounds guard atopae0518cvia pure git during a local test hold; queued for GitHub ActionsBuild and testand fresh AMD / NVIDIA verification (gather4_lod_tests).e201efepassedcargo check --workspace --tests,gather4_lod_tests(3/3), and@upipibi's 5-case DXIL verification.Regression run
scripts/smoke.ps1pair and tests onff184bevsae0518chave not been run yet. AMD and NVIDIA reviewers are invited to rungather4_lod_tests,scripts/smoke.ps1, and pixel tests onff184bevsae0518c(includingXCL_DIRECT_DXIL=1) and post results in the comments.Not tested
cargo check/gather4_lod_testsandscripts/smoke.ps1on updated headff184be, runtime GPU pixel comparison against HLSL on AMD / NVIDIA / Intel hardware, wave32-only adapters, and Linux/Wine/vkd3d-proton.AI use