Skip to content

runtime: bind native shader requests and submit fixed mesh pipelines - #3094

Merged
R0Y00 merged 12 commits into
mainfrom
codex/native-graphics-integration
Nov 28, 2026
Merged

R0Y00 merged 12 commits into
mainfrom
codex/native-graphics-integration

Conversation

@R0Y00

@R0Y00 R0Y00 commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

#3091 and #3358 have landed on main. This PR now targets main and retains the first-use graphics disk-cache checks from #2981.

The stand-in prepares supported VS/PS pairs at first use, binds fixed vertex inputs and reviewed slot-57 mesh pipelines, and consumes frozen slot-67 requests and prepared frontend packs. A temporary graphics translation is published only after its manifest and root signature succeed. Fault cases check that the first draw stays clear and a later draw in the same process loads the disk pipeline with all three published files intact. Slot-57 cases check selected and refused views, root constants, sampler waterfalls, attachments and source-built GPU readbacks. A fixed IA fixture uses a color centered in an RGBA8 quantization bin to check exact pixels across adapters.

Windows 11 build 26200, MSVC 19.51, Windows SDK 10.0.26100.0. WARP driver 10.0.26100.9818 and NVIDIA GeForce RTX 4060 Laptop GPU driver 32.0.16.1656. The native draw fixture requested and reported the D3D12 debug layer.

At 10b45ff, Debug ran 49 tests (48 passed, 0 failed, 1 capability skip) and Release /O2 ran 14 (13 passed, 0 failed, 1 capability skip). In both configurations WARP declined the wave32 compute dispatch. Hardware passed that case. Debug also covered the main branch's signed 64-bit scalar shifts, indexed buffer alias states and compute root SRVs.

A fixed mesh fixture creates an exclusive archive directory per run. This prevents a reused Windows process ID from introducing earlier state archives into the check. Argument probes take hexadecimal pipeline keys through X2W_ARGUMENT_INPUT_KEY, X2W_ARGUMENT_OUTPUT_KEY and X2W_ARGUMENT_INDIRECT_KEY, together with X2W_SCENE_ARGUMENT_PROBE=1 and X2W_DRAW_DUMP_FRAME. The compute probes inspect the fixture's source at root table 1 byte 64 plus buffer byte 36 and its output at table byte 32.

cmake --build --preset dev --target compile_dxil d3d12_xs_shim startup_stream_consumer native_compute_pack_check native_frozen_request_check startup_indirect_draw_indexed offscreen_check native_store_replay native_sampled_pixel_gpu native_pixel_ir_dump
ctest --preset dev --no-tests=error --output-on-failure -R '^(native_(fixed_mesh57.*|compute_pack.*|graphics_wqm.*|scalar_lds_hardware|mtbuf_hardware|sampler_heap.*|indexed_pixel_texture.*|frozen_request|startup_request_cache_.*|ldexp.*|salu_shift64.*)|startup_(native_graphics_draw|compute_dispatch_native|compute_root_srv_dispatch|indirect_translated_indexed_alias(_off)?)_(warp|hardware))$'
cmake --build --preset release --target compile_dxil d3d12_xs_shim startup_stream_consumer startup_indirect_draw_indexed
ctest --preset release --no-tests=error --output-on-failure -R '^(native_fixed_mesh57.*_warp|startup_native_graphics_draw_(warp|hardware)|startup_compute_dispatch_native_(warp|hardware))$'

Current main verification

Tested 0cdcfd004c1a85efc4827b41f121f23934ef7ee5 against d3d0c7f6 in Release /O2. Windows 11 26200.9974, MSVC 19.51, SDK 10.0.26100, app debug layer on for the graphics fixtures, in-box WARP 10.0.26100.9818 and RTX 4060 Laptop driver 616.56.

cmake --build --preset release --target compile_dxil native_compute_pack_check startup_list_resubmit startup_indirect_draw_indexed startup_stream_consumer startup_indirect_dispatch native_store_replay
ctest --preset release --no-tests=error -j 1 --output-on-failure -R '^(startup_list_resubmit(_nodebug)?(_untracked)?_(warp|hardware)|native_fixed_mesh57.*|startup_native_graphics_draw_(warp|hardware)|native_compute_pack(_hardware)?|startup_indirect_dispatch_(warp|hardware))$'

34 passed, 0 failed, 0 skipped. These source-built checks cover fixed Mesh57, disk-cache and first-use failure recovery, allocator retirement on two queues, and indirect compute. The original executable's scene-color checkpoint stays tracked in #870.

