help wanted: GPU translation, part 1 (pixel shaders) #1989

Open
opened 2026-11-24 22:51:46 +00:00 by denn0x · 13 comments
denn0x commented 2026-11-24 22:51:46 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-24T22:51:46Z.


Small, independent lowerings in tools/startup/gfx2hlsl.py, pixel stage. Each item can be taken by one person as its own pull request. They were found on pixel programs that are paired with mesh programs (#1760), so a pair is only usable when both stages translate.

Items (pick one, say so in a comment)

Item What is refused today Notes
A s_pack_hh_b32_b16 SOP2; packs the high halves of both sources into one 32-bit result. Check the operand order against the LLVM AMDGPU definition.
B v_subrev_f32 with a DPP control Appears to be the quad-permute derivative idiom with the operands reversed; confirm from the encoding first.
C v_interp_p1ll_f16 / v_interp_p2ll_f16 16-bit interpolation pair. #1926 prints the VINTRP selector; the f16 forms have no lowering.
D image_sample_b LOD-bias sample.
E Pixel-stage entry registers (SPI inputs) beyond the fixed-point position The input-enable word selects which values the stage receives in its entry VGPRs: perspective and linear barycentrics at sample / center / centroid, position x/y/z/w, front face, ancillary bits, sample coverage. Only the fixed-point position is lowered. Each enabled input needs its HLSL equivalent, and a check that the entry registers a program reads match the enabled set.
F image_store in a pixel stage Related to #1545 (compute); the pixel-stage path refuses separately.

What a pull request needs

  • One item per pull request.
  • A source-built or hand-assembled fixture (no bytes from any retail software), with a negative control that fails when the lowering is disabled.
  • The semantics cited from LLVM or Mesa in the commit message.
  • The existing tests/startup_gfx2hlsl_*_check.py and tests/startup_translator_check.py still passing.
  • A refusal that stays is better than a wrong translation: refuse precisely what the change does not cover.

Where the numbers come from

Aggregate counts from a private corpus, a sample of 1,500 mesh + pixel pairs: A 44, B 38, E 38, C 18, F 8, D 6 pairs stop at these refusals in the pixel stage. No shader bytes, keys or logs can be shared; a source-built fixture is the only acceptable input.

Related: #1723 (refusal census), #1760 (mesh programs), #1545, #1926.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593005406 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-24T22:51:46Z. --- Small, independent lowerings in `tools/startup/gfx2hlsl.py`, pixel stage. Each item can be taken by one person as its own pull request. They were found on pixel programs that are paired with mesh programs (#1760), so a pair is only usable when both stages translate. ## Items (pick one, say so in a comment) | Item | What is refused today | Notes | |---|---|---| | A | `s_pack_hh_b32_b16` | SOP2; packs the high halves of both sources into one 32-bit result. Check the operand order against the LLVM AMDGPU definition. | | B | `v_subrev_f32` with a DPP control | Appears to be the quad-permute derivative idiom with the operands reversed; confirm from the encoding first. | | C | `v_interp_p1ll_f16` / `v_interp_p2ll_f16` | 16-bit interpolation pair. #1926 prints the VINTRP selector; the f16 forms have no lowering. | | D | `image_sample_b` | LOD-bias sample. | | E | Pixel-stage entry registers (SPI inputs) beyond the fixed-point position | The input-enable word selects which values the stage receives in its entry VGPRs: perspective and linear barycentrics at sample / center / centroid, position x/y/z/w, front face, ancillary bits, sample coverage. Only the fixed-point position is lowered. Each enabled input needs its HLSL equivalent, and a check that the entry registers a program reads match the enabled set. | | F | `image_store` in a pixel stage | Related to #1545 (compute); the pixel-stage path refuses separately. | ## What a pull request needs - One item per pull request. - A source-built or hand-assembled fixture (no bytes from any retail software), with a negative control that fails when the lowering is disabled. - The semantics cited from LLVM or Mesa in the commit message. - The existing `tests/startup_gfx2hlsl_*_check.py` and `tests/startup_translator_check.py` still passing. - A refusal that stays is better than a wrong translation: refuse precisely what the change does not cover. ## Where the numbers come from Aggregate counts from a private corpus, a sample of 1,500 mesh + pixel pairs: A 44, B 38, E 38, C 18, F 8, D 6 pairs stop at these refusals in the pixel stage. No shader bytes, keys or logs can be shared; a source-built fixture is the only acceptable input. Related: #1723 (refusal census), #1760 (mesh programs), #1545, #1926.
avt0m4t48 commented 2026-11-24 23:03:42 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by avt0m4t48 on 2026-11-24T23:01:14Z.


I’ll take item A, s_pack_hh_b32_b16, in the startup pixel translator. I’ll use a source-built fixture with distinct source halfwords and a negative control for the operand order.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7146916971 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7146916971). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T23:01:14Z. --- I’ll take item A, `s_pack_hh_b32_b16`, in the startup pixel translator. I’ll use a source-built fixture with distinct source halfwords and a negative control for the operand order.
JB2WIN commented 2026-11-25 01:01:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T23:04:44Z.


