Preserve comparison sampling through the SPIR-V to HLSL bridge #664
Closed
opened 2026-11-22 18:47:57 +00:00 by R0Y00
·
6 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
R0Y00/Xbox2Windows#664
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 R0Y00 on 2026-11-22T18:47:57Z.
Why this is on the integration path
#656 unblocked subgroup ballot extraction in the external-frontend bridge. In the fixed-profile follow-up scan, all 807 affected compute records emitted HLSL. DXC accepted 29, timed out on 42, and rejected 736. The first diagnostic in the rejected group points to a texture sampling call using a comparison sampler. This identifies a common compile blocker. The supported operation and its output still need an independent comparison.
First implementation
Identify the SPIR-V image operation and sampler type that cause one representative failure. Reproduce it with a small source-built compute fixture and a known depth texture. Keep ordinary sampling and comparison sampling distinguishable across HLSL emission and descriptor binding. Match the reference, coordinate and LOD semantics of the selected form. Record which forms the fixture exercises and reject unsupported variants with a specific diagnostic. Extend the existing bridge tests around #553 and #656.
Acceptance
You can claim the public reproducer or the lowering and binding change. Leave the first failing command and your proposed interface in a comment before opening the PR. Refs #218 and #656.
Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T19:00:29Z.
Public compile-stage reproducer for #670. Both source-built modules validate under Vulkan 1.2. With one sampler ID used by both sampling forms, pinned SPIRV-Cross emits a
SamplerComparisonStateand passes it to ordinarySampleLevel. DXC rejects that call. With separate sampler IDs, DXC compiles successfully.Tested locally on Windows 11 25H2 x64
26200.9974at Xbox2Windowsedc2e54e7e75fcd7c0f13e98b47ba119d9a08268. Tools: SPIRV-Toolsv2025.5with its pinned headers, SPIRV-Cross57e4efcc84112abcd426dc5ec248b5339bee04f2, and DXC1.8.2502.8. AI-assisted.Save as
source.hlsl:The first failing command was
dxc -T cs_6_6 -E main -Fo shared.dxil shared.hlsl. First diagnostic:The comparison instructions here are
OpImageSampleDrefExplicitLodwith literalLod 0. The ordinary control isOpImageSampleExplicitLodwithLod 0. For a follow-up, I propose carrying sampler kind per use through the named bridge profile so the host can bind an ordinary sampler and a comparison sampler in separate slots. Keep the first implementation toTexture2D<float>and literal zero LOD. With point-clamp sampling, a constant0.5depth,LESS_EQUAL, and a separate ordinary texture of value0.375, the proposed dispatch reference is[1.0, 0.0, 0.375]followed by unchanged guards. The evidence here covers SPIR-V validation, HLSL emission, and DXC compilation. GPU dispatch and correspondence to the private scan are still unverified.Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T19:03:24Z.
GPU readback follow-up to the compile-stage reproducer. I dispatched its validated, cross-compiled separate-sampler shader using a standalone D3D12 host. AI-assisted, run locally.
Windows 11 25H2 x64
26200.9974, Xbox2Windows checkoutedc2e54e7e75fcd7c0f13e98b47ba119d9a08268, MSVC19.44.35230, SDK10.0.26100. Same SPIRV-Toolsv2025.5, SPIRV-Cross57e4efcc84112abcd426dc5ec248b5339bee04f2, and DXC1.8.2502.8as above. Tested RX 9070 XT (1002:7550, driver32.0.32029.2010) and WARP (1414:008c,10.0.26100.9818). Both reporteddebug_layer=unavailable.One
cs_6_6dispatch per backend. The host bound 2×2R32_FLOATSRVs att0/t1, a point-clamp comparison sampler (LESS_EQUAL) ats2, a point-clamp ordinary sampler ats3, and a raw output buffer atu4. At UV(0.25, 0.25), the shader compares references0.25and0.75against depth0.5and samples ordinary value0.375.Both backends returned
3f800000,00000000,3ec00000(1.0, 0.0, 0.375), with all 13 guard words unchanged and zero mismatches or skips. Changing only the CPU reference at word 1 gave exactly one mismatch on each backend (expected=3f800000 actual=00000000).Reproduce from a directory containing
separate.dxilgenerated by the earlier comment and the host source below saved ascompare-readback.cpp:This verifies the GPU behavior of the separate-sampler control. The shared-sampler lowering and repository CTest integration are still open.
Standalone D3D12 readback host
Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T19:06:34Z.
Sampler-split prototype follow-up. Starting from
shared.spvasmin the compile-stage reproducer, the prototype adds an ordinary sampler at set 0 binding 5, leaves the comparison sampler at binding 2, and redirects only the ordinaryOpSampledImageto the new sampler. The host takes the two slots as separate binding kinds. This is an opt-in scratch pass for the direct, non-arrayTexture2D<float>compute profile with literal LOD 0.The transformed SPIR-V passed Vulkan 1.2 validation. Pinned SPIRV-Cross emitted
SampleCmpLevelZerowiths2andSampleLevelwiths5. DXC compiled the result ascs_6_6. On the RX 9070 XT and WARP, both comparison outputs and the ordinary sample were[1.0, 0.0, 0.375], with all 13 guards exact. The wrong reference failed only at word 1 (expected=3f800000 actual=00000000). An occupied binding and a nonzero comparison LOD were rejected. The already-separated input was preserved, and the four existing address-window/ballot hardware and WARP CTests passed with zero skips.Run locally on Windows 11 25H2 x64
26200.9974at Xbox2Windowsedc2e54e7e75fcd7c0f13e98b47ba119d9a08268. MSVC19.44.35230, SDK10.0.26100, Python3.12.10, SPIRV-Toolsv2025.5, SPIRV-Cross57e4efcc84112abcd426dc5ec248b5339bee04f2, DXC1.8.2502.8. RX 9070 XT1002:7550driver32.0.32029.2010, WARP1414:008cdriver10.0.26100.9818. Debug layer unavailable on both. AI-assisted.Save the prototype below as
split_sampler.py. For the previous standalone host, changes.ShaderRegister = 2 + i;tos.ShaderRegister = i == 0 ? 2 : 5;for this run.Repository integration still needs agreement on who allocates the extra sampler slot and how the bridge passes it to the host. This run covers the source-built profile only.
SPIR-V sampler-split prototype
Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T19:17:22Z.
Proposed interface for the sampler split: host-reserved ordinary-sampler slot
Following up on the prototype in https://github.com/R0Y00/Xbox2Windows/issues/670#issuecomment-7084115150, which left open who allocates the extra sampler slot. I'd like to claim the lowering and binding change, and I'm checking the interface first, as the issue asks.
Proposal. The host reserves a free ordinary-sampler slot and passes it explicitly to the lowering pass. The pass does not choose a slot itself.
(descriptor set, ordinary binding)supplied by the host. The prototype exposes this as--ordinary-binding N.OpImageSampleExplicitLoduses are redirected to a newUniformConstantsampler at the supplied binding, in the same descriptor set.descriptor_set,comparison_bindingandordinary_bindingso the host can bind an ordinaryD3D12_SAMPLER_DESCand a comparison one in separate slots.Scope. Direct, non-array
Texture2D<float>sampling in compute, at literal LOD 0 only:OpImageSampleExplicitLodandOpImageSampleDrefExplicitLodwith a constant zeroLod, from a standaloneUniformConstantsampler declared in the entry-point interface. Arrays, other formats, non-constant or nonzero LOD, graphics stages and sampler kinds reached through function parameters are rejected and stay out of scope.Question. Does a host-supplied slot fit the bridge's binding contract? If the bridge should own allocation instead, for example by taking the lowest free binding in the set or by using a fixed reserved range, I'll follow that. If the slot should be recorded in the named bridge profile rather than passed as an argument, I'll do it that way.
If agreed, the PR would add:
cs_6_6, and dispatches on WARP and a physical adapter. It checks the three outputs[1.0, 0.0, 0.375], all 13 guard words, and a wrong-reference control that must fail at exactly word 1. The hardware leg returns 77 when no capable adapter is present;What this covers. These results are from the public source-built fixture only. I have not measured the effect on the 807-record compute cohort from https://github.com/R0Y00/Xbox2Windows/pull/656#issuecomment-7084115192; the maintainer can rerun that cohort after integration. The separate CS package WARP readback discrepancy in that comment is unrelated to this change and remains open. This does not touch #671 or #560.
AI-assisted. Prepared with an AI coding assistant; all commands were run locally on Windows 11 with an RX 9070 XT and WARP.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T19:21:17Z.
The host-reserved binding is the right boundary for this opt-in profile. Please proceed with a focused PR from the shared-sampler reproducer. Keep the original comparison binding and require the caller to supply a free ordinary-sampler binding in the same descriptor set. Emit the binding mapping for the host and keep modules outside this profile on the existing path.
For the first PR, keep the tested scope to direct, non-array
Texture2D<float>compute sampling with literal LOD zero. Include the occupied binding, nonzero comparison LOD, and already-separated controls from your prototype. Register the source-built compile and readback checks with the existing bridge fixtures. Link the failing DXC diagnostic and your WARP/RX 9070 XT results so the implementation can be reviewed independently. The 807-record rescan can follow once the public fixture is in place.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T21:58:45Z.
The scoped bridge implementation merged in #681. At
6f620f7the source-built fixture passed all eight SPIR-V tests across WARP and RX 9070 XT. The same fixture demonstrates the unsplit DXC failure, valid SPIR-V and DXIL after the split, ordinary and comparison readbacks, and wrong-reference and descriptor controls. Closing the focused implementation as complete. The 807-record fixed-profile rescan remains a separate measurement and has no new result here.