native compute: accept comparison static samplers (smpc) on the in-process route #3075

Closed
opened 2026-11-27 14:18:02 +00:00 by Not-Saii · 1 comment
Not-Saii commented 2026-11-27 14:18:02 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-27T14:18:02Z.


Part of #2935 (its "Samplers" item, which is not filed yet).

Problem. On main at e1ea515d, the in-process native compute route (X2W_NATIVE_SHADERS, src/startup_stubs/d3d12_compute_dispatch.inl) refuses any manifest line that starts with smpc and returns a comparison sampler (lines 174-175). The pieces on both sides already exist:

  • The native translator accepts constant comparison samplers in compute (sampler_index, src/gfx1013_compute_native.cpp), for example image_gather4_c_lz since #2971, and src/direct_compute_cache.cpp writes them as smpc lines.
  • TranslatedSamplers::read_manifest_line and decode_statics (src/startup_stubs/translated_sampler_bindings.h) already parse smpc and decode it to a comparison static sampler for the draw path.

So a compute request that the translator compiles is still sent back to the gfx2hlsl.py fallback at its first Dispatch because of its sampler line.

Plan.

  1. Accept smpc <i> <w0> <w1> <w2> <w3> in the route under the same index and whole-line checks as smp and smpl, through read_manifest_line.
  2. Leave smpheap refused under its current message. The sampler-heap path is a separate item.

Test (source-built only). A compute fixture that compiles a comparison gather or sample with a constant comparison sampler and runs it through the in-process route. The readback is compared against a CPU model of the compare, on _hardware. The route refuses WARP today (#2958), so there is no _warp run beyond the host-side manifest check. Negative control: the same fixture with the route change reverted is refused with a comparison sampler.

I'm taking this one. Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100, plus WARP. The PR will target main.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6648218492 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3075). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-27T14:18:02Z. --- Part of #2935 (its "Samplers" item, which is not filed yet). **Problem.** On `main` at `e1ea515d`, the in-process native compute route (`X2W_NATIVE_SHADERS`, `src/startup_stubs/d3d12_compute_dispatch.inl`) refuses any manifest line that starts with `smpc` and returns `a comparison sampler` (lines 174-175). The pieces on both sides already exist: - The native translator accepts constant comparison samplers in compute (`sampler_index`, `src/gfx1013_compute_native.cpp`), for example `image_gather4_c_lz` since #2971, and `src/direct_compute_cache.cpp` writes them as `smpc` lines. - `TranslatedSamplers::read_manifest_line` and `decode_statics` (`src/startup_stubs/translated_sampler_bindings.h`) already parse `smpc` and decode it to a comparison static sampler for the draw path. So a compute request that the translator compiles is still sent back to the `gfx2hlsl.py` fallback at its first Dispatch because of its sampler line. **Plan.** 1. Accept `smpc <i> <w0> <w1> <w2> <w3>` in the route under the same index and whole-line checks as `smp` and `smpl`, through `read_manifest_line`. 2. Leave `smpheap` refused under its current message. The sampler-heap path is a separate item. **Test (source-built only).** A compute fixture that compiles a comparison gather or sample with a constant comparison sampler and runs it through the in-process route. The readback is compared against a CPU model of the compare, on `_hardware`. The route refuses WARP today (#2958), so there is no `_warp` run beyond the host-side manifest check. Negative control: the same fixture with the route change reverted is refused with `a comparison sampler`. I'm taking this one. Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100, plus WARP. The PR will target `main`. AI-assisted.
Not-Saii commented 2026-11-27 14:39:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-27T14:39:02Z.


Correction to the description above. The refusal is not on the in-process route.

  • a comparison sampler (src/startup_stubs/d3d12_compute_dispatch.inl, lines 174-175 at e1ea515d) is in load_compute_translation, the reader of a published <key>.txt. The in-process route (X2W_NATIVE_SHADERS, translate_compute_natively) reads no manifest lines. It refuses every sampler, and every view that is not a raw buffer, with its own messages.
  • Only tools/startup/gfx2hlsl.py writes smpc for a compute program today. format_compute_runtime_manifest (src/direct_compute_cache.cpp) returns no manifest for a comparison sampler; the smpc writer in that file is the graphics one. So the request does not fall back to gfx2hlsl.py because of this line. The translation gfx2hlsl.py publishes is the one the runtime refuses, and a compute request with a comparison sampler cannot be dispatched at all.
  • The published route runs on WARP, so the fixture has a _warp run as well as a _hardware one.

The plan is otherwise the same: accept smpc in that reader under the checks of smp and smpl, and leave smpheap refused. The fixture goes into tests/startup_compute_dispatch_texture_check.py.

Not part of this issue: static samplers on the in-process route (after #3049) and smpc from format_compute_runtime_manifest.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7221050958 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3075#issuecomment-7221050958). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-27T14:39:02Z. --- Correction to the description above. The refusal is not on the in-process route. - `a comparison sampler` (`src/startup_stubs/d3d12_compute_dispatch.inl`, lines 174-175 at `e1ea515d`) is in `load_compute_translation`, the reader of a published `<key>.txt`. The in-process route (`X2W_NATIVE_SHADERS`, `translate_compute_natively`) reads no manifest lines. It refuses every sampler, and every view that is not a raw buffer, with its own messages. - Only `tools/startup/gfx2hlsl.py` writes `smpc` for a compute program today. `format_compute_runtime_manifest` (`src/direct_compute_cache.cpp`) returns no manifest for a comparison sampler; the `smpc` writer in that file is the graphics one. So the request does not fall back to `gfx2hlsl.py` because of this line. The translation `gfx2hlsl.py` publishes is the one the runtime refuses, and a compute request with a comparison sampler cannot be dispatched at all. - The published route runs on WARP, so the fixture has a `_warp` run as well as a `_hardware` one. The plan is otherwise the same: accept `smpc` in that reader under the checks of `smp` and `smpl`, and leave `smpheap` refused. The fixture goes into `tests/startup_compute_dispatch_texture_check.py`. Not part of this issue: static samplers on the in-process route (after #3049) and `smpc` from `format_compute_runtime_manifest`. AI-assisted.
Sign in to join this conversation.
No labels
No milestone
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#3075
No description provided.