At cb81bd81d0d309b783ec86ac22b03e4491a9cfb6 the runtime sources are identical to the 34-test build. The missing-DXC control now checks the exact shader key. The focused Release startup_native_graphics_draw_(warp|hardware) pair passed again, 2 passed with 0 skips.

R0Y00 commented Nov 27, 2026

Copy link
Copy Markdown
Owner Author

Reviewing the runtime layer separately at 10b45ff5. Keep this base on the compiler branch until #3091 lands, then retarget to main and recheck the diff and CI. For #2981, please keep its original commits and attribution in the integration and keep the existing review record linked. The existing #2981 findings are still relevant here: I see the transactional manifest/root fallback and its controls, but the native candidate becomes ready before pipeline_for creates the first PSO. I reproduced the later failure on the #2981 integration on both WARP and RTX: a native-only PSO E_FAIL left 32 clear pixels even though the same valid disk entry drew 16 red / 16 clear. Please cover this third path in the runtime review and retain the working disk translation for the same target key. The exact #3094 runtime diff still needs its own GPU verdict.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified the runtime head 10b45ff5 itself (tree c0b93e371aa0a4503a575a84fabc6a77d83966f0), stacked on #3091 a48d39dc. Building startup_stream_consumer d3d12_xs_shim compile_dxil startup_manifest_retry_check and running ctest --test-dir <build> --no-tests=error -j 1 -V -R '^(startup_(native_graphics_draw|compute_dispatch_native)_(warp|hardware)|startup_manifest_retry)$' gave four Debug passes and one WARP Compute wave32 skip. Both WARP and RTX returned 16 red / 16 clear pixels with cold and hot cache, and both existing late manifest and root controls recovered after publication.

I then forced E_FAIL only at the native candidate's CreateGraphicsPipelineState call. On both adapters, the exact runtime head reproduced the missing fallback: all 32 pixels stayed clear although the same published disk pair drew 16 red / 16 clear with native disabled. The three cache files stayed byte-identical. The test used Windows 11 26200.9974, Microsoft Basic Render Driver 10.0.26100.9818 and RTX 4060 Laptop driver 32.0.16.1656, with the D3D12 debug layer enabled. Please carry that case through the runtime fix and merge review.

shader: preserve helper-lane inputs and texture dimensions on native pipelines
@lambirou

Copy link
Copy Markdown
Contributor

Independent Windows receipt for the stacked #3091 + #3094 runtime at b80513fd (codex/native-graphics-integration, which includes codex/native-shader-modules a48d39dc).

Built the eight stand-in DLLs in Release in a clean worktree and ran the title for 300 s through the diagnostic launcher. Windows build 10.0.26300.10075, AMD Radeon RX 9060 XT (driver 32.0.32029.2010), D3D12 debug layer not enabled. No game files or dumps are included.

Result: clean timeout at 300.03 s (exit 0, no crash, no OOM). 5998 frames presented in 281.9 s (21.3 fps overall). translated draws 17636 (not drawn 47597), pipelines translated 3 / missing 8, draws 0, indirect: forwarded 0 with no dispatchmesh category, compute translated 0, refused 163, no translation 3460, 2689 compute requests published (already present 0), commit peak 11888 MiB. Final capture: a black frame with the desktop overlay.

Two caveats keep this from being a clean regression comparison: the branch's x2w-startup-shader-29 seed republished the whole request cache in this run, and the run shared the machine with two parallel builds, so 21.3 fps is not comparable to the 26/11 warm-cache 26.1 fps.

What the counters do establish: within 300 s the title never reaches the indirect/mesh submission path (0 ExecuteIndirect results of any category; no slot 57/61/67 traffic in the per-frame list-slot census), and no compute dispatch is translated. On this configuration the stack does not demonstrate a mesh-path advance in the title run; the PR fixtures (native_fixed_mesh57_*, startup_native_graphics_draw_*) remain the direct evidence for the new paths. A warm-cache, idle-machine run is the next measurement.

@lambirou

Copy link
Copy Markdown
Contributor

Follow-up: warm-cache and 18 GiB runs on the same stack (b80513fd), machine idle.

Run 2 (warm cache, default 14 GiB): 6689 frames in 245.4 s (27.3 fps); translated draws 53990 (not drawn 88351); pipelines 9 / missing 9; compute translated 1, refused 7428, no translation 16; indirect forwarded 0; peak commit 13065 MiB, then wrap(Resource): wrapper allocation failed -> E_OUTOFMEMORY and a C++ exception (0xe06d7363) at 253.58 s.

