shader: lower pass-through NGG vertex shaders on the native graphics path #3711

Open
SimSalabimse wants to merge 7 commits from upstream-pr/3711 into main
SimSalabimse commented 2026-12-01 08:35:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-12-01T08:35:40Z.


The native gfx1013 graphics frontend accepted only ordinary vertex shaders and refused NGG-style ones (ds_write_b32 / ds_read, v_mbcnt, s_sendmsg, s_barrier) as a graphics wave or control-flow instruction.

This accepts one straight-line pass-through shape and lowers it to a plain VS:

  • lane-private LDS round trip, with addresses proved from the v_mbcnt lane id and pairwise-disjoint 4-byte slots
  • exactly one s_barrier between those writes and reads
  • exactly one GS_ALLOC_REQ whose counts are this wave's
  • exactly one identity primitive export (0x00200400)
  • a position export is required

The LDS round trip becomes the captured register; the allocation, barrier and identity primitive export are omitted (the input assembler supplies the primitive). Anything not proved stays refused:

Reason Examples
ngg lds address not lane-private cross-lane read, incomplete lane id, unaligned slot, GDS or other DS ops, wave32 with v_mbcnt_hi
ngg lane address used outside an LDS access lane address exported or stored as data
ngg lds read is not the lane's own slot unread private slot, read without a write
ngg barrier outside the lane-private round trip missing barrier, barrier before the writes, write after the read
ngg sendmsg is not GS_ALLOC_REQ any other s_sendmsg
ngg sendmsg counts not proven wrong or unproven count word, count from a register, missing or out-of-order send, wave32 with a wave64 count
ngg prim export not identity reversed primitive, vertex-id export, a second primitive

Missing position still uses the existing incomplete or inconsistent terminal graphics exports refusal. Pixel shaders and unrelated wave instructions keep graphics wave or control-flow instruction.

Files (8 changed, +896 / −1): src/gfx1013_direct_graphics.inl, tests/native_ngg_vs_passthrough_check.py, tests/native_ngg_vs_ir_dump.cpp, tests/native_direct_container_check.py, tests/checks/python-linux/ngg-vs-passthrough.txt, tests/checks/pixel-binary/ngg-vs-passthrough.txt, docs/experiments/ngg-vs-passthrough.md, CMakeLists.txt.

Linux tests: native_ngg_vs_passthrough compiles the frontend with g++ and clang++ (-Werror=narrowing), translates the identity / wave32 / contrast fixtures, and in binary mode checks that those words match llvm-mc for gfx1013. No hardware result is claimed.

Windows test PC run: https://github.com/R0Y00/Xbox2Windows/pull/3711#issuecomment-7308088781

Part of #1723.

