startup: lower image_sample_c and image_sample_c_lz on a 2D array #1704
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1711"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:35:46Z.
Part of the refusal triage in #870. No open issue or pull request covers this form.
Change
image_sample_candimage_sample_c_lzondim:SQ_RSRC_IMG_2D_ARRAY(the shadow-cascade form) were refused withimage_sample_c[_lz] on SQ_RSRC_IMG_2D_ARRAY. The address dwords are the reference, u, v and the slice. The lowering binds aTexture2DArray<float4>(manifest kindtex2da) and emits:It uses the same constant comparison sampler as the 2D form. Unchanged: the sampler profile,
dmask:0x1, the modifier refusals, MAX_LOD 0 for the implicitimage_sample_c, andimage_sample_c_l(refused, shader model 6.7). The slice is converted the wayimage_sampleconverts it on the same type. Onlytools/startup/gfx2hlsl.pyimage_comparechanges (+12/-7); other open PRs on that file edit other hunks.Verification
tests/startup_image_sample_c_check.pygains eight source-built fixtures (array,array_nsa,array_c,array_c_full,array_c_l,array_dmask3,array_offset,array_unorm) with words checked againstllvm-mc-19. It requires the exact call (reference v0 at (v1, v2), slice v3; NSA[v3, v0, v1, v2]reference v3, slice v2), theTexture2DArraydeclaration and thetex2damanifest line.Linux (
1715ef09):Seven edited array lowerings must fail the exact call check (slice dropped, slice from the reference register, slice from the wrong register, slice exchanged with v, reference swapped with u, plain
Texture2D,SampleCmp); all seven fail. Local mutations oftools/startup/gfx2hlsl.py('tex2da' -> 'tex2d'and slice registercs[3] -> cs[2]) each maketests/startup_image_sample_c_check.pyfail; the tree was restored after each. Also run and passing on Linux:startup_image_2d_array_check.py,startup_image_sample_l_check.py,startup_image_3d_check.py,startup_gfx2hlsl_smem_offset_check.py,startup_translator_check.py,docs_links_check.py,bidi_controls_check.py,git diff --check origin/main...HEAD.Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
1715ef09:--preset dev):cmake --build --preset dev --target startup_sampler_comparison_check offscreen_check -- -j 6(3.36s)ctest --preset dev -R '^(startup_image_sample_c|startup_sampler_comparison|startup_image_2d_array_controls|startup_image_2d_array_warp|startup_image_sample_l|startup_image_3d_controls|startup_image_3d_warp|startup_image_load_mip_warp|startup_gfx2hlsl_smem_offset|startup_translator)$' --parallel 4 --no-tests=error --output-on-failure: 10/10 passed (3.20s)/O2(--preset release):cmake --build --preset release --target startup_sampler_comparison_check offscreen_check -- -j 6(1.11s)ctest --preset release -R '^(startup_image_sample_c|startup_sampler_comparison|startup_image_2d_array_controls|startup_image_2d_array_warp|startup_image_sample_l|startup_image_3d_controls|startup_image_3d_warp|startup_image_load_mip_warp|startup_gfx2hlsl_smem_offset|startup_translator)$' --parallel 4 --no-tests=error --output-on-failure: 10/10 passed (3.20s)What this does not establish
llvm-mcrejects it), so that refusal path is untested.Also checked
The
SQ_RSRC_IMG_1Drefusals counted on #870 (2 of 29) use the textimage dimension SQ_RSRC_IMG_1D, which main no longer produces since #1630 lowers a one-coordinateimage_sample. A stale cache or an older build would still show it. 1Dimage_sample_lz,image_sample_landimage_loadare still refused withunverified 1D image sample address or modifiers; which opcode the two shaders use is not stated on #870.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T17:45:51Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
1715ef0ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T18:47:40Z.
The synthetic encodings and generated slice/address checks pass. Please extend the existing 2D-array fixture with two slices with different depths and a single reference between them. Run the translated comparison on WARP and one physical adapter, and require an always-slice-zero or swapped-slice control to differ. That will also verify the tex2da/comparison-sampler binding through execution.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:11:34Z.
@R0Y00 Extended the existing 2D-array fixture in
439333acd2dcbbdd4f9f99bb0aaba500a75ae681to draw and read back translated 2D-array depth comparisons throughtex2da+smpcbindings:Fixture (
tests/startup_image_3d.cpp,tests/startup_image_2d_array_check.py):--startup-image-2d-arrayreceives a comparison sampler manifest line (smpc),check_startup_image_3dbinds a 2x2 two-sliceDXGI_FORMAT_R32_FLOATTexture2DArrayholding the fixture's red channel as depth: at(u=0.75, v=0.25)(texel(1, 0)), slice 0 =0.25and slice 1 =0.75.image_sample_c_lzandimage_sample_c(MAX_LOD 0) with a single reference0.5between the two slice depths and manifest samplersmpc 0 0x8001012 0x0 0x0 0x0(point clamp,LESS,TRUNC_COORD=1).offscreen_check --startup-image-2d-arraywith DXCps_6_0and FXCps_5_1), slices0/0.25read back0.0(00000000,00000000,00000000,00000000) and slices1/0.75read back1.0(3f800000,3f800000,3f800000,3f800000), checkingdebug_errors=0 debug_warnings=0when the debug layer is enabled.image_sample_c_lzandimage_sample_c, DXC and FXC):always slice 0(float3(F(v1), F(v2), 0.0)): drawn atz=1expecting1.0, fails readingactual=00000000,00000000,00000000,00000000.swapped slice 0->1/swapped slice 1->0(float3(F(v1), F(v2), 1.0 - F(v3))): drawn atz=0expecting0.0fails readingactual=3f800000,3f800000,3f800000,3f800000; drawn atz=1expecting1.0fails readingactual=00000000,00000000,00000000,00000000.Verified locally:
llvm-mc-19):python3 -B tests/startup_image_2d_array_check.py— PASS (image_sample_c[_lz]: Texture2DArray r0, r0.SampleCmpLevelZero(q0, float3(F(v1), F(v2), F(v3)), F(v0)) with v3 = ud1; manifest srv 0 tex2da, smpc 0 0x8001012 0x0 0x0 0x0)python3 -B tests/startup_image_2d_array_check.py binary llvm-mc-19— PASS (fixture words match llvm-mc)python3 -B tests/startup_image_sample_c_check.py&binary llvm-mc-19— PASSpython3 -B tests/docs_links_check.py,python3 -B tests/bidi_controls_check.py,git diff --check— PASS439333acd2dcbbdd4f9f99bb0aaba500a75ae681:--preset dev):cmake --build --preset dev --target offscreen_check startup_sampler_comparison_check -- -j 8(4.91s),ctest --preset dev -R '^(startup_image_2d_array_|startup_image_3d_|startup_inline_sampler_|startup_image_sample_c$|startup_sampler_comparison$)' --parallel 6 --no-tests=error --output-on-failure— 11/11 passed (5.84s;startup_image_2d_array_warp5.76s)./O2(--preset release):cmake --build --preset release --target offscreen_check startup_sampler_comparison_check -- -j 8(2.67s),ctest --preset release -R '^(startup_image_2d_array_|startup_image_3d_|startup_inline_sampler_|startup_image_sample_c$|startup_sampler_comparison$)' --parallel 6 --no-tests=error --output-on-failure— 11/11 passed (5.77s;startup_image_2d_array_warp5.68s).Assemble and translate gfx1013 fixtureswithllvm-mc-15,Run platform-independent Python checks on Linux,Build and test on Windows).startup_image_2d_array_hardwareis registered in CTest and ready to confirm on a physical adapter (ctest --preset release --no-tests=error -R '^startup_image_2d_array_hardware$' -V).AI-assisted; commands listed were executed locally.