Run 3 (18 GiB): 6721 frames in 289.4 s (23.2 fps); translated draws 60713 (not drawn 4047); pipelines translated 10 / missing 2; textures uploaded 1364 (5605656 KiB, unreadable 0); compute translated 3, refused 16911, no translation 28; indirect forwarded 0 with no dispatchmesh category; peak commit 17181 MiB; stopped at 297.30 s on an access violation in XboxBvhBuilder.dll+0x1cef4 (rcx=0, null read), outside the draw path.

Interpretation: with the cache warm, the stack reaches the same loading state as the 26/11 reference (1364 textures, 10-11 pipelines) and translates 3 compute dispatches instead of 1. The mesh/indirect path is still never engaged before the BVH-builder crash: 0 ExecuteIndirect results of any category and no slot 57/61/67 traffic in the per-frame list-slot census. This receipt shows the stack does not regress the loading path, and it still does not demonstrate a mesh-path advance in the title run; the next blocking crash is the BVH builder, not the mesh submission.

@lambirou

Copy link
Copy Markdown
Contributor

Independent fixture receipt for this stacked runtime at b80513fd on a second adapter.

Clean worktree, Release preset, Windows 11 build 26300 (26H2), MSVC 19.44.35228, Windows SDK/DXC 10.0.26100.0, AMD Radeon RX 9060 XT (driver 32.0.32029.2010). The D3D12 debug layer is unavailable on this host (D3D12GetDebugInterface fails), so debug-layer cleanliness is not claimed.

cmake --build --preset release --target compile_dxil d3d12_xs_shim startup_stream_consumer startup_indirect_draw_indexed native_store_replay native_compute_pack_check native_frozen_request_check native_pixel_ir_dump
ctest --preset release --no-tests=error -j 1 -R '^native_fixed_mesh57'
ctest --preset release --no-tests=error -j 1 -R '^(startup_native_graphics_draw_(warp|hardware)|startup_compute_dispatch_native_(warp|hardware)|native_direct_container|native_direct_mesh|native_frozen_request|native_compute_pack|native_graphics_interface_library|native_graphics_wqm_ir)$'
ctest --preset release --no-tests=error -j 1 -R '^(native_startup_request_cache_controls|native_salu_shift64_controls)$'
  • native_fixed_mesh57_*: 20/20 passed (10 WARP, 10 hardware), including varying, mrt, uint_heap, pixel_heap, waterfall, waterfall_fine, buffers, constant and mask.
  • Runtime selection: 9 passed, 1 capability skip (startup_compute_dispatch_native_warp, WARP without 32-lane waves); startup_native_graphics_draw_warp and _hardware, startup_compute_dispatch_native_hardware, native_direct_container, native_direct_mesh, native_frozen_request, native_compute_pack, native_graphics_interface_library and native_graphics_wqm_ir pass.
  • Compiler controls: native_salu_shift64_controls and native_startup_request_cache_controls pass.

The fixed-mesh and first-use graphics fixtures therefore hold on this AMD adapter in Release, which the earlier title-run receipt could not show (the title never reached the mesh path before the BVH-builder crash).

@lambirou

Copy link
Copy Markdown
Contributor

Independent Windows receipt for the third review path, at the current #3139 head 9360bcaef424cf8a8bf8c0e495af4c057ce61dae (based on #3094 integration head b80513fd18a63319b238261c755aaf46c0d5e79a). I found that the existing tests/startup_native_graphics_draw_check.py already constructs this case, so I did not add a duplicate fixture or open a duplicate PR.

Environment: Windows 11 26H2 build 10.0.26300.10075; MSVC 19.44.35228.0; Windows SDK/DXC 10.0.26100.0 (DXC 1.8.2502.11); WARP Microsoft Basic Render Driver 10.0.26100.10068; AMD Radeon RX 9060 XT driver 32.0.32029.2010. The D3D12 debug layer was unavailable (0x887a002d), so debug-layer cleanliness is not claimed. The worktree was exactly the #3139 head with no source changes.