AI-assisted (Cursor)

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5582036996 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3711). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-12-01T08:35:40Z. --- The native gfx1013 graphics frontend accepted only ordinary vertex shaders and refused NGG-style ones (`ds_write_b32` / `ds_read`, `v_mbcnt`, `s_sendmsg`, `s_barrier`) as a graphics wave or control-flow instruction. This accepts one straight-line pass-through shape and lowers it to a plain VS: - lane-private LDS round trip, with addresses proved from the `v_mbcnt` lane id and pairwise-disjoint 4-byte slots - exactly one `s_barrier` between those writes and reads - exactly one `GS_ALLOC_REQ` whose counts are this wave's - exactly one identity primitive export (`0x00200400`) - a position export is required The LDS round trip becomes the captured register; the allocation, barrier and identity primitive export are omitted (the input assembler supplies the primitive). Anything not proved stays refused: | Reason | Examples | | --- | --- | | `ngg lds address not lane-private` | cross-lane read, incomplete lane id, unaligned slot, GDS or other DS ops, wave32 with `v_mbcnt_hi` | | `ngg lane address used outside an LDS access` | lane address exported or stored as data | | `ngg lds read is not the lane's own slot` | unread private slot, read without a write | | `ngg barrier outside the lane-private round trip` | missing barrier, barrier before the writes, write after the read | | `ngg sendmsg is not GS_ALLOC_REQ` | any other `s_sendmsg` | | `ngg sendmsg counts not proven` | wrong or unproven count word, count from a register, missing or out-of-order send, wave32 with a wave64 count | | `ngg prim export not identity` | reversed primitive, vertex-id export, a second primitive | Missing position still uses the existing `incomplete or inconsistent terminal graphics exports` refusal. Pixel shaders and unrelated wave instructions keep `graphics wave or control-flow instruction`. Files (8 changed, +896 / −1): `src/gfx1013_direct_graphics.inl`, `tests/native_ngg_vs_passthrough_check.py`, `tests/native_ngg_vs_ir_dump.cpp`, `tests/native_direct_container_check.py`, `tests/checks/python-linux/ngg-vs-passthrough.txt`, `tests/checks/pixel-binary/ngg-vs-passthrough.txt`, `docs/experiments/ngg-vs-passthrough.md`, `CMakeLists.txt`. Linux tests: `native_ngg_vs_passthrough` compiles the frontend with g++ and clang++ (`-Werror=narrowing`), translates the identity / wave32 / contrast fixtures, and in `binary` mode checks that those words match `llvm-mc` for gfx1013. No hardware result is claimed. Windows test PC run: https://github.com/R0Y00/Xbox2Windows/pull/3711#issuecomment-7308088781 Part of #1723. AI-assisted (Cursor)
SimSalabimse commented 2026-12-01 10:22:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-12-01T10:22:21Z.


Windows test PC run of this branch (0de66e7c).

Focused NGG/pass-through tests: startup_ngg_slice and native_direct_container passed. native_ngg_vs_passthrough was skipped (the test requires both g++ and clang++; this Windows host has clang++ but not g++). The Linux frontend compile of that fixture is already covered.

WARP/CPU suite (ctest -j 6, excluding startup_audio_(output|pacing|provider) and _hardware): 2235 passed, 71 skipped, 3 failed out of 2309. The three failures also fail on main a061032f with the same causes and are not regressions: startup_fixed_heap_state and sampled_table_neighbor_check fail because the host clang++ is older than Clang 19 required by the installed MSVC STL; shader_probe_root_devices_cli_check fails one case that needs symlink privilege.

Touched-area hardware tests, run one at a time: native_buffered_vertex_hardware, native_sampled_pixel_hardware, native_graphics_wqm_hardware, and native_indexed_pixel_texture_hardware all passed.

No game run.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7308088781 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3711#issuecomment-7308088781). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-12-01T10:22:21Z. --- Windows test PC run of this branch (0de66e7c). Focused NGG/pass-through tests: `startup_ngg_slice` and `native_direct_container` passed. `native_ngg_vs_passthrough` was skipped (the test requires both g++ and clang++; this Windows host has clang++ but not g++). The Linux frontend compile of that fixture is already covered. WARP/CPU suite (`ctest -j 6`, excluding `startup_audio_(output|pacing|provider)` and `_hardware`): 2235 passed, 71 skipped, 3 failed out of 2309. The three failures also fail on main a061032f with the same causes and are not regressions: `startup_fixed_heap_state` and `sampled_table_neighbor_check` fail because the host clang++ is older than Clang 19 required by the installed MSVC STL; `shader_probe_root_devices_cli_check` fails one case that needs symlink privilege. Touched-area hardware tests, run one at a time: `native_buffered_vertex_hardware`, `native_sampled_pixel_hardware`, `native_graphics_wqm_hardware`, and `native_indexed_pixel_texture_hardware` all passed. No game run. AI-Assisted
Leyukaka commented 2026-12-01 15:41:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T15:41:54Z.

Review: CHANGES_REQUESTED


The primitive identity proof misses writes to the upper register of a pair. In an otherwise accepted fixture, put 0x00200400 in v7, overwrite v[6:7] with a 64-bit right shift of zero, then export v7 as the primitive word. The shift writes both destinations, including zero to v7. But writes_vgpr() compares only the first destination of that instruction, so identity_prim() still finds the earlier constant and drops the export. Please track the actual writes to the exported register and add this case as a refusal test.

The binary-fixture CI job on this head also fails while compiling the new dumper with clang++. It reports 14 errors about captures of structured bindings before that compiler can run the new cases. Please make the test pass with the CI toolchain and retain the binary validation.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6134630901 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3711#pullrequestreview-6134630901). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-01T15:41:54Z. **Review:** CHANGES_REQUESTED --- The primitive identity proof misses writes to the upper register of a pair. In an otherwise accepted fixture, put 0x00200400 in v7, overwrite v[6:7] with a 64-bit right shift of zero, then export v7 as the primitive word. The shift writes both destinations, including zero to v7. But writes_vgpr() compares only the first destination of that instruction, so identity_prim() still finds the earlier constant and drops the export. Please track the actual writes to the exported register and add this case as a refusal test. The binary-fixture CI job on this head also fails while compiling the new dumper with clang++. It reports 14 errors about captures of structured bindings before that compiler can run the new cases. Please make the test pass with the CI toolchain and retain the binary validation.
SimSalabimse commented 2026-12-02 12:07:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-12-02T12:07:47Z.


Pushed the review fixes up to this branch (e239a843).

The identity proof now tracks the actual reaching write of the exported VGPR, including the upper register of a 64-bit pair. The v_lshrrev_b64 v[6:7] example that clears the upper half is now refused as ngg prim export not identity. I added a refusal test for that, prim-cleared-by-pair-shift, next to reversed-prim.

The four lambdas no longer capture structured bindings, so the clang++ binary fixture builds. Binary validation is unchanged: llvm-mc matched 35, g++ and clang++ translated 36.

Windows test PC, built with the dev preset at e239a843:

ctest --preset dev --no-tests=error -R "^(native_ngg_vs_passthrough|native_direct_container|startup_ngg_slice)$" -V

startup_ngg_slice and native_direct_container passed. native_ngg_vs_passthrough was skipped (the test requires both g++ and clang++; this Windows host has clang++ but not g++).

ctest --preset dev --no-tests=error -E "startup_audio_(output|pacing|provider)" -R "^(native_buffered_vertex_hardware|native_sampled_pixel_hardware|native_graphics_wqm_hardware|native_indexed_pixel_texture_hardware)$" -V

All four hardware tests passed: native_buffered_vertex_hardware, native_sampled_pixel_hardware, native_graphics_wqm_hardware, and native_indexed_pixel_texture_hardware.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7344882282 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3711#issuecomment-7344882282). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-12-02T12:07:47Z. --- Pushed the review fixes up to this branch (e239a843). The identity proof now tracks the actual reaching write of the exported VGPR, including the upper register of a 64-bit pair. The `v_lshrrev_b64 v[6:7]` example that clears the upper half is now refused as `ngg prim export not identity`. I added a refusal test for that, `prim-cleared-by-pair-shift`, next to `reversed-prim`. The four lambdas no longer capture structured bindings, so the clang++ binary fixture builds. Binary validation is unchanged: llvm-mc matched 35, g++ and clang++ translated 36. Windows test PC, built with the dev preset at e239a843: ``` ctest --preset dev --no-tests=error -R "^(native_ngg_vs_passthrough|native_direct_container|startup_ngg_slice)$" -V ``` `startup_ngg_slice` and `native_direct_container` passed. `native_ngg_vs_passthrough` was skipped (the test requires both g++ and clang++; this Windows host has clang++ but not g++). ``` ctest --preset dev --no-tests=error -E "startup_audio_(output|pacing|provider)" -R "^(native_buffered_vertex_hardware|native_sampled_pixel_hardware|native_graphics_wqm_hardware|native_indexed_pixel_texture_hardware)$" -V ``` All four hardware tests passed: `native_buffered_vertex_hardware`, `native_sampled_pixel_hardware`, `native_graphics_wqm_hardware`, and `native_indexed_pixel_texture_hardware`. AI-Assisted
R0Y00 commented 2026-12-02 13:23:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T13:23:59Z.

Review: APPROVED


I independently reviewed a76da5ee. The reaching-write check now includes the high VGPR of v_lshrrev_b64. In an isolated source archive I ran the repository NGG case runner with GCC and LLVM 15, covering 36 translation cases and comparing 35 encoded fixtures. Removing only v_lshrrev_b64 from the two-register result set made prim-cleared-by-pair-shift fail because the frontend emitted DXIL instead of refusing. The source was restored. Hosted LLVM CI also ran all 36 cases with Clang. Hosted Windows passed native_pixel_loop_entry_inputs_controls for the interpolation path retained by the conflict resolution. The trial merge against current main is clean.

Required Windows CI still reports native_direct_mesh at +0x34: unmapped graphics export (#3851) and startup_indirect_mesh_lease_warp_dual-trace with a missing req_*.m86. On main 5770f14e, the latter passed all four runs of ctest --preset dev --no-tests=error -j 1 -V --repeat until-fail:4 -R '^startup_indirect_mesh_lease_warp_dual-trace$' on Windows 11 26300.9974 and WARP 10.0.26100.9818 with the D3D12 debug layer enabled. This verifies the baseline in that environment. The earlier reviewer's follow-up and green Windows CI are still needed before merge.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6151612634 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3711#pullrequestreview-6151612634). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T13:23:59Z. **Review:** APPROVED --- I independently reviewed `a76da5ee`. The reaching-write check now includes the high VGPR of `v_lshrrev_b64`. In an isolated source archive I ran the repository NGG case runner with GCC and LLVM 15, covering 36 translation cases and comparing 35 encoded fixtures. Removing only `v_lshrrev_b64` from the two-register result set made `prim-cleared-by-pair-shift` fail because the frontend emitted DXIL instead of refusing. The source was restored. Hosted LLVM CI also ran all 36 cases with Clang. Hosted Windows passed `native_pixel_loop_entry_inputs_controls` for the interpolation path retained by the conflict resolution. The trial merge against current main is clean. Required Windows CI still reports `native_direct_mesh` at `+0x34: unmapped graphics export` (#3851) and `startup_indirect_mesh_lease_warp_dual-trace` with a missing `req_*.m86`. On main `5770f14e`, the latter passed all four runs of `ctest --preset dev --no-tests=error -j 1 -V --repeat until-fail:4 -R '^startup_indirect_mesh_lease_warp_dual-trace$'` on Windows 11 26300.9974 and WARP 10.0.26100.9818 with the D3D12 debug layer enabled. This verifies the baseline in that environment. The earlier reviewer's follow-up and green Windows CI are still needed before merge.
R0Y00 commented 2026-12-03 02:42:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T02:42:56Z.

Review: COMMENTED


I reproduced the first error from both Ubuntu jobs on 43918153 using Ubuntu 22.04 with GCC 11.4. The existing standalone header is missing D3D12_VS_OUTPUT_REGISTER_COUNT, which the fixed-entry code from #3527 now uses. Adding the SDK value of 32 to the fixture header allowed all 36 source-built GCC translation/refusal cases to pass. Please rerun the full Ubuntu jobs with clang++ and LLVM 15 after applying this.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6162828544 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3711#pullrequestreview-6162828544). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T02:42:56Z. **Review:** COMMENTED --- I reproduced the first error from both Ubuntu jobs on 43918153 using Ubuntu 22.04 with GCC 11.4. The existing standalone header is missing D3D12_VS_OUTPUT_REGISTER_COUNT, which the fixed-entry code from #3527 now uses. Adding the SDK value of 32 to the fixture header allowed all 36 source-built GCC translation/refusal cases to pass. Please rerun the full Ubuntu jobs with clang++ and LLVM 15 after applying this.
R0Y00 commented 2026-12-03 02:42:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T02:42:57Z.

Code review location: tests/native_ngg_vs_passthrough_check.py; line 362

@@ -0,0 +1,546 @@
+"""Native gfx1013 pass-through NGG vertex shaders.
+
+  (no arguments)     translate one accepted shape and the refusal contrasts
+                     with host g++ and clang++ (-Werror=narrowing)
+  binary <llvm-mc>   also reassemble every fixture with llvm-mc (gfx1013) and
+                     compare the words
+
+Accepted: a straight-line vertex shader whose local slots are private to each
+lane, whose one GS_ALLOC_REQ matches the wave, and whose one primitive export
+is the identity triangle. The local round trip becomes the captured register,
+and the allocation, barrier and identity export are omitted.
+
+Refused with a specific reason: a cross-lane local read, a non-identity
+primitive export, a later write that replaces that identity word (including
+the upper half of a 64-bit pair), an allocation whose counts are not the
+wave's, a barrier that is not between the writes and the reads, and every
+other unproved use.
+Pixel shaders and unrelated wave instructions keep the generic refusal.
+Exit 77 when g++ or clang++ is not on PATH. Nothing here is a hardware result.
+"""
+import re
+import shutil
+import struct
+import subprocess
+import sys
+import tempfile
+from pathlib import Path
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools'))
+sys.path.insert(0, str(Path(__file__).resolve().parent))
+import disasm_rdna2 as D  # noqa: E402
+from native_direct_container_check import patched_pixel, vertex  # noqa: E402
+
+ROOT = Path(__file__).resolve().parents[1]
+ADDR = 'ngg lds address not lane-private'
+USE = 'ngg lane address used outside an LDS access'
+OWN = "ngg lds read is not the lane's own slot"
+BARRIER = 'ngg barrier outside the lane-private round trip'
+MESSAGE = 'ngg sendmsg is not GS_ALLOC_REQ'
+COUNTS = 'ngg sendmsg counts not proven'
+PRIM = 'ngg prim export not identity'
+GENERIC = 'graphics wave or control-flow instruction'
+TERMINAL = 'incomplete or inconsistent terminal graphics exports'
+IDENTITY = 0x00200400
+WAIT = 0xbf8cc07f  # s_waitcnt lgkmcnt(0); the other counters stay at their no-wait maximum
+
+
+def opcode(table, name):
+    for op, info in table.items():
+        if info[0] == name or info[0] == name + '_e32':
+            return op
+    raise KeyError(name)
+
+
+def ssrc(value):
+    if isinstance(value, str):
+        if value.startswith('v'):
+            return 256 + int(value[1:]), None
+        return {'exec': 126, 'm0': 124, 'vcc': 106, '1.0': 242, '4.0': 246}.get(value) or int(value[1:]), None
+    if 0 <= value <= 64:
+        return 128 + value, None
+    if -16 <= value < 0:
+        return 192 - value, None
+    return 255, value & 0xffffffff
+
+
+def words(*values, lit=None):
+    return [w for w in values if w is not None] + ([] if lit is None else [lit])
+
+
+def sop1(name, dst, src):
+    source, lit = ssrc(src)
+    return words(0xbe800000 | ssrc(dst)[0] << 16 | opcode(D.SOP1_OPS, name) << 8 | source, lit=lit)
+
+
+def sopk(name, dst, simm):
+    return words(0xb0000000 | opcode(D.SOPK_OPS, name) << 23 | ssrc(dst)[0] << 16 | (simm & 0xffff))
+
+
+def sopp(name, imm=0):
+    return words(0xbf800000 | opcode(D.SOPP_OPS, name) << 16 | (imm & 0xffff))
+
+
+def vop1(name, dst, src):
+    source, lit = ssrc(src)
+    return words(0x7e000000 | int(dst[1:]) << 17 | opcode(D.VOP1_OPS, name) << 9 | source, lit=lit)
+
+
+def vop2(name, dst, src0, src1):
+    source, lit = ssrc(src0)
+    return words(opcode(D.VOP2_OPS, name) << 25 | int(dst[1:]) << 17 | int(src1[1:]) << 9 | source, lit=lit)
+
+
+def vop3(name, dst, *src):
+    op = opcode(D.VOP3_NATIVE_OPS, name)
+    codes = [ssrc(item)[0] for item in src] + [0] * (3 - len(src))
+    return words(0xd4000000 | op << 16 | int(dst[1:]), codes[2] << 18 | codes[1] << 9 | codes[0])
+
+
+def ds(name, addr, data=None, dst=None, offset=0, gds=False):
+    op = opcode(D.DS_OPS, name)
+    word = 0xd8000000 | op << 18 | offset
+    if gds:
+        word |= 1 << 17
+    return words(word, (int(dst[1:]) if dst else 0) << 24 | (int(data[1:]) if data else 0) << 8 | int(addr[1:]))
+
+
+def exp(target, srcs, done=False):
+    enable = sum(1 << i for i, src in enumerate(srcs) if src != 'off')
+    regs = [0 if src == 'off' else int(src[1:]) for src in srcs]
+    return words(0xf8000000 | (done << 11) | target << 4 | enable, regs[3] << 24 | regs[2] << 16 | regs[1] << 8 | regs[0])
+
+
+def row(text, encoded):
+    return (text, encoded)
+
+
+def alloc(count, movk=False):
+    if movk:
+        return [row(f's_movk_i32 m0, 0x{count:x}', sopk('s_movk_i32', 'm0', count))]
+    return [row(f's_mov_b32 m0, 0x{count:x}', sop1('s_mov_b32', 'm0', count))]
+
+
+def send(imm=9):
+    return [row(f's_sendmsg 0x{imm:x}', sopp('s_sendmsg', imm))]
+
+
+def lane(high=True):
+    rows = [row('v_mbcnt_lo_u32_b32 v1, -1, 0', vop3('v_mbcnt_lo_u32_b32', 'v1', -1, 0))]
+    if high:
+        rows.append(row('v_mbcnt_hi_u32_b32 v1, -1, v1', vop3('v_mbcnt_hi_u32_b32', 'v1', -1, 'v1')))
+    return rows
+
+
+def wait():
+    return [row('s_waitcnt lgkmcnt(0)', [WAIT])]
+
+
+def barrier():
+    return [row('s_barrier 0x0', sopp('s_barrier'))]
+
+
+def payload(reg='v3', value='1.0'):
+    return [row(f'v_mov_b32_e32 {reg}, {value}', vop1('v_mov_b32', reg, value if isinstance(value, str) else value))]
+
+
+def const_mov(reg, value):
+    return [row(f'v_mov_b32_e32 {reg}, 0x{value:x}', vop1('v_mov_b32', reg, value))]
+
+
+def position(reg='v4'):
+    return [row(f'exp pos0 {reg}, {reg}, {reg}, {reg}', exp(12, [reg, reg, reg, reg]))]
+
+
+def primitive(reg='v5', done=True):
+    return [row(f"exp target_20 {reg}, off, off, off{' done' if done else ''}",
+                exp(20, [reg, 'off', 'off', 'off'], done=done))]
+
+
+def end():
+    return [row('s_endpgm', sopp('s_endpgm'))]
+
+
+def local_write(addr='v2', data='v3', offset=0, gds=False, op='ds_write_b32'):
+    text = f'{op} {addr}, {data}'
+    if offset:
+        text += f' offset:{offset}'
+    if gds:
+        text += ' gds'
+    return [row(text, ds(op, addr, data=data, offset=offset, gds=gds))]
+
+
+def local_read(dst='v4', addr='v2', offset=0):
+    text = f'ds_read_b32 {dst}, {addr}'
+    if offset:
+        text += f' offset:{offset}'
+    return [row(text, ds('ds_read_b32', addr, dst=dst, offset=offset))]
+
+
+def round_trip(address, reads=None, writes=None, wait_count=True, with_barrier=True):
+    """address rows, then writes, optional wait and barrier, then reads."""
+    body = list(address)
+    body += writes if writes is not None else local_write()
+    if wait_count:
+        body += wait()
+    if with_barrier:
+        body += barrier()
+    body += reads if reads is not None else local_read()
+    return body
+
+
+def zero_pair_shift(first=6):
+    """v_lshrrev_b64 of inline zero. Both halves of the destination become zero."""
+    return [row(f'v_lshrrev_b64 v[{first}:{first + 1}], 0, 0', [0xd7000000 | first, 0x00010080])]
+
+
+def pass_through(count=0x1040, high=True, movk=False, address=None, after_write=(), read_offset=0,
+                 with_barrier=True, with_send=True, send_imm=9, prim_reg='v5', prim_value=IDENTITY,
+                 with_prim=True, with_pos=True, pos_reg='v4', before_export=()):
+    body = alloc(count, movk=movk)
+    if with_send:
+        body += send(send_imm)
+    body += lane(high)
+    body += address if address is not None else [
+        row('v_mov_b32_e32 v6, v1', vop1('v_mov_b32', 'v6', 'v1')),
+        row('v_lshlrev_b32_e32 v2, 2, v6', vop2('v_lshlrev_b32', 'v2', 2, 'v6')),
+    ]
+    body += payload()
+    body += local_write()
+    body += after_write
+    body += wait()
+    if with_barrier:
+        body += barrier()
+    body += local_read(offset=read_offset)
+    if prim_value is not None:
+        body += const_mov(prim_reg, prim_value)
+    body += before_export
+    if with_pos:
+        body += position(pos_reg)
+    if with_prim:
+        body += primitive(prim_reg)
+    body += end()
+    return body
+
+
+CASES = [
+    dict(name='identity', rows=pass_through(), ok=True, stores=4, has=('1065353216',),
+         lacks=('addrspace(3)', 'dx.op.barrier', 'waveGetLaneIndex')),
+    dict(name='wave32-mad', wave32=True, ok=True, stores=4, has=('1065353216',),
+         lacks=('addrspace(3)', 'dx.op.barrier'),
+         rows=pass_through(count=0x1020, high=False, movk=True, address=[
+             row('v_mad_u32_u24 v2, v1, 4, 0', vop3('v_mad_u32_u24', 'v2', 'v1', 4, 0))])),
+    dict(name='mul-add-snapshot', ok=True, stores=4, has=('1065353216',),
+         lacks=('addrspace(3)', 'dx.op.barrier', 'bitcast i32 0 to float'),
+         rows=pass_through(address=[
+             row('v_mul_u32_u24_e32 v2, 4, v1', vop2('v_mul_u32_u24', 'v2', 4, 'v1')),
+             row('v_add_nc_u32_e32 v2, 64, v2', vop2('v_add_nc_u32', 'v2', 64, 'v2')),
+         ], after_write=payload('v3', 0))),
+    dict(name='plain-vertex', plain=True, ok=True, stores=4, lacks=('addrspace(3)', 'dx.op.barrier')),
+    dict(name='cross-lane-read', rows=pass_through(read_offset=4), reason=ADDR),
+    dict(name='prim-exports-vertex-id', rows=pass_through(prim_reg='v0', prim_value=None), reason=PRIM),
+    dict(name='reversed-prim', rows=pass_through(prim_value=0x402), reason=PRIM),
+    # 0x00200400 is written to v7, then v_lshrrev_b64 v[6:7], 0, 0 clears both halves.
+    dict(name='prim-cleared-by-pair-shift', reason=PRIM,
+         rows=pass_through(prim_reg='v7', before_export=zero_pair_shift())),
+    dict(name='second-prim', reason=PRIM, rows=pass_through()[:-1] + primitive() + end()),
+    dict(name='unproven-count-word', rows=pass_through(count=0x1003), reason=COUNTS),
+    dict(name='count-from-register', reason=COUNTS, rows=[
+        row('s_mov_b32 m0, s0', sop1('s_mov_b32', 'm0', 's0'))] + pass_through()[1:]),
+    dict(name='sendmsg-before-count', reason=COUNTS, rows=send() + pass_through()),
+    dict(name='missing-sendmsg', rows=pass_through(with_send=False), reason=COUNTS),
+    dict(name='m0-without-pattern', reason=COUNTS, rows=alloc(0x1040) + position('v0') + end()),
+    dict(name='not-gs-alloc', rows=pass_through(send_imm=0x109), reason=MESSAGE),
+    dict(name='missing-barrier', rows=pass_through(with_barrier=False), reason=BARRIER),
+    dict(name='barrier-before-writes', reason=BARRIER, rows=alloc(0x1040) + send() + barrier() + lane() + end()),
+    dict(name='write-after-read', reason=BARRIER,
+         rows=pass_through()[:-1] + local_write() + end()),
+    dict(name='half-lane-id', rows=pass_through(high=False), reason=ADDR),
+    dict(name='unaligned-slot', reason=ADDR, rows=pass_through(address=[
+        row('v_lshlrev_b32_e32 v2, 1, v1', vop2('v_lshlrev_b32', 'v2', 1, 'v1'))])),
+    dict(name='gds-write', reason=ADDR, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + payload() + local_write(gds=True) + end()),
+    dict(name='other-ds-op', reason=ADDR, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + payload() + local_write(op='ds_add_u32') + end()),
+    dict(name='unread-private-slot', reason=OWN, rows=pass_through(read_offset=4, address=[
+        row('v_lshlrev_b32_e32 v2, 3, v1', vop2('v_lshlrev_b32', 'v2', 3, 'v1'))])),
+    dict(name='second-slot-unread', reason=OWN, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1')),
+        row('v_add_nc_u32_e32 v7, 0x100, v2', vop2('v_add_nc_u32', 'v7', 256, 'v2')),
+    ] + payload() + local_write('v2') + local_write('v7') + wait() + barrier() + local_read() +
+        const_mov('v5', IDENTITY) + position() + primitive() + end()),
+    dict(name='read-without-write', reason=OWN, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + local_read() + end()),
+    dict(name='lane-address-exported', reason=USE, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + position('v2') + end()),
+    dict(name='lane-address-stored', reason=USE, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + local_write(data='v2') + end()),
+    dict(name='wave32-mbcnt-hi', wave32=True, reason=ADDR, rows=pass_through(count=0x1020, high=True)),
+    dict(name='wave32-wide-count', wave32=True, reason=COUNTS, rows=pass_through(count=0x1040, high=False)),
+    dict(name='missing-position', rows=pass_through(with_pos=False), reason=TERMINAL),
+    dict(name='scalar-sleep', reason=GENERIC, rows=[row('s_sleep 0', sopp('s_sleep'))] + end()),
+    # The branch itself is a block terminator, so the walk never treats it as a
+    # wave instruction. The shader still has no position export and must refuse.
+    dict(name='scalar-branch', reason=TERMINAL, rows=[row('s_branch label_0x4', sopp('s_branch'))] + end()),
+    dict(name='pixel-local', pixel=True, reason=GENERIC, rows=local_write()),
+    dict(name='pixel-sendmsg', pixel=True, reason=GENERIC, rows=send()),
+    dict(name='pixel-mbcnt', pixel=True, reason=GENERIC, rows=lane(False)),
+    dict(name='pixel-barrier', pixel=True, reason=GENERIC, rows=barrier()),
+]
+
+
+def flatten(rows):
+    out = []
+    for _, encoded in rows:
+        out.extend(encoded)
+    return out
+
+
+def check_decode(rows):
+    blob = struct.pack(f'<{len(flatten(rows))}I', *flatten(rows))
+    offset = 0
+    for text, encoded in rows:
+        size, _name, asm, _comment = D.decode_instruction(blob, offset)
+        if size != 4 * len(encoded) or asm != text:
+            raise SystemExit(f'decoded {asm!r}, expected {text!r} at +0x{offset:x}')
+        offset += size
+    if offset != len(blob):
+        raise SystemExit(f'decode stopped at {offset} of {len(blob)}')
+
+
+def container(case):
+    if case.get('plain'):
+        return vertex()
+    rows = case['rows']
+    check_decode(rows)
+    if case.get('pixel'):
+        # `where` is the word index of the placeholder export, after the prefix.
+        words = flatten(rows)
+        return patched_pixel(len(words), words)
+    return vertex(program=flatten(rows), wave32=case.get('wave32', False))
+
+
+D3D12_H = r'''#pragma once
+#include <cstdint>
+#include <cstddef>
+using HRESULT = long;
+using UINT = unsigned int;
+#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0)
+#define FAILED(hr) ((HRESULT)(hr) < 0)
+#define E_INVALIDARG ((HRESULT)0x80070057L)
+#define IID_PPV_ARGS(pp) static_cast<const void*>(nullptr), reinterpret_cast<void**>(pp)
+enum D3D_NAME {
+    D3D_NAME_POSITION = 1, D3D_NAME_CLIP_DISTANCE = 2, D3D_NAME_CULL_DISTANCE = 3,
+    D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, D3D_NAME_VIEWPORT_ARRAY_INDEX = 5,
+    D3D_NAME_IS_FRONT_FACE = 9, D3D_NAME_TARGET = 64, D3D_NAME_DEPTH = 65,
+    D3D_NAME_COVERAGE = 66, D3D_NAME_DEPTH_GREATER_EQUAL = 67,
+    D3D_NAME_DEPTH_LESS_EQUAL = 68, D3D_NAME_STENCIL_REF = 69
+};
+enum D3D_ROOT_SIGNATURE_VERSION { D3D_ROOT_SIGNATURE_VERSION_1_1 = 2 };
+enum D3D12_ROOT_PARAMETER_TYPE {
+    D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0,
+    D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 1,
+    D3D12_ROOT_PARAMETER_TYPE_CBV = 2,
+    D3D12_ROOT_PARAMETER_TYPE_SRV = 3,
+    D3D12_ROOT_PARAMETER_TYPE_UAV = 4
+};
+enum D3D12_SHADER_VISIBILITY {
+    D3D12_SHADER_VISIBILITY_ALL = 0, D3D12_SHADER_VISIBILITY_VERTEX = 1,
+    D3D12_SHADER_VISIBILITY_PIXEL = 5, D3D12_SHADER_VISIBILITY_MESH = 7
+};
+enum D3D12_DESCRIPTOR_RANGE_TYPE {
+    D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0, D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1,
+    D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2
+};
+enum D3D12_ROOT_SIGNATURE_FLAGS {
+    D3D12_ROOT_SIGNATURE_FLAG_NONE = 0,
+    D3D12_ROOT_SIGNATURE_FLAG_DENY_MESH_SHADER_ROOT_ACCESS = 0x200,
+    D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED = 0x400,
+    D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED = 0x800
+};
+#define D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND 0xffffffffu
+#define D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 1000000u

This is the only change in the passing local GCC probe.

#define D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 1000000u
inline constexpr unsigned D3D12_VS_OUTPUT_REGISTER_COUNT = 32;
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4779191770 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3711#discussion_r4779191770). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T02:42:57Z. **Code review location:** `tests/native_ngg_vs_passthrough_check.py`; line 362 ~~~~diff @@ -0,0 +1,546 @@ +"""Native gfx1013 pass-through NGG vertex shaders. + + (no arguments) translate one accepted shape and the refusal contrasts + with host g++ and clang++ (-Werror=narrowing) + binary <llvm-mc> also reassemble every fixture with llvm-mc (gfx1013) and + compare the words + +Accepted: a straight-line vertex shader whose local slots are private to each +lane, whose one GS_ALLOC_REQ matches the wave, and whose one primitive export +is the identity triangle. The local round trip becomes the captured register, +and the allocation, barrier and identity export are omitted. + +Refused with a specific reason: a cross-lane local read, a non-identity +primitive export, a later write that replaces that identity word (including +the upper half of a 64-bit pair), an allocation whose counts are not the +wave's, a barrier that is not between the writes and the reads, and every +other unproved use. +Pixel shaders and unrelated wave instructions keep the generic refusal. +Exit 77 when g++ or clang++ is not on PATH. Nothing here is a hardware result. +""" +import re +import shutil +import struct +import subprocess +import sys +import tempfile +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools')) +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import disasm_rdna2 as D # noqa: E402 +from native_direct_container_check import patched_pixel, vertex # noqa: E402 + +ROOT = Path(__file__).resolve().parents[1] +ADDR = 'ngg lds address not lane-private' +USE = 'ngg lane address used outside an LDS access' +OWN = "ngg lds read is not the lane's own slot" +BARRIER = 'ngg barrier outside the lane-private round trip' +MESSAGE = 'ngg sendmsg is not GS_ALLOC_REQ' +COUNTS = 'ngg sendmsg counts not proven' +PRIM = 'ngg prim export not identity' +GENERIC = 'graphics wave or control-flow instruction' +TERMINAL = 'incomplete or inconsistent terminal graphics exports' +IDENTITY = 0x00200400 +WAIT = 0xbf8cc07f # s_waitcnt lgkmcnt(0); the other counters stay at their no-wait maximum + + +def opcode(table, name): + for op, info in table.items(): + if info[0] == name or info[0] == name + '_e32': + return op + raise KeyError(name) + + +def ssrc(value): + if isinstance(value, str): + if value.startswith('v'): + return 256 + int(value[1:]), None + return {'exec': 126, 'm0': 124, 'vcc': 106, '1.0': 242, '4.0': 246}.get(value) or int(value[1:]), None + if 0 <= value <= 64: + return 128 + value, None + if -16 <= value < 0: + return 192 - value, None + return 255, value & 0xffffffff + + +def words(*values, lit=None): + return [w for w in values if w is not None] + ([] if lit is None else [lit]) + + +def sop1(name, dst, src): + source, lit = ssrc(src) + return words(0xbe800000 | ssrc(dst)[0] << 16 | opcode(D.SOP1_OPS, name) << 8 | source, lit=lit) + + +def sopk(name, dst, simm): + return words(0xb0000000 | opcode(D.SOPK_OPS, name) << 23 | ssrc(dst)[0] << 16 | (simm & 0xffff)) + + +def sopp(name, imm=0): + return words(0xbf800000 | opcode(D.SOPP_OPS, name) << 16 | (imm & 0xffff)) + + +def vop1(name, dst, src): + source, lit = ssrc(src) + return words(0x7e000000 | int(dst[1:]) << 17 | opcode(D.VOP1_OPS, name) << 9 | source, lit=lit) + + +def vop2(name, dst, src0, src1): + source, lit = ssrc(src0) + return words(opcode(D.VOP2_OPS, name) << 25 | int(dst[1:]) << 17 | int(src1[1:]) << 9 | source, lit=lit) + + +def vop3(name, dst, *src): + op = opcode(D.VOP3_NATIVE_OPS, name) + codes = [ssrc(item)[0] for item in src] + [0] * (3 - len(src)) + return words(0xd4000000 | op << 16 | int(dst[1:]), codes[2] << 18 | codes[1] << 9 | codes[0]) + + +def ds(name, addr, data=None, dst=None, offset=0, gds=False): + op = opcode(D.DS_OPS, name) + word = 0xd8000000 | op << 18 | offset + if gds: + word |= 1 << 17 + return words(word, (int(dst[1:]) if dst else 0) << 24 | (int(data[1:]) if data else 0) << 8 | int(addr[1:])) + + +def exp(target, srcs, done=False): + enable = sum(1 << i for i, src in enumerate(srcs) if src != 'off') + regs = [0 if src == 'off' else int(src[1:]) for src in srcs] + return words(0xf8000000 | (done << 11) | target << 4 | enable, regs[3] << 24 | regs[2] << 16 | regs[1] << 8 | regs[0]) + + +def row(text, encoded): + return (text, encoded) + + +def alloc(count, movk=False): + if movk: + return [row(f's_movk_i32 m0, 0x{count:x}', sopk('s_movk_i32', 'm0', count))] + return [row(f's_mov_b32 m0, 0x{count:x}', sop1('s_mov_b32', 'm0', count))] + + +def send(imm=9): + return [row(f's_sendmsg 0x{imm:x}', sopp('s_sendmsg', imm))] + + +def lane(high=True): + rows = [row('v_mbcnt_lo_u32_b32 v1, -1, 0', vop3('v_mbcnt_lo_u32_b32', 'v1', -1, 0))] + if high: + rows.append(row('v_mbcnt_hi_u32_b32 v1, -1, v1', vop3('v_mbcnt_hi_u32_b32', 'v1', -1, 'v1'))) + return rows + + +def wait(): + return [row('s_waitcnt lgkmcnt(0)', [WAIT])] + + +def barrier(): + return [row('s_barrier 0x0', sopp('s_barrier'))] + + +def payload(reg='v3', value='1.0'): + return [row(f'v_mov_b32_e32 {reg}, {value}', vop1('v_mov_b32', reg, value if isinstance(value, str) else value))] + + +def const_mov(reg, value): + return [row(f'v_mov_b32_e32 {reg}, 0x{value:x}', vop1('v_mov_b32', reg, value))] + + +def position(reg='v4'): + return [row(f'exp pos0 {reg}, {reg}, {reg}, {reg}', exp(12, [reg, reg, reg, reg]))] + + +def primitive(reg='v5', done=True): + return [row(f"exp target_20 {reg}, off, off, off{' done' if done else ''}", + exp(20, [reg, 'off', 'off', 'off'], done=done))] + + +def end(): + return [row('s_endpgm', sopp('s_endpgm'))] + + +def local_write(addr='v2', data='v3', offset=0, gds=False, op='ds_write_b32'): + text = f'{op} {addr}, {data}' + if offset: + text += f' offset:{offset}' + if gds: + text += ' gds' + return [row(text, ds(op, addr, data=data, offset=offset, gds=gds))] + + +def local_read(dst='v4', addr='v2', offset=0): + text = f'ds_read_b32 {dst}, {addr}' + if offset: + text += f' offset:{offset}' + return [row(text, ds('ds_read_b32', addr, dst=dst, offset=offset))] + + +def round_trip(address, reads=None, writes=None, wait_count=True, with_barrier=True): + """address rows, then writes, optional wait and barrier, then reads.""" + body = list(address) + body += writes if writes is not None else local_write() + if wait_count: + body += wait() + if with_barrier: + body += barrier() + body += reads if reads is not None else local_read() + return body + + +def zero_pair_shift(first=6): + """v_lshrrev_b64 of inline zero. Both halves of the destination become zero.""" + return [row(f'v_lshrrev_b64 v[{first}:{first + 1}], 0, 0', [0xd7000000 | first, 0x00010080])] + + +def pass_through(count=0x1040, high=True, movk=False, address=None, after_write=(), read_offset=0, + with_barrier=True, with_send=True, send_imm=9, prim_reg='v5', prim_value=IDENTITY, + with_prim=True, with_pos=True, pos_reg='v4', before_export=()): + body = alloc(count, movk=movk) + if with_send: + body += send(send_imm) + body += lane(high) + body += address if address is not None else [ + row('v_mov_b32_e32 v6, v1', vop1('v_mov_b32', 'v6', 'v1')), + row('v_lshlrev_b32_e32 v2, 2, v6', vop2('v_lshlrev_b32', 'v2', 2, 'v6')), + ] + body += payload() + body += local_write() + body += after_write + body += wait() + if with_barrier: + body += barrier() + body += local_read(offset=read_offset) + if prim_value is not None: + body += const_mov(prim_reg, prim_value) + body += before_export + if with_pos: + body += position(pos_reg) + if with_prim: + body += primitive(prim_reg) + body += end() + return body + + +CASES = [ + dict(name='identity', rows=pass_through(), ok=True, stores=4, has=('1065353216',), + lacks=('addrspace(3)', 'dx.op.barrier', 'waveGetLaneIndex')), + dict(name='wave32-mad', wave32=True, ok=True, stores=4, has=('1065353216',), + lacks=('addrspace(3)', 'dx.op.barrier'), + rows=pass_through(count=0x1020, high=False, movk=True, address=[ + row('v_mad_u32_u24 v2, v1, 4, 0', vop3('v_mad_u32_u24', 'v2', 'v1', 4, 0))])), + dict(name='mul-add-snapshot', ok=True, stores=4, has=('1065353216',), + lacks=('addrspace(3)', 'dx.op.barrier', 'bitcast i32 0 to float'), + rows=pass_through(address=[ + row('v_mul_u32_u24_e32 v2, 4, v1', vop2('v_mul_u32_u24', 'v2', 4, 'v1')), + row('v_add_nc_u32_e32 v2, 64, v2', vop2('v_add_nc_u32', 'v2', 64, 'v2')), + ], after_write=payload('v3', 0))), + dict(name='plain-vertex', plain=True, ok=True, stores=4, lacks=('addrspace(3)', 'dx.op.barrier')), + dict(name='cross-lane-read', rows=pass_through(read_offset=4), reason=ADDR), + dict(name='prim-exports-vertex-id', rows=pass_through(prim_reg='v0', prim_value=None), reason=PRIM), + dict(name='reversed-prim', rows=pass_through(prim_value=0x402), reason=PRIM), + # 0x00200400 is written to v7, then v_lshrrev_b64 v[6:7], 0, 0 clears both halves. + dict(name='prim-cleared-by-pair-shift', reason=PRIM, + rows=pass_through(prim_reg='v7', before_export=zero_pair_shift())), + dict(name='second-prim', reason=PRIM, rows=pass_through()[:-1] + primitive() + end()), + dict(name='unproven-count-word', rows=pass_through(count=0x1003), reason=COUNTS), + dict(name='count-from-register', reason=COUNTS, rows=[ + row('s_mov_b32 m0, s0', sop1('s_mov_b32', 'm0', 's0'))] + pass_through()[1:]), + dict(name='sendmsg-before-count', reason=COUNTS, rows=send() + pass_through()), + dict(name='missing-sendmsg', rows=pass_through(with_send=False), reason=COUNTS), + dict(name='m0-without-pattern', reason=COUNTS, rows=alloc(0x1040) + position('v0') + end()), + dict(name='not-gs-alloc', rows=pass_through(send_imm=0x109), reason=MESSAGE), + dict(name='missing-barrier', rows=pass_through(with_barrier=False), reason=BARRIER), + dict(name='barrier-before-writes', reason=BARRIER, rows=alloc(0x1040) + send() + barrier() + lane() + end()), + dict(name='write-after-read', reason=BARRIER, + rows=pass_through()[:-1] + local_write() + end()), + dict(name='half-lane-id', rows=pass_through(high=False), reason=ADDR), + dict(name='unaligned-slot', reason=ADDR, rows=pass_through(address=[ + row('v_lshlrev_b32_e32 v2, 1, v1', vop2('v_lshlrev_b32', 'v2', 1, 'v1'))])), + dict(name='gds-write', reason=ADDR, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + payload() + local_write(gds=True) + end()), + dict(name='other-ds-op', reason=ADDR, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + payload() + local_write(op='ds_add_u32') + end()), + dict(name='unread-private-slot', reason=OWN, rows=pass_through(read_offset=4, address=[ + row('v_lshlrev_b32_e32 v2, 3, v1', vop2('v_lshlrev_b32', 'v2', 3, 'v1'))])), + dict(name='second-slot-unread', reason=OWN, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1')), + row('v_add_nc_u32_e32 v7, 0x100, v2', vop2('v_add_nc_u32', 'v7', 256, 'v2')), + ] + payload() + local_write('v2') + local_write('v7') + wait() + barrier() + local_read() + + const_mov('v5', IDENTITY) + position() + primitive() + end()), + dict(name='read-without-write', reason=OWN, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + local_read() + end()), + dict(name='lane-address-exported', reason=USE, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + position('v2') + end()), + dict(name='lane-address-stored', reason=USE, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + local_write(data='v2') + end()), + dict(name='wave32-mbcnt-hi', wave32=True, reason=ADDR, rows=pass_through(count=0x1020, high=True)), + dict(name='wave32-wide-count', wave32=True, reason=COUNTS, rows=pass_through(count=0x1040, high=False)), + dict(name='missing-position', rows=pass_through(with_pos=False), reason=TERMINAL), + dict(name='scalar-sleep', reason=GENERIC, rows=[row('s_sleep 0', sopp('s_sleep'))] + end()), + # The branch itself is a block terminator, so the walk never treats it as a + # wave instruction. The shader still has no position export and must refuse. + dict(name='scalar-branch', reason=TERMINAL, rows=[row('s_branch label_0x4', sopp('s_branch'))] + end()), + dict(name='pixel-local', pixel=True, reason=GENERIC, rows=local_write()), + dict(name='pixel-sendmsg', pixel=True, reason=GENERIC, rows=send()), + dict(name='pixel-mbcnt', pixel=True, reason=GENERIC, rows=lane(False)), + dict(name='pixel-barrier', pixel=True, reason=GENERIC, rows=barrier()), +] + + +def flatten(rows): + out = [] + for _, encoded in rows: + out.extend(encoded) + return out + + +def check_decode(rows): + blob = struct.pack(f'<{len(flatten(rows))}I', *flatten(rows)) + offset = 0 + for text, encoded in rows: + size, _name, asm, _comment = D.decode_instruction(blob, offset) + if size != 4 * len(encoded) or asm != text: + raise SystemExit(f'decoded {asm!r}, expected {text!r} at +0x{offset:x}') + offset += size + if offset != len(blob): + raise SystemExit(f'decode stopped at {offset} of {len(blob)}') + + +def container(case): + if case.get('plain'): + return vertex() + rows = case['rows'] + check_decode(rows) + if case.get('pixel'): + # `where` is the word index of the placeholder export, after the prefix. + words = flatten(rows) + return patched_pixel(len(words), words) + return vertex(program=flatten(rows), wave32=case.get('wave32', False)) + + +D3D12_H = r'''#pragma once +#include <cstdint> +#include <cstddef> +using HRESULT = long; +using UINT = unsigned int; +#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) +#define FAILED(hr) ((HRESULT)(hr) < 0) +#define E_INVALIDARG ((HRESULT)0x80070057L) +#define IID_PPV_ARGS(pp) static_cast<const void*>(nullptr), reinterpret_cast<void**>(pp) +enum D3D_NAME { + D3D_NAME_POSITION = 1, D3D_NAME_CLIP_DISTANCE = 2, D3D_NAME_CULL_DISTANCE = 3, + D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, D3D_NAME_VIEWPORT_ARRAY_INDEX = 5, + D3D_NAME_IS_FRONT_FACE = 9, D3D_NAME_TARGET = 64, D3D_NAME_DEPTH = 65, + D3D_NAME_COVERAGE = 66, D3D_NAME_DEPTH_GREATER_EQUAL = 67, + D3D_NAME_DEPTH_LESS_EQUAL = 68, D3D_NAME_STENCIL_REF = 69 +}; +enum D3D_ROOT_SIGNATURE_VERSION { D3D_ROOT_SIGNATURE_VERSION_1_1 = 2 }; +enum D3D12_ROOT_PARAMETER_TYPE { + D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0, + D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 1, + D3D12_ROOT_PARAMETER_TYPE_CBV = 2, + D3D12_ROOT_PARAMETER_TYPE_SRV = 3, + D3D12_ROOT_PARAMETER_TYPE_UAV = 4 +}; +enum D3D12_SHADER_VISIBILITY { + D3D12_SHADER_VISIBILITY_ALL = 0, D3D12_SHADER_VISIBILITY_VERTEX = 1, + D3D12_SHADER_VISIBILITY_PIXEL = 5, D3D12_SHADER_VISIBILITY_MESH = 7 +}; +enum D3D12_DESCRIPTOR_RANGE_TYPE { + D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0, D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1, + D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2 +}; +enum D3D12_ROOT_SIGNATURE_FLAGS { + D3D12_ROOT_SIGNATURE_FLAG_NONE = 0, + D3D12_ROOT_SIGNATURE_FLAG_DENY_MESH_SHADER_ROOT_ACCESS = 0x200, + D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED = 0x400, + D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED = 0x800 +}; +#define D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND 0xffffffffu +#define D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 1000000u ~~~~ --- This is the only change in the passing local GCC probe. ```suggestion #define D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 1000000u inline constexpr unsigned D3D12_VS_OUTPUT_REGISTER_COUNT = 32; ```
SimSalabimse commented 2026-12-03 11:35:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-12-03T11:35:04Z.