I'll take item B, v_subrev_f32 with a DPP control, in the startup pixel translator. First I'll confirm the form from the encoding and LLVM 15: which DPP controls appear, whether it is the quad-permute derivative idiom, and what bound_ctrl and the row/bank masks are. Then the lowering will cover exactly the controls that are established, with a source-built fixture that uses distinct per-lane values, the reversed operand order, and a negative control for a wrong lane pattern. Any other DPP control stays refused.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7146987245 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7146987245). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-24T23:04:44Z. --- I'll take item B, `v_subrev_f32` with a DPP control, in the startup pixel translator. First I'll confirm the form from the encoding and LLVM 15: which DPP controls appear, whether it is the quad-permute derivative idiom, and what `bound_ctrl` and the row/bank masks are. Then the lowering will cover exactly the controls that are established, with a source-built fixture that uses distinct per-lane values, the reversed operand order, and a negative control for a wrong lane pattern. Any other DPP control stays refused. AI-assisted (Claude Code).
JB2WIN commented 2026-11-25 01:01:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T23:11:57Z.


Findings for item B (v_subrev_f32 with DPP) before any code. Nothing is built yet.

  • Semantics.

    • RDNA 2 ISA DPP_CTRL: pix[n].srca = pix[(n&0x3c) + sel[n%4]].srca. DPP applies to src0 only, and the row and bank masks gate the destination write.
    • V_SUBREV_F32 is D = S1 - S0.
  • Mesa ACO's derivative idiom (aco_instruction_selection.cpp at mesa-24.0.0, ddx_fine) is two instructions: tl = v_mov_b32_dpp src quad_perm:[0,0,2,2], then v_sub_f32_dpp dst, src, tl quad_perm:[1,1,3,3], i.e. tr - tl. ddy_fine is the same with [0,1,0,1] and [2,3,2,3].

  • The single-register form v_subrev_f32_dpp vD, vS, vS quad_perm:[...] is not a fine derivative. It gives D(n) = S(n) - S(perm[n%4]), which is 0 in one lane of each pair. With [0,0,2,2], for example, the left lanes get 0 and the right lanes x1 - x0.

  • gfx2hlsl has no lane model, so a lane-dependent result like this cannot be expressed in SM 5. A derivative mapping is only exact for the two-register form, where src1 provably comes from a v_mov_b32_dpp of the same unchanged source.

  • Encodings (LLVM 15.0.7, gfx1013):

    Form Encoding
    v_subrev_f32_dpp v1, v0, v0 quad_perm:[1,1,3,3] row_mask:0xf bank_mask:0xf 0A0200FA FF00F500
    quad_perm:[0,0,2,2] FF00A000
    bound_ctrl:1 sets bit 19
    -v0 sets bit 20

    disasm_rdna2.py decodes all of these, and gfx2hlsl refuses them as v_subrev_f32_dpp.

@BigDog, which shape do the 38 pairs use? Without bytes, three things would be enough:

  • whether src0 and src1 are the same register;
  • which quad_perm the instruction carries;
  • whether a v_mov_b32_dpp of the same source comes right before it.