cmake --preset dev
cmake --build --preset dev --target compile_dxil startup_stream_consumer d3d12_xs_shim
ctest --preset dev --no-tests=error -j 1 -V -R '^startup_native_graphics_draw_(warp|hardware)$'
cmake --preset release
cmake --build --preset release --target compile_dxil startup_stream_consumer d3d12_xs_shim
ctest --preset release --no-tests=error -j 1 -V -R '^startup_native_graphics_draw_(warp|hardware)$'
  • Debug: 2/2 passed (startup_native_graphics_draw_warp 4.05 s, _hardware 5.86 s).
  • Release: 2/2 passed (_warp 4.13 s, _hardware 6.19 s).

Both adapters reported:

candidate failure recovered the published disk pair, 16 red and 16 clear pixels

The same test also controls the valid disk pair with native preparation disabled (16 red / 16 clear), a successful native candidate (16 red / 16 clear), and missing or invalid pairs (explicit refusal, 32 clear). For the injected PSO case it checks that the published manifest, .vs.cso and .ps.cso bytes and mtimes remain unchanged.

This is a bounded source-built fixture receipt: I did not run the full suite or the title, and no game files or captures were used. It establishes that the existing #3139 implementation recovers the published pair on both tested adapters for the third review case; it does not establish full-game startup.

@R0Y00
R0Y00 requested a review from KelboLive November 28, 2026 00:33
@R0Y00

R0Y00 commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

At 97cde4d, Debug and Release /O2 each had 15 passes and one capability skip (77, WARP native wave32 compute). This covered the selected fixed slot-57 mesh paths, first native draw, raw pixel UAV, pixel atomics and hardware slot-67 native Dispatch. Both graphics adapters used the existing disk pair unchanged when present and recovered the correct 16 red / 16 clear pixels after late manifest and root faults with delayed disk publication. This run did not inject a later CreateGraphicsPipelineState fault after a native candidate already became ready.

Windows 11 26200.9974, WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656. The native graphics fixture enabled the D3D12 debug layer.

cmake --build --preset dev --target startup_stream_consumer compile_dxil d3d12_xs_shim startup_indirect_draw_indexed
ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^(native_fixed_mesh57(_mrt|_varying|_buffers)?_(warp|hardware)|startup_(native_graphics_draw|compute_dispatch_native)_(warp|hardware)|native_pixel_(atomic|raw_uav)_(warp|hardware))$'

Repeat with the release preset. Please review this head on the compiler stack. After #3091 lands, review the resulting main diff, including the first-draw overlap with #2981, and rerun required CI before merging.

@R0Y00

R0Y00 commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

I reconciled the five runtime conflicts locally, retaining this PR's exact 97cde4d5 and #3139 dbca1851 as ancestors, together with the local compiler reconciliation and main fdba6e15. The local runtime candidate is 412738d4 (tree 9a33aa19). It keeps #2981's cold/warm, published-cache and retry behavior, #2862's snapshot input, the four-byte typed mesh input alignment and main's exact-width outputs.

The wider Release /O2 run on the preceding tree had 35 passes, the expected WARP Compute wave32 skip, and one failure in the packed-output negative control. The final change distinguishes a genuine SRV token from a malformed UAV token, preserving the existing refusal for each. The five affected tests then all passed:

ctest --test-dir out/build/release --no-tests=error --output-on-failure -j 1 -R '^(native_compute_pack_hardware|startup_compute_dispatch_output_(warp|hardware)|startup_native_graphics_draw_(warp|hardware))$'

Both draw cases include the cold/warm pixel readbacks, late manifest/root failures, regular and RTV-specific PSO fallback, and unchanged published bytes. Valid raw, structured and typed UAV cases retain the exact GPU output. Windows 11 26200.9974, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the D3D12 debug layer requested by the draw and pack fixtures.

These are source-built tests on the local integration. #3091 still needs its published compiler refresh and current-main CI before this PR can be retargeted.

@R0Y00

R0Y00 commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

A fresh local candidate now includes the approved compiler refresh cd746f6a, this PR's exact head 97cde4d5, #3139 dbca1851 and main f41806a9. Local commit 0171a370, tree 9738482e. The only compiler merge hunks were an enum line wrap, field ordering and equivalent output-shape expressions. The compiler contributor's packed virtual-wave positive and refusal controls are part of this tree.

Release /O2: 37 passed, 0 failed, 1 WARP capability skip in 38 selected tests. Debug: 11 passed, 0 failed, the same WARP capability skip in 12 selected tests. First-use VS/PS draw, untouched published cache files, regular and RTV PSO fallback, slot-67 cold/warm hardware readback, raw/structured/typed pack outputs and both distinct token refusals pass. The Release set also covers fixed mesh, exact-width texture outputs and root SRVs.

