cpp-migration: lower image_gather4_c_lz in the direct C++ image path #2969

Closed
opened 2026-11-27 00:10:25 +00:00 by legacy-code-archaeologist · 1 comment
legacy-code-archaeologist commented 2026-11-27 00:10:25 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-27T00:10:25Z.


Target branch cpp-migration. Part of #2935 (instruction coverage: the image ops). I am taking this; please say if you already have it locally and I will drop it.

Gap: the direct C++ image path (image_io in src/gfx1013_direct_compute.inl) lowers image_gather4 and image_gather4_lz (DXIL textureGather) and the comparison samples image_sample_c / _c_lz (sampleCmp*). It refuses the comparison gather. A source-built compute container with the comparison sampler of native_direct_container_check.py (comparison_program) and image_gather4_c_lz (op 79) fails with:

native compute +0x38: direct image opcode or descriptor modifiers

The same program with image_sample_c_lz (op 47) compiles. This was run with compile_dxil ... gfx1013-container-cs, built from cpp-migration e3670100. gfx2hlsl.py lowers this form (op_image_gather4_c_lz).

Plan: follow the gfx2hlsl.py contract.

  • image_gather4_c_lz on 2D and 2D-array images with dmask 0x1 (red). gather4_c compares the resource's red component.
  • The address is the reference, then u and v (and the slice). The lowering is DXIL textureGatherCmp (opcode 74) with channel 0 and the reference as the compare value.
  • The sampler is the constant comparison sampler under the existing comparison field checks, with the base-level fix that image_gather4_lz already uses (DXIL gather has no LOD operand).
  • Refused by name: other dmasks, cube and 3D dimensions, image_gather4_c with implicit LOD, _c_l, _c_b and offsets.
  • Fixture: source-built containers, checked through the module (dxc -dumpbin: textureGatherCmp) and refusals by message, plus a pipeline created on WARP like native_comparison_pso_warp.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6637254490 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2969). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-27T00:10:25Z. --- Target branch `cpp-migration`. Part of #2935 (instruction coverage: the image ops). I am taking this; please say if you already have it locally and I will drop it. **Gap:** the direct C++ image path (`image_io` in `src/gfx1013_direct_compute.inl`) lowers `image_gather4` and `image_gather4_lz` (DXIL `textureGather`) and the comparison samples `image_sample_c` / `_c_lz` (`sampleCmp*`). It refuses the comparison gather. A source-built compute container with the comparison sampler of `native_direct_container_check.py` (`comparison_program`) and `image_gather4_c_lz` (op 79) fails with: ```text native compute +0x38: direct image opcode or descriptor modifiers ``` The same program with `image_sample_c_lz` (op 47) compiles. This was run with `compile_dxil ... gfx1013-container-cs`, built from `cpp-migration` `e3670100`. `gfx2hlsl.py` lowers this form (`op_image_gather4_c_lz`). **Plan:** follow the `gfx2hlsl.py` contract. - `image_gather4_c_lz` on 2D and 2D-array images with `dmask` 0x1 (red). gather4_c compares the resource's red component. - The address is the reference, then u and v (and the slice). The lowering is DXIL `textureGatherCmp` (opcode 74) with channel 0 and the reference as the compare value. - The sampler is the constant comparison sampler under the existing comparison field checks, with the base-level fix that `image_gather4_lz` already uses (DXIL gather has no LOD operand). - Refused by name: other dmasks, cube and 3D dimensions, `image_gather4_c` with implicit LOD, `_c_l`, `_c_b` and offsets. - Fixture: source-built containers, checked through the module (`dxc -dumpbin`: `textureGatherCmp`) and refusals by message, plus a pipeline created on WARP like `native_comparison_pso_warp`. AI-assisted.
legacy-code-archaeologist commented 2026-11-27 03:12:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-27T03:12:10Z.


Done by #2971 (merged into cpp-migration).

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7208790492 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2969#issuecomment-7208790492). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-27T03:12:10Z. --- Done by #2971 (merged into `cpp-migration`). 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#2969
No description provided.