If it is the two-register pair, I would lower exactly that fused pair to ddx_fine/ddy_fine and refuse everything else. If it is the single-register form, it needs a lane model and is a bigger item.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147127500 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7147127500). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-24T23:11:57Z. --- Findings for item B (`v_subrev_f32` with DPP) before any code. Nothing is built yet. - **Semantics.** - RDNA 2 ISA DPP_CTRL: `pix[n].srca = pix[(n&0x3c) + sel[n%4]].srca`. DPP applies to src0 only, and the row and bank masks gate the destination write. - `V_SUBREV_F32` is `D = S1 - S0`. - **Mesa ACO's derivative idiom** (`aco_instruction_selection.cpp` at `mesa-24.0.0`, `ddx_fine`) is two instructions: `tl = v_mov_b32_dpp src quad_perm:[0,0,2,2]`, then `v_sub_f32_dpp dst, src, tl quad_perm:[1,1,3,3]`, i.e. `tr - tl`. `ddy_fine` is the same with `[0,1,0,1]` and `[2,3,2,3]`. - **The single-register form `v_subrev_f32_dpp vD, vS, vS quad_perm:[...]` is not a fine derivative.** It gives `D(n) = S(n) - S(perm[n%4])`, which is 0 in one lane of each pair. With `[0,0,2,2]`, for example, the left lanes get 0 and the right lanes `x1 - x0`. - **gfx2hlsl has no lane model**, so a lane-dependent result like this cannot be expressed in SM 5. A derivative mapping is only exact for the two-register form, where src1 provably comes from a `v_mov_b32_dpp` of the same unchanged source. - **Encodings** (LLVM 15.0.7, gfx1013): | Form | Encoding | |---|---| | `v_subrev_f32_dpp v1, v0, v0 quad_perm:[1,1,3,3] row_mask:0xf bank_mask:0xf` | `0A0200FA FF00F500` | | `quad_perm:[0,0,2,2]` | `FF00A000` | | `bound_ctrl:1` | sets bit 19 | | `-v0` | sets bit 20 | `disasm_rdna2.py` decodes all of these, and gfx2hlsl refuses them as `v_subrev_f32_dpp`. @BigDog, which shape do the 38 pairs use? Without bytes, three things would be enough: - whether src0 and src1 are the same register; - which `quad_perm` the instruction carries; - whether a `v_mov_b32_dpp` of the same source comes right before it. If it is the two-register pair, I would lower exactly that fused pair to `ddx_fine`/`ddy_fine` and refuse everything else. If it is the single-register form, it needs a lane model and is a bigger item. AI-assisted (Claude Code).
JB2WIN commented 2026-11-25 01:01:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T23:17:50Z.


I'll also take item D, image_sample_b (LOD-bias sample), next to the existing image_sample/image_sample_l lowering, as SampleBias in the pixel stage. The bias comes first in the address registers, as in the RDNA 2 MIMG address layout; I'll cite the ISA and Mesa for the operand order. Evidence: a check in the style of startup_image_sample_l_check.py, plus refusals for the forms not covered (_b_cl, _c_b, offsets, a16 and a non-pixel stage).

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147238491 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7147238491). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-24T23:17:50Z. --- I'll also take item D, `image_sample_b` (LOD-bias sample), next to the existing `image_sample`/`image_sample_l` lowering, as `SampleBias` in the pixel stage. The bias comes first in the address registers, as in the RDNA 2 MIMG address layout; I'll cite the ISA and Mesa for the operand order. Evidence: a check in the style of `startup_image_sample_l_check.py`, plus refusals for the forms not covered (`_b_cl`, `_c_b`, offsets, a16 and a non-pixel stage). AI-assisted (Claude Code).
Ybucaille commented 2026-11-25 01:01:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-24T23:19:32Z.


I'll take item C, v_interp_p1ll_f16 / v_interp_p2ll_f16, in the startup pixel translator. I'll check the semantics against LLVM 15 and Mesa first (high/low half selection, rounding), then add a source-built fixture with a negative control that fails when the lowering is disabled. Forms outside what the fixture covers stay refused.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147271535 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7147271535). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-24T23:19:32Z. --- I'll take item C, `v_interp_p1ll_f16` / `v_interp_p2ll_f16`, in the startup pixel translator. I'll check the semantics against LLVM 15 and Mesa first (high/low half selection, rounding), then add a source-built fixture with a negative control that fails when the lowering is disabled. Forms outside what the fixture covers stay refused. AI-assisted.
R0Y00 commented 2026-11-25 01:01:55 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T23:31:09Z.