Code review location: tests/native_ngg_vs_passthrough_check.py; line 362

@@ -0,0 +1,546 @@
+"""Native gfx1013 pass-through NGG vertex shaders.
+
+  (no arguments)     translate one accepted shape and the refusal contrasts
+                     with host g++ and clang++ (-Werror=narrowing)
+  binary <llvm-mc>   also reassemble every fixture with llvm-mc (gfx1013) and
+                     compare the words
+
+Accepted: a straight-line vertex shader whose local slots are private to each
+lane, whose one GS_ALLOC_REQ matches the wave, and whose one primitive export
+is the identity triangle. The local round trip becomes the captured register,
+and the allocation, barrier and identity export are omitted.
+
+Refused with a specific reason: a cross-lane local read, a non-identity
+primitive export, a later write that replaces that identity word (including
+the upper half of a 64-bit pair), an allocation whose counts are not the
+wave's, a barrier that is not between the writes and the reads, and every
+other unproved use.
+Pixel shaders and unrelated wave instructions keep the generic refusal.
+Exit 77 when g++ or clang++ is not on PATH. Nothing here is a hardware result.
+"""
+import re
+import shutil
+import struct
+import subprocess
+import sys
+import tempfile
+from pathlib import Path
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools'))
+sys.path.insert(0, str(Path(__file__).resolve().parent))
+import disasm_rdna2 as D  # noqa: E402
+from native_direct_container_check import patched_pixel, vertex  # noqa: E402
+
+ROOT = Path(__file__).resolve().parents[1]
+ADDR = 'ngg lds address not lane-private'
+USE = 'ngg lane address used outside an LDS access'
+OWN = "ngg lds read is not the lane's own slot"
+BARRIER = 'ngg barrier outside the lane-private round trip'
+MESSAGE = 'ngg sendmsg is not GS_ALLOC_REQ'
+COUNTS = 'ngg sendmsg counts not proven'
+PRIM = 'ngg prim export not identity'
+GENERIC = 'graphics wave or control-flow instruction'
+TERMINAL = 'incomplete or inconsistent terminal graphics exports'
+IDENTITY = 0x00200400
+WAIT = 0xbf8cc07f  # s_waitcnt lgkmcnt(0); the other counters stay at their no-wait maximum
+
+
+def opcode(table, name):
+    for op, info in table.items():
+        if info[0] == name or info[0] == name + '_e32':
+            return op
+    raise KeyError(name)
+
+
+def ssrc(value):
+    if isinstance(value, str):
+        if value.startswith('v'):
+            return 256 + int(value[1:]), None
+        return {'exec': 126, 'm0': 124, 'vcc': 106, '1.0': 242, '4.0': 246}.get(value) or int(value[1:]), None
+    if 0 <= value <= 64:
+        return 128 + value, None
+    if -16 <= value < 0:
+        return 192 - value, None
+    return 255, value & 0xffffffff
+
+
+def words(*values, lit=None):
+    return [w for w in values if w is not None] + ([] if lit is None else [lit])
+
+
+def sop1(name, dst, src):
+    source, lit = ssrc(src)
+    return words(0xbe800000 | ssrc(dst)[0] << 16 | opcode(D.SOP1_OPS, name) << 8 | source, lit=lit)
+
+
+def sopk(name, dst, simm):
+    return words(0xb0000000 | opcode(D.SOPK_OPS, name) << 23 | ssrc(dst)[0] << 16 | (simm & 0xffff))
+
+
+def sopp(name, imm=0):
+    return words(0xbf800000 | opcode(D.SOPP_OPS, name) << 16 | (imm & 0xffff))
+
+
+def vop1(name, dst, src):
+    source, lit = ssrc(src)
+    return words(0x7e000000 | int(dst[1:]) << 17 | opcode(D.VOP1_OPS, name) << 9 | source, lit=lit)
+
+
+def vop2(name, dst, src0, src1):
+    source, lit = ssrc(src0)
+    return words(opcode(D.VOP2_OPS, name) << 25 | int(dst[1:]) << 17 | int(src1[1:]) << 9 | source, lit=lit)
+
+
+def vop3(name, dst, *src):
+    op = opcode(D.VOP3_NATIVE_OPS, name)
+    codes = [ssrc(item)[0] for item in src] + [0] * (3 - len(src))
+    return words(0xd4000000 | op << 16 | int(dst[1:]), codes[2] << 18 | codes[1] << 9 | codes[0])
+
+
+def ds(name, addr, data=None, dst=None, offset=0, gds=False):
+    op = opcode(D.DS_OPS, name)
+    word = 0xd8000000 | op << 18 | offset
+    if gds:
+        word |= 1 << 17
+    return words(word, (int(dst[1:]) if dst else 0) << 24 | (int(data[1:]) if data else 0) << 8 | int(addr[1:]))
+
+
+def exp(target, srcs, done=False):
+    enable = sum(1 << i for i, src in enumerate(srcs) if src != 'off')
+    regs = [0 if src == 'off' else int(src[1:]) for src in srcs]
+    return words(0xf8000000 | (done << 11) | target << 4 | enable, regs[3] << 24 | regs[2] << 16 | regs[1] << 8 | regs[0])
+
+
+def row(text, encoded):
+    return (text, encoded)
+
+
+def alloc(count, movk=False):
+    if movk:
+        return [row(f's_movk_i32 m0, 0x{count:x}', sopk('s_movk_i32', 'm0', count))]
+    return [row(f's_mov_b32 m0, 0x{count:x}', sop1('s_mov_b32', 'm0', count))]
+
+
+def send(imm=9):
+    return [row(f's_sendmsg 0x{imm:x}', sopp('s_sendmsg', imm))]
+
+
+def lane(high=True):
+    rows = [row('v_mbcnt_lo_u32_b32 v1, -1, 0', vop3('v_mbcnt_lo_u32_b32', 'v1', -1, 0))]
+    if high:
+        rows.append(row('v_mbcnt_hi_u32_b32 v1, -1, v1', vop3('v_mbcnt_hi_u32_b32', 'v1', -1, 'v1')))
+    return rows
+
+
+def wait():
+    return [row('s_waitcnt lgkmcnt(0)', [WAIT])]
+
+
+def barrier():
+    return [row('s_barrier 0x0', sopp('s_barrier'))]
+
+
+def payload(reg='v3', value='1.0'):
+    return [row(f'v_mov_b32_e32 {reg}, {value}', vop1('v_mov_b32', reg, value if isinstance(value, str) else value))]
+
+
+def const_mov(reg, value):
+    return [row(f'v_mov_b32_e32 {reg}, 0x{value:x}', vop1('v_mov_b32', reg, value))]
+
+
+def position(reg='v4'):
+    return [row(f'exp pos0 {reg}, {reg}, {reg}, {reg}', exp(12, [reg, reg, reg, reg]))]
+
+
+def primitive(reg='v5', done=True):
+    return [row(f"exp target_20 {reg}, off, off, off{' done' if done else ''}",
+                exp(20, [reg, 'off', 'off', 'off'], done=done))]
+
+
+def end():
+    return [row('s_endpgm', sopp('s_endpgm'))]
+
+
+def local_write(addr='v2', data='v3', offset=0, gds=False, op='ds_write_b32'):
+    text = f'{op} {addr}, {data}'
+    if offset:
+        text += f' offset:{offset}'
+    if gds:
+        text += ' gds'
+    return [row(text, ds(op, addr, data=data, offset=offset, gds=gds))]
+
+
+def local_read(dst='v4', addr='v2', offset=0):
+    text = f'ds_read_b32 {dst}, {addr}'
+    if offset:
+        text += f' offset:{offset}'
+    return [row(text, ds('ds_read_b32', addr, dst=dst, offset=offset))]
+
+
+def round_trip(address, reads=None, writes=None, wait_count=True, with_barrier=True):
+    """address rows, then writes, optional wait and barrier, then reads."""
+    body = list(address)
+    body += writes if writes is not None else local_write()
+    if wait_count:
+        body += wait()
+    if with_barrier:
+        body += barrier()
+    body += reads if reads is not None else local_read()
+    return body
+
+
+def zero_pair_shift(first=6):
+    """v_lshrrev_b64 of inline zero. Both halves of the destination become zero."""
+    return [row(f'v_lshrrev_b64 v[{first}:{first + 1}], 0, 0', [0xd7000000 | first, 0x00010080])]
+
+
+def pass_through(count=0x1040, high=True, movk=False, address=None, after_write=(), read_offset=0,
+                 with_barrier=True, with_send=True, send_imm=9, prim_reg='v5', prim_value=IDENTITY,
+                 with_prim=True, with_pos=True, pos_reg='v4', before_export=()):
+    body = alloc(count, movk=movk)
+    if with_send:
+        body += send(send_imm)
+    body += lane(high)
+    body += address if address is not None else [
+        row('v_mov_b32_e32 v6, v1', vop1('v_mov_b32', 'v6', 'v1')),
+        row('v_lshlrev_b32_e32 v2, 2, v6', vop2('v_lshlrev_b32', 'v2', 2, 'v6')),
+    ]
+    body += payload()
+    body += local_write()
+    body += after_write
+    body += wait()
+    if with_barrier:
+        body += barrier()
+    body += local_read(offset=read_offset)
+    if prim_value is not None:
+        body += const_mov(prim_reg, prim_value)
+    body += before_export
+    if with_pos:
+        body += position(pos_reg)
+    if with_prim:
+        body += primitive(prim_reg)
+    body += end()
+    return body
+
+
+CASES = [
+    dict(name='identity', rows=pass_through(), ok=True, stores=4, has=('1065353216',),
+         lacks=('addrspace(3)', 'dx.op.barrier', 'waveGetLaneIndex')),
+    dict(name='wave32-mad', wave32=True, ok=True, stores=4, has=('1065353216',),
+         lacks=('addrspace(3)', 'dx.op.barrier'),
+         rows=pass_through(count=0x1020, high=False, movk=True, address=[
+             row('v_mad_u32_u24 v2, v1, 4, 0', vop3('v_mad_u32_u24', 'v2', 'v1', 4, 0))])),
+    dict(name='mul-add-snapshot', ok=True, stores=4, has=('1065353216',),
+         lacks=('addrspace(3)', 'dx.op.barrier', 'bitcast i32 0 to float'),
+         rows=pass_through(address=[
+             row('v_mul_u32_u24_e32 v2, 4, v1', vop2('v_mul_u32_u24', 'v2', 4, 'v1')),
+             row('v_add_nc_u32_e32 v2, 64, v2', vop2('v_add_nc_u32', 'v2', 64, 'v2')),
+         ], after_write=payload('v3', 0))),
+    dict(name='plain-vertex', plain=True, ok=True, stores=4, lacks=('addrspace(3)', 'dx.op.barrier')),
+    dict(name='cross-lane-read', rows=pass_through(read_offset=4), reason=ADDR),
+    dict(name='prim-exports-vertex-id', rows=pass_through(prim_reg='v0', prim_value=None), reason=PRIM),
+    dict(name='reversed-prim', rows=pass_through(prim_value=0x402), reason=PRIM),
+    # 0x00200400 is written to v7, then v_lshrrev_b64 v[6:7], 0, 0 clears both halves.
+    dict(name='prim-cleared-by-pair-shift', reason=PRIM,
+         rows=pass_through(prim_reg='v7', before_export=zero_pair_shift())),
+    dict(name='second-prim', reason=PRIM, rows=pass_through()[:-1] + primitive() + end()),
+    dict(name='unproven-count-word', rows=pass_through(count=0x1003), reason=COUNTS),
+    dict(name='count-from-register', reason=COUNTS, rows=[
+        row('s_mov_b32 m0, s0', sop1('s_mov_b32', 'm0', 's0'))] + pass_through()[1:]),
+    dict(name='sendmsg-before-count', reason=COUNTS, rows=send() + pass_through()),
+    dict(name='missing-sendmsg', rows=pass_through(with_send=False), reason=COUNTS),
+    dict(name='m0-without-pattern', reason=COUNTS, rows=alloc(0x1040) + position('v0') + end()),
+    dict(name='not-gs-alloc', rows=pass_through(send_imm=0x109), reason=MESSAGE),
+    dict(name='missing-barrier', rows=pass_through(with_barrier=False), reason=BARRIER),
+    dict(name='barrier-before-writes', reason=BARRIER, rows=alloc(0x1040) + send() + barrier() + lane() + end()),
+    dict(name='write-after-read', reason=BARRIER,
+         rows=pass_through()[:-1] + local_write() + end()),
+    dict(name='half-lane-id', rows=pass_through(high=False), reason=ADDR),
+    dict(name='unaligned-slot', reason=ADDR, rows=pass_through(address=[
+        row('v_lshlrev_b32_e32 v2, 1, v1', vop2('v_lshlrev_b32', 'v2', 1, 'v1'))])),
+    dict(name='gds-write', reason=ADDR, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + payload() + local_write(gds=True) + end()),
+    dict(name='other-ds-op', reason=ADDR, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + payload() + local_write(op='ds_add_u32') + end()),
+    dict(name='unread-private-slot', reason=OWN, rows=pass_through(read_offset=4, address=[
+        row('v_lshlrev_b32_e32 v2, 3, v1', vop2('v_lshlrev_b32', 'v2', 3, 'v1'))])),
+    dict(name='second-slot-unread', reason=OWN, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1')),
+        row('v_add_nc_u32_e32 v7, 0x100, v2', vop2('v_add_nc_u32', 'v7', 256, 'v2')),
+    ] + payload() + local_write('v2') + local_write('v7') + wait() + barrier() + local_read() +
+        const_mov('v5', IDENTITY) + position() + primitive() + end()),
+    dict(name='read-without-write', reason=OWN, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + local_read() + end()),
+    dict(name='lane-address-exported', reason=USE, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + position('v2') + end()),
+    dict(name='lane-address-stored', reason=USE, rows=alloc(0x1040) + send() + lane() + [
+        row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + local_write(data='v2') + end()),
+    dict(name='wave32-mbcnt-hi', wave32=True, reason=ADDR, rows=pass_through(count=0x1020, high=True)),
+    dict(name='wave32-wide-count', wave32=True, reason=COUNTS, rows=pass_through(count=0x1040, high=False)),
+    dict(name='missing-position', rows=pass_through(with_pos=False), reason=TERMINAL),
+    dict(name='scalar-sleep', reason=GENERIC, rows=[row('s_sleep 0', sopp('s_sleep'))] + end()),
+    # The branch itself is a block terminator, so the walk never treats it as a
+    # wave instruction. The shader still has no position export and must refuse.
+    dict(name='scalar-branch', reason=TERMINAL, rows=[row('s_branch label_0x4', sopp('s_branch'))] + end()),
+    dict(name='pixel-local', pixel=True, reason=GENERIC, rows=local_write()),
+    dict(name='pixel-sendmsg', pixel=True, reason=GENERIC, rows=send()),
+    dict(name='pixel-mbcnt', pixel=True, reason=GENERIC, rows=lane(False)),
+    dict(name='pixel-barrier', pixel=True, reason=GENERIC, rows=barrier()),
+]
+
+
+def flatten(rows):
+    out = []
+    for _, encoded in rows:
+        out.extend(encoded)
+    return out
+
+
+def check_decode(rows):
+    blob = struct.pack(f'<{len(flatten(rows))}I', *flatten(rows))
+    offset = 0
+    for text, encoded in rows:
+        size, _name, asm, _comment = D.decode_instruction(blob, offset)
+        if size != 4 * len(encoded) or asm != text:
+            raise SystemExit(f'decoded {asm!r}, expected {text!r} at +0x{offset:x}')
+        offset += size
+    if offset != len(blob):
+        raise SystemExit(f'decode stopped at {offset} of {len(blob)}')
+
+
+def container(case):
+    if case.get('plain'):
+        return vertex()
+    rows = case['rows']
+    check_decode(rows)
+    if case.get('pixel'):
+        # `where` is the word index of the placeholder export, after the prefix.
+        words = flatten(rows)
+        return patched_pixel(len(words), words)
+    return vertex(program=flatten(rows), wave32=case.get('wave32', False))
+
+
+D3D12_H = r'''#pragma once
+#include <cstdint>
+#include <cstddef>
+using HRESULT = long;
+using UINT = unsigned int;
+#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0)
+#define FAILED(hr) ((HRESULT)(hr) < 0)
+#define E_INVALIDARG ((HRESULT)0x80070057L)
+#define IID_PPV_ARGS(pp) static_cast<const void*>(nullptr), reinterpret_cast<void**>(pp)
+enum D3D_NAME {
+    D3D_NAME_POSITION = 1, D3D_NAME_CLIP_DISTANCE = 2, D3D_NAME_CULL_DISTANCE = 3,
+    D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, D3D_NAME_VIEWPORT_ARRAY_INDEX = 5,
+    D3D_NAME_IS_FRONT_FACE = 9, D3D_NAME_TARGET = 64, D3D_NAME_DEPTH = 65,
+    D3D_NAME_COVERAGE = 66, D3D_NAME_DEPTH_GREATER_EQUAL = 67,
+    D3D_NAME_DEPTH_LESS_EQUAL = 68, D3D_NAME_STENCIL_REF = 69
+};
+enum D3D_ROOT_SIGNATURE_VERSION { D3D_ROOT_SIGNATURE_VERSION_1_1 = 2 };
+enum D3D12_ROOT_PARAMETER_TYPE {
+    D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0,
+    D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 1,
+    D3D12_ROOT_PARAMETER_TYPE_CBV = 2,
+    D3D12_ROOT_PARAMETER_TYPE_SRV = 3,
+    D3D12_ROOT_PARAMETER_TYPE_UAV = 4
+};
+enum D3D12_SHADER_VISIBILITY {
+    D3D12_SHADER_VISIBILITY_ALL = 0, D3D12_SHADER_VISIBILITY_VERTEX = 1,
+    D3D12_SHADER_VISIBILITY_PIXEL = 5, D3D12_SHADER_VISIBILITY_MESH = 7
+};
+enum D3D12_DESCRIPTOR_RANGE_TYPE {
+    D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0, D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1,
+    D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2
+};
+enum D3D12_ROOT_SIGNATURE_FLAGS {
+    D3D12_ROOT_SIGNATURE_FLAG_NONE = 0,
+    D3D12_ROOT_SIGNATURE_FLAG_DENY_MESH_SHADER_ROOT_ACCESS = 0x200,
+    D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED = 0x400,
+    D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED = 0x800
+};
+#define D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND 0xffffffffu
+#define D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 1000000u

Added D3D12_VS_OUTPUT_REGISTER_COUNT = 32 to the fixture header as suggested (5b4d2773, on top of current main d2e6a4ed).

Linux: the checker passes with GCC 13, GCC 11 and clang 18 plus llvm-mc 15 (35 fixtures matched, 36 translated).

Windows test PC (MSVC Debug): native_direct_container passes. native_ngg_vs_passthrough is reported as skipped there because the machine has no g++ or clang++, so the compiler results above are Linux only.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4784067876 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3711#discussion_r4784067876). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-12-03T11:35:04Z. **Code review location:** `tests/native_ngg_vs_passthrough_check.py`; line 362 ~~~~diff @@ -0,0 +1,546 @@ +"""Native gfx1013 pass-through NGG vertex shaders. + + (no arguments) translate one accepted shape and the refusal contrasts + with host g++ and clang++ (-Werror=narrowing) + binary <llvm-mc> also reassemble every fixture with llvm-mc (gfx1013) and + compare the words + +Accepted: a straight-line vertex shader whose local slots are private to each +lane, whose one GS_ALLOC_REQ matches the wave, and whose one primitive export +is the identity triangle. The local round trip becomes the captured register, +and the allocation, barrier and identity export are omitted. + +Refused with a specific reason: a cross-lane local read, a non-identity +primitive export, a later write that replaces that identity word (including +the upper half of a 64-bit pair), an allocation whose counts are not the +wave's, a barrier that is not between the writes and the reads, and every +other unproved use. +Pixel shaders and unrelated wave instructions keep the generic refusal. +Exit 77 when g++ or clang++ is not on PATH. Nothing here is a hardware result. +""" +import re +import shutil +import struct +import subprocess +import sys +import tempfile +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools')) +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import disasm_rdna2 as D # noqa: E402 +from native_direct_container_check import patched_pixel, vertex # noqa: E402 + +ROOT = Path(__file__).resolve().parents[1] +ADDR = 'ngg lds address not lane-private' +USE = 'ngg lane address used outside an LDS access' +OWN = "ngg lds read is not the lane's own slot" +BARRIER = 'ngg barrier outside the lane-private round trip' +MESSAGE = 'ngg sendmsg is not GS_ALLOC_REQ' +COUNTS = 'ngg sendmsg counts not proven' +PRIM = 'ngg prim export not identity' +GENERIC = 'graphics wave or control-flow instruction' +TERMINAL = 'incomplete or inconsistent terminal graphics exports' +IDENTITY = 0x00200400 +WAIT = 0xbf8cc07f # s_waitcnt lgkmcnt(0); the other counters stay at their no-wait maximum + + +def opcode(table, name): + for op, info in table.items(): + if info[0] == name or info[0] == name + '_e32': + return op + raise KeyError(name) + + +def ssrc(value): + if isinstance(value, str): + if value.startswith('v'): + return 256 + int(value[1:]), None + return {'exec': 126, 'm0': 124, 'vcc': 106, '1.0': 242, '4.0': 246}.get(value) or int(value[1:]), None + if 0 <= value <= 64: + return 128 + value, None + if -16 <= value < 0: + return 192 - value, None + return 255, value & 0xffffffff + + +def words(*values, lit=None): + return [w for w in values if w is not None] + ([] if lit is None else [lit]) + + +def sop1(name, dst, src): + source, lit = ssrc(src) + return words(0xbe800000 | ssrc(dst)[0] << 16 | opcode(D.SOP1_OPS, name) << 8 | source, lit=lit) + + +def sopk(name, dst, simm): + return words(0xb0000000 | opcode(D.SOPK_OPS, name) << 23 | ssrc(dst)[0] << 16 | (simm & 0xffff)) + + +def sopp(name, imm=0): + return words(0xbf800000 | opcode(D.SOPP_OPS, name) << 16 | (imm & 0xffff)) + + +def vop1(name, dst, src): + source, lit = ssrc(src) + return words(0x7e000000 | int(dst[1:]) << 17 | opcode(D.VOP1_OPS, name) << 9 | source, lit=lit) + + +def vop2(name, dst, src0, src1): + source, lit = ssrc(src0) + return words(opcode(D.VOP2_OPS, name) << 25 | int(dst[1:]) << 17 | int(src1[1:]) << 9 | source, lit=lit) + + +def vop3(name, dst, *src): + op = opcode(D.VOP3_NATIVE_OPS, name) + codes = [ssrc(item)[0] for item in src] + [0] * (3 - len(src)) + return words(0xd4000000 | op << 16 | int(dst[1:]), codes[2] << 18 | codes[1] << 9 | codes[0]) + + +def ds(name, addr, data=None, dst=None, offset=0, gds=False): + op = opcode(D.DS_OPS, name) + word = 0xd8000000 | op << 18 | offset + if gds: + word |= 1 << 17 + return words(word, (int(dst[1:]) if dst else 0) << 24 | (int(data[1:]) if data else 0) << 8 | int(addr[1:])) + + +def exp(target, srcs, done=False): + enable = sum(1 << i for i, src in enumerate(srcs) if src != 'off') + regs = [0 if src == 'off' else int(src[1:]) for src in srcs] + return words(0xf8000000 | (done << 11) | target << 4 | enable, regs[3] << 24 | regs[2] << 16 | regs[1] << 8 | regs[0]) + + +def row(text, encoded): + return (text, encoded) + + +def alloc(count, movk=False): + if movk: + return [row(f's_movk_i32 m0, 0x{count:x}', sopk('s_movk_i32', 'm0', count))] + return [row(f's_mov_b32 m0, 0x{count:x}', sop1('s_mov_b32', 'm0', count))] + + +def send(imm=9): + return [row(f's_sendmsg 0x{imm:x}', sopp('s_sendmsg', imm))] + + +def lane(high=True): + rows = [row('v_mbcnt_lo_u32_b32 v1, -1, 0', vop3('v_mbcnt_lo_u32_b32', 'v1', -1, 0))] + if high: + rows.append(row('v_mbcnt_hi_u32_b32 v1, -1, v1', vop3('v_mbcnt_hi_u32_b32', 'v1', -1, 'v1'))) + return rows + + +def wait(): + return [row('s_waitcnt lgkmcnt(0)', [WAIT])] + + +def barrier(): + return [row('s_barrier 0x0', sopp('s_barrier'))] + + +def payload(reg='v3', value='1.0'): + return [row(f'v_mov_b32_e32 {reg}, {value}', vop1('v_mov_b32', reg, value if isinstance(value, str) else value))] + + +def const_mov(reg, value): + return [row(f'v_mov_b32_e32 {reg}, 0x{value:x}', vop1('v_mov_b32', reg, value))] + + +def position(reg='v4'): + return [row(f'exp pos0 {reg}, {reg}, {reg}, {reg}', exp(12, [reg, reg, reg, reg]))] + + +def primitive(reg='v5', done=True): + return [row(f"exp target_20 {reg}, off, off, off{' done' if done else ''}", + exp(20, [reg, 'off', 'off', 'off'], done=done))] + + +def end(): + return [row('s_endpgm', sopp('s_endpgm'))] + + +def local_write(addr='v2', data='v3', offset=0, gds=False, op='ds_write_b32'): + text = f'{op} {addr}, {data}' + if offset: + text += f' offset:{offset}' + if gds: + text += ' gds' + return [row(text, ds(op, addr, data=data, offset=offset, gds=gds))] + + +def local_read(dst='v4', addr='v2', offset=0): + text = f'ds_read_b32 {dst}, {addr}' + if offset: + text += f' offset:{offset}' + return [row(text, ds('ds_read_b32', addr, dst=dst, offset=offset))] + + +def round_trip(address, reads=None, writes=None, wait_count=True, with_barrier=True): + """address rows, then writes, optional wait and barrier, then reads.""" + body = list(address) + body += writes if writes is not None else local_write() + if wait_count: + body += wait() + if with_barrier: + body += barrier() + body += reads if reads is not None else local_read() + return body + + +def zero_pair_shift(first=6): + """v_lshrrev_b64 of inline zero. Both halves of the destination become zero.""" + return [row(f'v_lshrrev_b64 v[{first}:{first + 1}], 0, 0', [0xd7000000 | first, 0x00010080])] + + +def pass_through(count=0x1040, high=True, movk=False, address=None, after_write=(), read_offset=0, + with_barrier=True, with_send=True, send_imm=9, prim_reg='v5', prim_value=IDENTITY, + with_prim=True, with_pos=True, pos_reg='v4', before_export=()): + body = alloc(count, movk=movk) + if with_send: + body += send(send_imm) + body += lane(high) + body += address if address is not None else [ + row('v_mov_b32_e32 v6, v1', vop1('v_mov_b32', 'v6', 'v1')), + row('v_lshlrev_b32_e32 v2, 2, v6', vop2('v_lshlrev_b32', 'v2', 2, 'v6')), + ] + body += payload() + body += local_write() + body += after_write + body += wait() + if with_barrier: + body += barrier() + body += local_read(offset=read_offset) + if prim_value is not None: + body += const_mov(prim_reg, prim_value) + body += before_export + if with_pos: + body += position(pos_reg) + if with_prim: + body += primitive(prim_reg) + body += end() + return body + + +CASES = [ + dict(name='identity', rows=pass_through(), ok=True, stores=4, has=('1065353216',), + lacks=('addrspace(3)', 'dx.op.barrier', 'waveGetLaneIndex')), + dict(name='wave32-mad', wave32=True, ok=True, stores=4, has=('1065353216',), + lacks=('addrspace(3)', 'dx.op.barrier'), + rows=pass_through(count=0x1020, high=False, movk=True, address=[ + row('v_mad_u32_u24 v2, v1, 4, 0', vop3('v_mad_u32_u24', 'v2', 'v1', 4, 0))])), + dict(name='mul-add-snapshot', ok=True, stores=4, has=('1065353216',), + lacks=('addrspace(3)', 'dx.op.barrier', 'bitcast i32 0 to float'), + rows=pass_through(address=[ + row('v_mul_u32_u24_e32 v2, 4, v1', vop2('v_mul_u32_u24', 'v2', 4, 'v1')), + row('v_add_nc_u32_e32 v2, 64, v2', vop2('v_add_nc_u32', 'v2', 64, 'v2')), + ], after_write=payload('v3', 0))), + dict(name='plain-vertex', plain=True, ok=True, stores=4, lacks=('addrspace(3)', 'dx.op.barrier')), + dict(name='cross-lane-read', rows=pass_through(read_offset=4), reason=ADDR), + dict(name='prim-exports-vertex-id', rows=pass_through(prim_reg='v0', prim_value=None), reason=PRIM), + dict(name='reversed-prim', rows=pass_through(prim_value=0x402), reason=PRIM), + # 0x00200400 is written to v7, then v_lshrrev_b64 v[6:7], 0, 0 clears both halves. + dict(name='prim-cleared-by-pair-shift', reason=PRIM, + rows=pass_through(prim_reg='v7', before_export=zero_pair_shift())), + dict(name='second-prim', reason=PRIM, rows=pass_through()[:-1] + primitive() + end()), + dict(name='unproven-count-word', rows=pass_through(count=0x1003), reason=COUNTS), + dict(name='count-from-register', reason=COUNTS, rows=[ + row('s_mov_b32 m0, s0', sop1('s_mov_b32', 'm0', 's0'))] + pass_through()[1:]), + dict(name='sendmsg-before-count', reason=COUNTS, rows=send() + pass_through()), + dict(name='missing-sendmsg', rows=pass_through(with_send=False), reason=COUNTS), + dict(name='m0-without-pattern', reason=COUNTS, rows=alloc(0x1040) + position('v0') + end()), + dict(name='not-gs-alloc', rows=pass_through(send_imm=0x109), reason=MESSAGE), + dict(name='missing-barrier', rows=pass_through(with_barrier=False), reason=BARRIER), + dict(name='barrier-before-writes', reason=BARRIER, rows=alloc(0x1040) + send() + barrier() + lane() + end()), + dict(name='write-after-read', reason=BARRIER, + rows=pass_through()[:-1] + local_write() + end()), + dict(name='half-lane-id', rows=pass_through(high=False), reason=ADDR), + dict(name='unaligned-slot', reason=ADDR, rows=pass_through(address=[ + row('v_lshlrev_b32_e32 v2, 1, v1', vop2('v_lshlrev_b32', 'v2', 1, 'v1'))])), + dict(name='gds-write', reason=ADDR, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + payload() + local_write(gds=True) + end()), + dict(name='other-ds-op', reason=ADDR, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + payload() + local_write(op='ds_add_u32') + end()), + dict(name='unread-private-slot', reason=OWN, rows=pass_through(read_offset=4, address=[ + row('v_lshlrev_b32_e32 v2, 3, v1', vop2('v_lshlrev_b32', 'v2', 3, 'v1'))])), + dict(name='second-slot-unread', reason=OWN, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1')), + row('v_add_nc_u32_e32 v7, 0x100, v2', vop2('v_add_nc_u32', 'v7', 256, 'v2')), + ] + payload() + local_write('v2') + local_write('v7') + wait() + barrier() + local_read() + + const_mov('v5', IDENTITY) + position() + primitive() + end()), + dict(name='read-without-write', reason=OWN, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + local_read() + end()), + dict(name='lane-address-exported', reason=USE, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + position('v2') + end()), + dict(name='lane-address-stored', reason=USE, rows=alloc(0x1040) + send() + lane() + [ + row('v_lshlrev_b32_e32 v2, 2, v1', vop2('v_lshlrev_b32', 'v2', 2, 'v1'))] + local_write(data='v2') + end()), + dict(name='wave32-mbcnt-hi', wave32=True, reason=ADDR, rows=pass_through(count=0x1020, high=True)), + dict(name='wave32-wide-count', wave32=True, reason=COUNTS, rows=pass_through(count=0x1040, high=False)), + dict(name='missing-position', rows=pass_through(with_pos=False), reason=TERMINAL), + dict(name='scalar-sleep', reason=GENERIC, rows=[row('s_sleep 0', sopp('s_sleep'))] + end()), + # The branch itself is a block terminator, so the walk never treats it as a + # wave instruction. The shader still has no position export and must refuse. + dict(name='scalar-branch', reason=TERMINAL, rows=[row('s_branch label_0x4', sopp('s_branch'))] + end()), + dict(name='pixel-local', pixel=True, reason=GENERIC, rows=local_write()), + dict(name='pixel-sendmsg', pixel=True, reason=GENERIC, rows=send()), + dict(name='pixel-mbcnt', pixel=True, reason=GENERIC, rows=lane(False)), + dict(name='pixel-barrier', pixel=True, reason=GENERIC, rows=barrier()), +] + + +def flatten(rows): + out = [] + for _, encoded in rows: + out.extend(encoded) + return out + + +def check_decode(rows): + blob = struct.pack(f'<{len(flatten(rows))}I', *flatten(rows)) + offset = 0 + for text, encoded in rows: + size, _name, asm, _comment = D.decode_instruction(blob, offset) + if size != 4 * len(encoded) or asm != text: + raise SystemExit(f'decoded {asm!r}, expected {text!r} at +0x{offset:x}') + offset += size + if offset != len(blob): + raise SystemExit(f'decode stopped at {offset} of {len(blob)}') + + +def container(case): + if case.get('plain'): + return vertex() + rows = case['rows'] + check_decode(rows) + if case.get('pixel'): + # `where` is the word index of the placeholder export, after the prefix. + words = flatten(rows) + return patched_pixel(len(words), words) + return vertex(program=flatten(rows), wave32=case.get('wave32', False)) + + +D3D12_H = r'''#pragma once +#include <cstdint> +#include <cstddef> +using HRESULT = long; +using UINT = unsigned int; +#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) +#define FAILED(hr) ((HRESULT)(hr) < 0) +#define E_INVALIDARG ((HRESULT)0x80070057L) +#define IID_PPV_ARGS(pp) static_cast<const void*>(nullptr), reinterpret_cast<void**>(pp) +enum D3D_NAME { + D3D_NAME_POSITION = 1, D3D_NAME_CLIP_DISTANCE = 2, D3D_NAME_CULL_DISTANCE = 3, + D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, D3D_NAME_VIEWPORT_ARRAY_INDEX = 5, + D3D_NAME_IS_FRONT_FACE = 9, D3D_NAME_TARGET = 64, D3D_NAME_DEPTH = 65, + D3D_NAME_COVERAGE = 66, D3D_NAME_DEPTH_GREATER_EQUAL = 67, + D3D_NAME_DEPTH_LESS_EQUAL = 68, D3D_NAME_STENCIL_REF = 69 +}; +enum D3D_ROOT_SIGNATURE_VERSION { D3D_ROOT_SIGNATURE_VERSION_1_1 = 2 }; +enum D3D12_ROOT_PARAMETER_TYPE { + D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0, + D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 1, + D3D12_ROOT_PARAMETER_TYPE_CBV = 2, + D3D12_ROOT_PARAMETER_TYPE_SRV = 3, + D3D12_ROOT_PARAMETER_TYPE_UAV = 4 +}; +enum D3D12_SHADER_VISIBILITY { + D3D12_SHADER_VISIBILITY_ALL = 0, D3D12_SHADER_VISIBILITY_VERTEX = 1, + D3D12_SHADER_VISIBILITY_PIXEL = 5, D3D12_SHADER_VISIBILITY_MESH = 7 +}; +enum D3D12_DESCRIPTOR_RANGE_TYPE { + D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0, D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1, + D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2 +}; +enum D3D12_ROOT_SIGNATURE_FLAGS { + D3D12_ROOT_SIGNATURE_FLAG_NONE = 0, + D3D12_ROOT_SIGNATURE_FLAG_DENY_MESH_SHADER_ROOT_ACCESS = 0x200, + D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED = 0x400, + D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED = 0x800 +}; +#define D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND 0xffffffffu +#define D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 1000000u ~~~~ --- Added `D3D12_VS_OUTPUT_REGISTER_COUNT = 32` to the fixture header as suggested (5b4d2773, on top of current `main` d2e6a4ed). Linux: the checker passes with GCC 13, GCC 11 and clang 18 plus llvm-mc 15 (35 fixtures matched, 36 translated). Windows test PC (MSVC Debug): `native_direct_container` passes. `native_ngg_vs_passthrough` is reported as skipped there because the machine has no g++ or clang++, so the compiler results above are Linux only. AI-Assisted
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3711:upstream-pr/3711'
git switch 'upstream-pr/3711'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3711'
git switch 'upstream-pr/3711'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3711'
git switch 'upstream-pr/3711'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3711'
git switch 'main'
git merge --squash 'upstream-pr/3711'
git switch 'main'
git merge --ff-only 'upstream-pr/3711'
git switch 'main'
git merge 'upstream-pr/3711'
git push origin 'main'
Sign in to join this conversation.
No reviewers
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!3711
No description provided.