shader: split shared comparison samplers on Texture2DArray images #1072
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1079"
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-24T00:28:05Z.
Change
split_comparison_sampler()intools/spirv_sampler_split.pynow accepts arrayed 2D images (Texture2DArray) as well asTexture2D, so a standalone sampler shared by depth-comparison and ordinary sampling can be split when the images are arrays. Previously the pass rejected any arrayed image with "only non-array float32 Texture2D sampling is supported". The pass does not touch the coordinate operand, so no other logic changes. Multisampled and 3D images are still rejected.Follow-up to the merged sampler split work (#681, #960, #978). No overlapping open PR found (searched open PRs for sampler and Texture2DArray).
This change was AI-assisted.
Verification
Linux, SPIRV-Tools and SPIRV-Cross from apt:
python3 -B tests/spirv_window/compare_sampler.py spirv-as spirv-val spirv-crossprintsshared and lowered SPIR-V validated; comparison s2, ordinary s5; controls passed.python3 -B tests/spirv_window/check.pypasses.origin/mainwithout thetools/change, the new controls fail with%34: only non-array float32 Texture2D sampling is supported. With the change they pass.spirv-val --target-env vulkan1.2, and SPIRV-Cross emitsTexture2DArray, twoSampleCmpLevelZerocalls on the comparison sampler and oneSampleLevelon the new ordinary sampler.Not run: DXC compile and the GPU readback (Windows only). The GPU stage still runs only the
Texture2Dmodule.Evidence and follow-up
tests/spirv_window/shared_sampler_array.spvasmis synthetic: the existing source-built shared-sampler module edited by hand so both images are arrayed and the coordinate is a float3 at layer 0. The equivalent HLSL is in its header. Same license as the repo.docs/experiments.md.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:28:22Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
e7a90c1ℹ️ 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 Jess-Doit on 2026-11-24T00:56:56Z.
Tested
e7a90c15on Windows 1019045.6456, on a GTX 1060 6 GB (driver32.0.15.6094) and in-box WARP (10.0.19041.5794), with the debug layer enabled, plus a follow-up for the GPU readback you left open.At this head:
ctest --preset dev --no-tests=error -R '^spirv_compare_sampler_' -Vpasses 2/2 (_hardwareon the 1060,_warp). The arrayed module validates (spirv-val --target-env vulkan1.2), and SPIRV-Cross emitsTexture2DArrayhere as well. The GPU stage still reads back only theTexture2Dmodule.Array readback: one commit on top of your head,
Jess-Doit:test/claude-1079-array-readback(8f76ad4e). It only touchestests/spirv_window/compare_sampler.{cpp,py}anddocs/experiments.md. Feel free to cherry-pick it.array/array-<variant>descriptor variant makes t0 and t1 two-layerTexture2DArrayresources with explicit array SRVs. Layer 1 differs from layer 0 in every texel the shader reads: depth 0.875, so both comparisons pass; ordinary 0.3125; mip 1 0.5625.Results, Debug and Release, identical on the 1060 and on WARP:
spirv-val, arrayed shared + split, layers 0 and 1no matching member function for call to 'SampleLevel'(expected)cs_6_0)Texture2Dreference3f800000,00000000,3ec00000, 0/16 mismatches3f800000,3f800000,3ea00000, 0/16 mismatchesGREATER00000000,00000000)MinLOD13f100000, not layer 0's3f200000)The existing
Texture2Ddraws and their controls are unchanged and still pass.git diff --checkandtests/docs_links_check.pyare clean.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T01:07:41Z.
This merged just before my comment above, so the array readback is now its own PR: #1107 (rebased on main, re-tested on the GTX 1060 and WARP).