Item A is implemented in #2014, now on main at 481a1c62. The independent operand-order and unchanged-SCC controls passed. Keep the other rows on their existing claim threads.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147490424 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7147490424). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T23:31:09Z. --- Item A is implemented in #2014, now on main at 481a1c62. The independent operand-order and unchanged-SCC controls passed. Keep the other rows on their existing claim threads.
Its3rr0rsWRLD commented 2026-11-25 01:01:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-24T23:39:23Z.


Claude will take item E, starting with one slice:

  • Position inputs: the float position inputs (POS_X/Y/Z/W_FLOAT) lowered to SV_Position.
  • Entry-register check: every VGPR the pixel stage reads before assigning it must be an enabled input that has a lowering.
  • Sources:
    • Register order and counts from Mesa's gfx10 register JSON and ac_get_fs_input_vgpr_cnt.
    • The w register taken as clip-space w, per load_frag_coord_w_rcp.
  • Still refused by name in this slice: front face, ancillary, sample coverage, the pull model and the non-centre barycentric pairs.
  • Evidence:
    • A hand-assembled export fixture drawn on WARP with a per-pixel readback.
    • Negative controls for a disabled lowering and for a shifted register layout.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147648069 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7147648069). Originally posted by [Its3rr0rsWRLD](https://github.com/Its3rr0rsWRLD) on 2026-11-24T23:39:23Z. --- Claude will take item E, starting with one slice: - **Position inputs:** the float position inputs (POS_X/Y/Z/W_FLOAT) lowered to SV_Position. - **Entry-register check:** every VGPR the pixel stage reads before assigning it must be an enabled input that has a lowering. - **Sources:** - Register order and counts from Mesa's gfx10 register JSON and `ac_get_fs_input_vgpr_cnt`. - The w register taken as clip-space w, per `load_frag_coord_w_rcp`. - **Still refused by name in this slice:** front face, ancillary, sample coverage, the pull model and the non-centre barycentric pairs. - **Evidence:** - A hand-assembled export fixture drawn on WARP with a per-pixel readback. - Negative controls for a disabled lowering and for a shifted register layout. AI-assisted (Claude Code).
Ybucaille commented 2026-11-25 01:01:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-24T23:44:35Z.


Item C is up in #2052. The pair is v_interp_p1ll_f16 / v_interp_p2_f16 (not p2ll, which doesn't exist on gfx10), lowered for the x/y channels with matching high halves; clamp, modifiers, z/w, mismatched halves and non-compr attributes stay refused. The CPU controls and the llvm-mc fixture check pass on Linux; the _warp / _hardware draws still need a Windows run.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147743809 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7147743809). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-24T23:44:35Z. --- Item C is up in #2052. The pair is `v_interp_p1ll_f16` / `v_interp_p2_f16` (not `p2ll`, which doesn't exist on gfx10), lowered for the x/y channels with matching `high` halves; clamp, modifiers, z/w, mismatched halves and non-`compr` attributes stay refused. The CPU controls and the llvm-mc fixture check pass on Linux; the `_warp` / `_hardware` draws still need a Windows run. AI-assisted.
denn0x commented 2026-11-25 01:01:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-24T23:54:30Z.


Thanks for checking the encoding first. In the sample (aggregate, decode only) every v_subrev_f32 with DPP has the same shape. None of them is the two-register fine-derivative pair:

  • Operands. src0 and src1 are the same register. The control is quad_perm:[0,0,0,0] with bound_ctrl:1, and the row and bank masks are full. No v_mov_b32_dpp of the same source comes right before it.
    • Measured: 6,348 instructions in about 1,020 pixel programs.
    • Result per lane: D(n) = S(n) - S(quad base), so lane 0 gets 0, lane 1 gets the x difference and lane 2 gets the y difference.
  • Next instruction. The result is then read through v_mov_b32_dpp quad_perm:[1,1,1,1] and/or quad_perm:[2,2,2,2], sometimes v_mul_f32_dpp with the same broadcast, before the register is overwritten. This holds for about 95 % of the instructions; the rest are read further away or not at all.
    • Broadcasting lane 1 gives the coarse x derivative to every lane of the quad, and broadcasting lane 2 gives the coarse y derivative.
    • That is Mesa ACO's coarse form (ddx_coarse / ddy_coarse in aco_instruction_selection.cpp), with the first subtraction folded into one DPP instruction.

So the idiom to recognise is the two-instruction pair v_subrev_f32_dpp vD, vS, vS quad_perm:[0,0,0,0] bound_ctrl:1, then a broadcast of vD from quad lane 1 or 2. Lowered, that pair is ddx_coarse(S) or ddy_coarse(S).

  • Lane 0 and lane 3. Read directly, the subtraction alone holds 0 in lane 0 and S3 - S0 in lane 3. A lowering without a lane model therefore has to prove that only the broadcast reads vD, and refuse any other read of it.
  • Alternative. A general quad-lane model (QuadReadLaneAt on SM 6.0) expresses both instructions exactly, at the cost of requiring SM 6.
  • What a fixture should cover. Distinct values in all four lanes of a quad, plus a negative control that reads vD directly in lane 3.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147926645 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7147926645). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-24T23:54:30Z. --- Thanks for checking the encoding first. In the sample (aggregate, decode only) every `v_subrev_f32` with DPP has the same shape. None of them is the two-register fine-derivative pair: - **Operands.** src0 and src1 are the same register. The control is `quad_perm:[0,0,0,0]` with `bound_ctrl:1`, and the row and bank masks are full. No `v_mov_b32_dpp` of the same source comes right before it. - Measured: 6,348 instructions in about 1,020 pixel programs. - Result per lane: `D(n) = S(n) - S(quad base)`, so lane 0 gets 0, lane 1 gets the x difference and lane 2 gets the y difference. - **Next instruction.** The result is then read through `v_mov_b32_dpp quad_perm:[1,1,1,1]` and/or `quad_perm:[2,2,2,2]`, sometimes `v_mul_f32_dpp` with the same broadcast, before the register is overwritten. This holds for about 95 % of the instructions; the rest are read further away or not at all. - Broadcasting lane 1 gives the coarse x derivative to every lane of the quad, and broadcasting lane 2 gives the coarse y derivative. - That is Mesa ACO's coarse form (`ddx_coarse` / `ddy_coarse` in `aco_instruction_selection.cpp`), with the first subtraction folded into one DPP instruction. So the idiom to recognise is the two-instruction pair `v_subrev_f32_dpp vD, vS, vS quad_perm:[0,0,0,0] bound_ctrl:1`, then a broadcast of vD from quad lane 1 or 2. Lowered, that pair is `ddx_coarse(S)` or `ddy_coarse(S)`. - **Lane 0 and lane 3.** Read directly, the subtraction alone holds 0 in lane 0 and `S3 - S0` in lane 3. A lowering without a lane model therefore has to prove that only the broadcast reads vD, and refuse any other read of it. - **Alternative.** A general quad-lane model (`QuadReadLaneAt` on SM 6.0) expresses both instructions exactly, at the cost of requiring SM 6. - **What a fixture should cover.** Distinct values in all four lanes of a quad, plus a negative control that reads vD directly in lane 3.