# Release /O2
ctest --test-dir out/build/release --no-tests=error --output-on-failure -j 1 -R '^(startup_native_graphics_draw_(warp|hardware)|startup_manifest_retry|startup_compute_dispatch_(native|input|output)_(warp|hardware)|startup_compute_root_srv_dispatch_(warp|hardware)|native_compute_pack(_hardware)?|native_fixed_mesh57.*|native_wave_virtual_derivative_controls|native_image_store_exact_width_(hardware_(r|volume|rgba)|warp_sparse))$'
# Debug
ctest --test-dir out/build/dev --no-tests=error --output-on-failure -j 1 -R '^(startup_native_graphics_draw_(warp|hardware)|startup_manifest_retry|startup_compute_dispatch_(native|input|output)_(warp|hardware)|native_compute_pack(_hardware)?|native_wave_virtual_derivative_controls)$'

Windows 11 26200.9974, inbox WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656 and SDK/DXC 10.0.26100.0. The draw and pack fixtures requested the debug layer. All fixtures were source-built. The published compiler update and current-head CI remain the gates for retargeting this PR.

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Thanks for the reconciliation notes. I reviewed head 97cde4d5 (base codex/native-shader-modules, i.e. #3091 0b505c1c) against current main (c3204a9c). The new draw checks each carry a negative-input control. Two things need fixing before this can land:

  1. It conflicts with main, and CI has never run. git merge-tree --write-tree --name-only origin/main 97cde4d5 exits 1 with 13 conflicted files: 7 come from shader: compile native mesh interfaces and prewarm compute requests #3091, and 6 are runtime files (d3d12_draw.inl, compute_dispatch, xs_device, sampler_bindings, stream_consumer, and an add/add on tests/startup_native_graphics_draw_check.py against main's runtime: compile a supported graphics pair on first use in the stand-in #2981). gh pr checks 3094 reports no checks, since windows.yml runs only on PRs to main/cpp-migration. The 03:57 reconciliation isn't pushed yet. Pushing it retargeted to main once shader: compile native mesh interfaces and prewarm compute requests #3091 lands, then CI on that sha, would settle it.
  2. The PSO fallback from the earlier review isn't on this head. try_native_graphics moves the candidate in once manifest and root succeed, before any PSO is created, so a later CreateGraphicsPipelineState failure leaves the draw clear with no disk-pair recovery. gh pr diff 3094 | grep -c X2W_TEST_NATIVE_GRAPHICS_PSO_FAILURE → 0, and runtime: recover the published disk pair when native candidate PSO creation fails #3139 isn't an ancestor of this head (git merge-base --is-ancestor <#3139 head> 97cde4d5 → 1). Merging runtime: recover the published disk pair when native candidate PSO creation fails #3139 first would fix it. Main's runtime: compile a supported graphics pair on first use in the stand-in #2981 copy has the same move-before-PSO pattern, so the conflict resolution should keep runtime: recover the published disk pair when native candidate PSO creation fails #3139's version.

Non-blocking:

  • a1f169d ("Preserve local menu shader and settings texture fixes") changes the compiler in five places, and the body doesn't mention them: per-register last_helper_touch, image op==0 in mask regions, uniform_conversion for v_cvt_i32_f32, a tex3d float UAV manifest line, and skipping v_mul_f32/s_waitcnt in fma_mix pairing. Only the fma_mix interleave and linked_raw_row have tests (grep -rl 'tex3d float' tests → none). A fixture plus revert mutant for each, or a separate compiler PR, would help.
  • The body's evidence is at 10b45ff5. The numbers for this head are only in the 00:34 comment, with a narrower filter.

Environment: Linux, static review and trial merges only. I did no build, WARP or GPU run.

This comment was AI-assisted.

# Conflicts:
#	CMakeLists.txt
#	src/startup_stubs/d3d12_compute_dispatch.inl
#	src/startup_stubs/d3d12_draw.inl
#	src/startup_stubs/d3d12_xs_device.cpp
#	src/startup_stubs/translated_sampler_bindings.h
#	tests/startup_native_graphics_draw_check.py
#	tests/startup_stream_consumer.cpp
# Conflicts:
#	src/startup_stubs/d3d12_xs_device.cpp
@R0Y00
R0Y00 changed the base branch from codex/native-shader-modules to main November 28, 2026 13:54
@R0Y00
R0Y00 merged commit 06cfb07 into main Nov 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants