shader: accept gathers in the SPIR-V sampler split #1325
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1332"
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-24T08:24:07Z.
What
split_comparison_sampler()now acceptsOpImageGather(an ordinary use: it moves to the new plain sampler) andOpImageDrefGather(a comparison use: it stays on the comparison sampler) on a sampler shared by comparison and ordinary sampling. Accepted only without image operands, only on 2D, 2D array, cube and cube array images, and theOpImageGathercomponent must be an integerOpConstantfrom 0 to 3. Everything else, including the checks for the existing sample ops, is unchanged.Why
A module that gathers on a shared sampler was refused as an unsupported use. D3D12 has Gather and GatherCmp for exactly these image forms, so the split can route each gather to the sampler kind it needs.
Tested
Windows (not run locally):
ctest --preset pr --no-tests=error -R spirv_compare_sampler_warp. The Windows/WARP run was NOT done locally. The GPU stage was not extended: it does not read gathered texels, so a gather reading the wrong component or texel would not be caught there, and DXC acceptance of the gather calls is not checked.Linux (ran):
python3 -B tests/spirv_window/compare_sampler.py spirv-as spirv-val spirv-cross(split, spirv-val, spirv-cross: GatherRed/Green/Blue/Alpha on the plain sampler, GatherCmp on the comparison sampler; negative controls for image operands, 1D/3D gathers, non-float32, bad component, mixed kinds; the unsplit gather is rejected by the HLSL check; a temporary mutation routing the ordinary gather to the comparison kind failed the test),tests/spirv_window/check.py,tests/docs_links_check.py,tests/bidi_controls_check.py, py_compile.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T08:36:29Z.
Review: CHANGES_REQUESTED
The new revision keeps assembly and SPIR-V validation on Linux and isolates the known older SPIRV-Cross limitation. The protected Windows job passes, but compile_dxil still enumerates only the old sample modules, and draw never runs a gather module. Please require both a plain gather and a comparison gather on the supported Windows path. Use a source-built 2x2 fixture whose four texels and at least two channels differ, check all four returned values, and include a wrong component or comparison reference. Keep the current SPIR-V controls on Linux; those cannot show DXC acceptance or readback order.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:26:54Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
2cb2312ab870ae616b0daadcf59dab86622e192b:--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6):3.62s(configure1.48s)ctest --preset dev -R '^spirv_compare_sampler_warp$' --no-tests=error --output-on-failure): 1/1 passed (3.19s)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6):0.94s(configure1.59s)ctest --preset release -R '^spirv_compare_sampler_warp$' --no-tests=error --output-on-failure): 1/1 passed (3.16s)Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T08:28:32Z.
The Linux check fails in the pinned Ubuntu SPIRV-Cross when it emits HLSL for the comparison gather: “GatherCmp does not exist in HLSL.” Please keep all generated modules assembled and validated on Linux. Separate the backend capability from SPIR-V validation and keep the comparison gather HLSL compile and readback required on the supported Windows toolchain. CI should still fail for any other compile error or if comparison gather unexpectedly stops working on that Windows path.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:32:07Z.
Re-verified at
ce8d9d00746d855b3a73e4a54d10fc602626bc78on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):--preset dev):offscreen_checkbuild9.20s;ctest --preset dev -R '^spirv_compare_sampler_warp$' --no-tests=error --output-on-failure: 1/1 passed (3.23s)/O2(--preset release):offscreen_checkbuild6.53s;ctest --preset release -R '^spirv_compare_sampler_warp$' --no-tests=error --output-on-failure: 1/1 passed (3.14s)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:27:02Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
ce8d9d0ℹ️ 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 tedin7 on 2026-11-24T08:46:58Z.
@R0Y00 Addressed in
f26519a5aa03efacffb77fdb5031be7047ff7814:compile_dxilanddrawnow require both a plain gather and a comparison gather on the supported Windows path against a source-built 2x2 fixture with four distinct texels and multiple channels, verifying all four returned values plus a negative control, while keeping SPIR-V assembly/validation on Linux.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at
f26519a5aa03efacffb77fdb5031be7047ff7814:--preset dev):offscreen_checkbuild10.18s;ctest --preset dev -R '^spirv_compare_sampler_warp$' --no-tests=error --output-on-failure: 1/1 passed (4.10s)/O2(--preset release):offscreen_checkbuild7.51s;ctest --preset release -R '^spirv_compare_sampler_warp$' --no-tests=error --output-on-failure: 1/1 passed (4.09s)Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T09:05:03Z.
Review: APPROVED
Verified the Windows CI run executes the comparison-sampler CTest. This head requires DXC for both gathers, checks every returned word, and detects a wrong component, comparison reference and texel order. Linux still assembles and validates the modules with its older emitter.