Repository navigation
rdna2spirv: image_sample_c and image_sample_c_b, depth compares with implicit LOD (EGEN-MIMG-SAMPLE-C) - #2965
Conversation
…implicit LOD (EGEN-MIMG-SAMPLE-C) image_sample_c / image_sample_c_b (and their _o forms) were Unsupported. In a pixel shader they are OpImageSampleDrefImplicitLod (Bias for _c_b); LOD 0 for _c elsewhere. The _c_b address order is bias then z-compare (the parser read the compare first). vk_texture_test now honours LEONIDA_VK_DEVICE. GPU tests ps_sample_c and ps_sample_c_b, semantic tests, design.md row. AI-assisted.
The same pick_device block as ItsNotRexed#2225, so whichever merges first leaves the other a trivial merge there. AI-assisted.
|
Independently tested |
|
Tested
AI-assisted |
|
Tested The sample-C and texel-offset suites passed, including the explicit bias and unsupported-form assertions. This run used the CPU tests. AI-assisted, synthetic inputs only. |
|
Independent check on an AMD Radeon RX 7800 XT (gfx1101, driver 32.0.32029.2010, Windows 11), at Pass. Rebuilt Two extra checks that the pass is not just the harness being generous:
Also on this tree: One limitation of my run, not of the PR: |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): No problems found. ctest on the RTX 4080 SUPER: 129/129 passed. Intel UHD 770 ctest: only the two known base failures, d3d12_descriptor (fixed by #2948) and d3d12_subgroup (fixed by #2934). d3d12_present also failed once in the full Intel run but is intermittent under load (passes alone on Intel). |
tools/rdna2spirv.py AI-assisted.
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-MIMG-SAMPLE-C, #2716 (comment)
What and why
image_sample_c(HLSLSampleCmp, the usual PCF shadow tap) andimage_sample_c_bwere refused withUnsupported; onlyimage_sample_c_lz(and_c_lz_o) translated. The image-op code already parsed the compare and bias operands for these kinds but had no emission branch, so this adds it:image_sample_cin a pixel shader isOpImageSampleDrefImplicitLod;image_sample_c_baddsBias. The_oforms add the texelOffset(or, with--texel-offset-fallback, the existing coordinate shift with aGradsample of the unshifted coordinate's derivatives, scaled by2^biasfor_c_b). The result is one value: f32 bits, or an f16 in the low half withd16, as for_c_lz.image_sample_csamples LOD 0 (asimage_sampledoes),image_sample_c_bstaysUnsupported._c_b, which no path reached before.ps_sample_c_bfails on that (a bias of 1.0 read as the reference compares false everywhere); the a16 branch already assumed bias first.vk_texture_testignoredLEONIDA_VK_DEVICE(it kept its own rank loop), soLEONIDA_VK_DEVICE=radeonran the texture tests on the RTX 5080. It now usespick_devicelike the other harnesses; a filter that names no GPU exits 1 as invk_compute_test. This hunk is the same as the one in GPU tests: image_sample_l, image_sample_b_o, image_sample_c_lz_o, image_gather4_lz, image_load_mip #2225 (character for character, apart from my modes in the neighbouring lines), so whichever of the two merges first leaves the other a trivial merge there; this PR does not depend on GPU tests: image_sample_l, image_sample_b_o, image_sample_c_lz_o, image_gather4_lz, image_load_mip #2225.Left out:
image_sample_c_l(#2685),_cl, and the compare samples with gradients (_c_d,_c_cd), still refused.image_sample_c_bis covered with its own GPU test but a one-level texture cannot show a bias changing the mip; the operand order and the Bias operand are what the tests pin.Tested
ps_sample_candps_sample_c_b(hand-written, the D32 depth texture and comparison sampler ofps_sample_c_lz; all 4096 pixels exact for the f32 result and the d16 one) through newvk_texture_testmodesdref_canddref_c_b; derivation in each header.main: both fail with "missing .spv (translation failed)". With this change:device: NVIDIA GeForce RTX 5080): 4/4 of--filter ps_sample_c(the two new tests,ps_sample_c_lz,ps_sample_c_lz_a16).device: AMD Radeon(TM) Graphics, selected withLEONIDA_VK_DEVICE=radeonnow that the harness honours it): 4/4.ps_sample_c_bon the Radeon (2048 of 4096 pixels wrong) and the semantic order test; replacing the reference with 0 failsps_sample_c. Both reverted.tests/semantic/test_sample_c.py: Dref implicit LOD, Bias, Offset, d16, LOD 0 outside the PS, the_c_brefusal there, the bias-before-compare order, spirv-val.tests/test_texel_offsets.pygains the_c_o,_c_b_oand a16 forms (signed offset fields, and the fallback's Grad Dref sample).python -m unittest discover -s tests/semantic,python tests/semantic/regen_fixtures.py --check,python -I tests/test_shader_checks.py,pytest tests/test_translate.py tests/test_texel_offsets.py: pass.Checklist
docs/design.md, with how it was confirmed.AI-assisted.