Leyukaka commented 2026-11-25 01:02:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T00:40:47Z.


Item F (image_store in a pixel stage): what blocks it, from reading tools/startup/gfx2hlsl.py and src/startup_stubs/d3d12_draw.inl at 5a0b0aa. Nothing was run.

  • Translator.
    • There is no image_store handler; the instruction ends at the generic Unsupported.
    • Pipeline.resource() collects image descriptors for both stages, and Pipeline.common() declares every resource read-only at register(tN) (ByteAddressBuffer / Texture*<float4>).
    • The manifest has srv, ud/udsrc, smp/smpc/smpheap, params, targets and wmask records; translate_to() appends the rtv1 request line. None of them describes a writable view.
    • parse_root() reads each parameter's type, visibility and offset, and register, space and count only for root constants. It does not read descriptor ranges, so it cannot tell that a table entry is a UAV.
  • Runtime. d3d12_draw.inl parses those manifest lines and builds a root signature of constants, an optional SRV table and an optional sampler table. The only view it creates is a shader resource view.
  • What would be needed.
    • A UAV manifest record: register, space, pixel visibility, 2D typed view, and guest table parameter and byte offset.
    • A UAV table or descriptor in the desktop graphics root signature.
    • A way to create the writable view from the guest descriptor at draw time with the right format. Whether the current view-token path can supply that I have not verified, so I am stating it as a requirement.
    • The translator could then declare a RWTexture2D<float4> at its own u register (independent of the render targets under a D3D12 root signature). It would emit the store under the current exec mask for the simplest case: 2D float data, dmask 0x1/0x3/0x7/0xf, none of glc/slc/dlc/d16/a16/unorm/r128/tfe/lwe.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148763355 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7148763355). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-25T00:40:47Z. --- Item F (`image_store` in a pixel stage): what blocks it, from reading `tools/startup/gfx2hlsl.py` and `src/startup_stubs/d3d12_draw.inl` at `5a0b0aa`. Nothing was run. - **Translator.** - There is no `image_store` handler; the instruction ends at the generic `Unsupported`. - `Pipeline.resource()` collects image descriptors for both stages, and `Pipeline.common()` declares every resource read-only at `register(tN)` (`ByteAddressBuffer` / `Texture*<float4>`). - The manifest has `srv`, `ud`/`udsrc`, `smp`/`smpc`/`smpheap`, `params`, `targets` and `wmask` records; `translate_to()` appends the `rtv1` request line. None of them describes a writable view. - `parse_root()` reads each parameter's type, visibility and offset, and register, space and count only for root constants. It does not read descriptor ranges, so it cannot tell that a table entry is a UAV. - **Runtime.** `d3d12_draw.inl` parses those manifest lines and builds a root signature of constants, an optional SRV table and an optional sampler table. The only view it creates is a shader resource view. - **What would be needed.** - A UAV manifest record: register, space, pixel visibility, 2D typed view, and guest table parameter and byte offset. - A UAV table or descriptor in the desktop graphics root signature. - A way to create the writable view from the guest descriptor at draw time with the right format. Whether the current view-token path can supply that I have not verified, so I am stating it as a requirement. - The translator could then declare a `RWTexture2D<float4>` at its own `u` register (independent of the render targets under a D3D12 root signature). It would emit the store under the current exec mask for the simplest case: 2D float data, `dmask` 0x1/0x3/0x7/0xf, none of `glc/slc/dlc/d16/a16/unorm/r128/tfe/lwe`. AI-assisted.
R0Y00 commented 2026-11-25 09:04:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T08:45:47Z.


Item F's first translation slice landed in #2155 at fbc8fac5. Windows Release ran the source-built control and the draw on WARP and RTX 4060 Laptop. Both drew the expected texels with EXEC active, preserved the sentinel texel with EXEC off, and detected the missing-guard mutation.

The runtime still refuses these UAV manifests. A separate binding slice can reuse the same synthetic shader and compare two distinguishable writable textures, including a rejection when the table provides a missing, wrong-type, or out-of-range view. Verify the written texel and the untouched view.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7157438697 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7157438697). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T08:45:47Z. --- Item F's first translation slice landed in [#2155](https://github.com/R0Y00/Xbox2Windows/pull/2155) at `fbc8fac5`. Windows Release ran the source-built control and the draw on WARP and RTX 4060 Laptop. Both drew the expected texels with EXEC active, preserved the sentinel texel with EXEC off, and detected the missing-guard mutation. The runtime still refuses these UAV manifests. A separate binding slice can reuse the same synthetic shader and compare two distinguishable writable textures, including a rejection when the table provides a missing, wrong-type, or out-of-range view. Verify the written texel and the untouched view.
roansystemlabs commented 2026-11-25 13:00:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T12:25:05Z.


I'd like to take the pixel-stage UAV binding slice described above (also the unowned "Pixel-stage UAV binding" line in #2274). @rasptum, if you had already started it as the #2155 follow-up, I'll step back and review instead.

Plan (one PR):

  • src/startup_stubs/d3d12_draw.inl: load_translation accepts the version 2 line uav N tex2d float table P O instead of dropping the translation; the translated root signature gets a UAV range, and at draw time the view is made from the table entry the same way the texture SRVs are, on mip 0 of a 2D texture.
  • Refused by name, translation not used: a missing or out-of-range entry, an entry that is not a 2D texture, a resource without ALLOW_UNORDERED_ACCESS, a UINT/SINT/sRGB format for a float view, the same resource bound as SRV and UAV in one draw, and the other dimensions (array, 3D, 1D) for now.
  • Out of scope: compute UAVs and barriers between draws that read the same UAV.
  • @NiiRoZz, #2274 says to reuse the compute helper, which is still on your local branch. I can put the view creation in a small shared header your branch can pick up, or build on yours if it lands first. Which do you prefer?

Evidence: the synthetic gfx1013 pixel program from #2155, assembled with LLVM 15, drawn through the runtime path on WARP and an RTX 3070 with the debug layer and a fenced readback, with two distinguishable writable textures. The stored texel must land only in the view the table names, and the other texture must stay unchanged word for word. On current main the same translation stops at "pixel-stage UAVs are not bound yet". Negative controls: swapped table entry, UA-flag guard removed, wrong mip, and EXEC off must each fail as predicted. Not tested: AMD or Intel GPUs and console hardware.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7162344679 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7162344679). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-25T12:25:05Z. --- I'd like to take the pixel-stage UAV binding slice described above (also the unowned "Pixel-stage UAV binding" line in #2274). @rasptum, if you had already started it as the #2155 follow-up, I'll step back and review instead. Plan (one PR): - src/startup_stubs/d3d12_draw.inl: load_translation accepts the version 2 line `uav N tex2d float table P O` instead of dropping the translation; the translated root signature gets a UAV range, and at draw time the view is made from the table entry the same way the texture SRVs are, on mip 0 of a 2D texture. - Refused by name, translation not used: a missing or out-of-range entry, an entry that is not a 2D texture, a resource without ALLOW_UNORDERED_ACCESS, a UINT/SINT/sRGB format for a float view, the same resource bound as SRV and UAV in one draw, and the other dimensions (array, 3D, 1D) for now. - Out of scope: compute UAVs and barriers between draws that read the same UAV. - @NiiRoZz, #2274 says to reuse the compute helper, which is still on your local branch. I can put the view creation in a small shared header your branch can pick up, or build on yours if it lands first. Which do you prefer? Evidence: the synthetic gfx1013 pixel program from #2155, assembled with LLVM 15, drawn through the runtime path on WARP and an RTX 3070 with the debug layer and a fenced readback, with two distinguishable writable textures. The stored texel must land only in the view the table names, and the other texture must stay unchanged word for word. On current main the same translation stops at "pixel-stage UAVs are not bound yet". Negative controls: swapped table entry, UA-flag guard removed, wrong mip, and EXEC off must each fail as predicted. Not tested: AMD or Intel GPUs and console hardware. AI-assisted.
R0Y00 commented 2026-11-25 13:00:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T12:42:26Z.


The #2155 single-draw binding follow-up is ready for a focused PR. Use the existing source-built shader and keep the two-texture fenced readback and refusal controls you listed. Main still refuses the pixel UAV manifest, and there is no landed compute-view helper to depend on. Keep the pixel binding self-contained and use any shared helper that is already on main when you open the PR. A shared helper can be extracted once the compute caller is also available to exercise it.

Please keep the existing claim here. If rasptum has a patch for the same slot, coordinate on one implementation and independently run the other adapter's check.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7162743320 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1996#issuecomment-7162743320). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T12:42:26Z. --- The #2155 single-draw binding follow-up is ready for a focused PR. Use the existing source-built shader and keep the two-texture fenced readback and refusal controls you listed. Main still refuses the pixel UAV manifest, and there is no landed compute-view helper to depend on. Keep the pixel binding self-contained and use any shared helper that is already on main when you open the PR. A shared helper can be extracted once the compute caller is also available to exercise it. Please keep the existing claim here. If rasptum has a patch for the same slot, coordinate on one implementation and independently run the other adapter's check.
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#1989
No description provided.