cpp-migration: compile a VS/PS pair on first draw through the ordinary graphics runtime #2978

Closed
opened 2026-11-27 01:50:49 +00:00 by R0Y00 · 7 comments
R0Y00 commented 2026-11-27 01:50:49 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T01:50:49Z.


Target branch main. Refs #2935. #2958 wired the first native compute dispatch. This issue covers the first native graphics draw through the stand-in. #2914 and #2946 provide stage-level regression fixtures.

Status. @Not-Saii claimed the first-draw work. #2981 is now on main at c827d8baad, after independent review of 3440edff. The source-built triangle draws 16 red and 16 clear pixels with cold and warm caches on both WARP and RTX. The published disk pair retains precedence and stays byte-identical. After an unsupported native manifest is rejected, the later draw recovers when the disk pair becomes available in the same process. The exact main tree passed 3 focused tests in Debug and Release /O2, with one expected inbox WARP wave32 Compute capability skip per build. Independent review.

Remaining main acceptance. PSO creation failure is a later step than manifest rejection. #3139 passed that negative control on the #3094 runtime stack. This issue stays open until the applicable PSO failure control is also verified on main. WARP and RTX results above refer to the source-built fixture.

Scope. Wire the existing C++ graphics pair compiler and binding information into the ordinary graphics pipeline/draw path for one supported VS/PS pair, with the native route enabled. Reuse the existing request identity, PSO creation and cache logic. Start with one render target, a known format and a simple source-built triangle. Keep mesh and additional RTV variants in separate work.

Reproduction and acceptance

  1. Add a public source-built fixture that submits the pair through the same stand-in entry points a caller uses to create and draw a graphics pipeline. Start with an empty cache, the native compiler enabled, no Python watcher or translation fallback, and no prebuilt stage bytecode. Record the baseline at the tested commit.
  2. Clear the target to a distinct color. On the first draw, record the pair key, native translation, actual bindings, successful graphics PSO creation and command-list submission. After the fence, compare an interior pixel against the shader's expected color and an exterior pixel against the clear color. A skipped-draw control must retain the clear color at both points.
  3. Repeat in a fresh process with the populated cache. Verify the same pixels and identify the cache hit without recompilation. An unsupported stage or incompatible pair must report the failing stage/reason without producing a successful cache entry.
  4. Include the exact build and test commands and the tested commit. Report WARP and hardware outcomes separately, with adapter, driver, Windows build, debug-layer status and capability skips. Use synthetic inputs that can ship with the test.

The deliverable is one reproducible end-to-end graphics path on this branch. The older CLI/cache work is tracked in #2933 and the compute work in #2934.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6638285084 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2978). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T01:50:49Z. --- Target branch `main`. Refs #2935. #2958 wired the first native compute dispatch. This issue covers the first native graphics draw through the stand-in. #2914 and #2946 provide stage-level regression fixtures. **Status.** @Not-Saii claimed the first-draw work. #2981 is now on main at c827d8baad6c950fac15a1314842e352358d9c6a, after independent review of 3440edff. The source-built triangle draws 16 red and 16 clear pixels with cold and warm caches on both WARP and RTX. The published disk pair retains precedence and stays byte-identical. After an unsupported native manifest is rejected, the later draw recovers when the disk pair becomes available in the same process. The exact main tree passed 3 focused tests in Debug and Release /O2, with one expected inbox WARP wave32 Compute capability skip per build. [Independent review](https://github.com/R0Y00/Xbox2Windows/pull/2981#pullrequestreview-6095238805). **Remaining main acceptance.** PSO creation failure is a later step than manifest rejection. #3139 passed that negative control on the #3094 runtime stack. This issue stays open until the applicable PSO failure control is also verified on main. WARP and RTX results above refer to the source-built fixture. **Scope.** Wire the existing C++ graphics pair compiler and binding information into the ordinary graphics pipeline/draw path for one supported VS/PS pair, with the native route enabled. Reuse the existing request identity, PSO creation and cache logic. Start with one render target, a known format and a simple source-built triangle. Keep mesh and additional RTV variants in separate work. **Reproduction and acceptance** 1. Add a public source-built fixture that submits the pair through the same stand-in entry points a caller uses to create and draw a graphics pipeline. Start with an empty cache, the native compiler enabled, no Python watcher or translation fallback, and no prebuilt stage bytecode. Record the baseline at the tested commit. 2. Clear the target to a distinct color. On the first draw, record the pair key, native translation, actual bindings, successful graphics PSO creation and command-list submission. After the fence, compare an interior pixel against the shader's expected color and an exterior pixel against the clear color. A skipped-draw control must retain the clear color at both points. 3. Repeat in a fresh process with the populated cache. Verify the same pixels and identify the cache hit without recompilation. An unsupported stage or incompatible pair must report the failing stage/reason without producing a successful cache entry. 4. Include the exact build and test commands and the tested commit. Report WARP and hardware outcomes separately, with adapter, driver, Windows build, debug-layer status and capability skips. Use synthetic inputs that can ship with the test. The deliverable is one reproducible end-to-end graphics path on this branch. The older CLI/cache work is tracked in #2933 and the compute work in #2934.
Not-Saii commented 2026-11-27 01:55:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-27T01:55:10Z.


Claiming this.

Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100, plus WARP.

Part I will do, on cpp-migration: on the first draw of a graphics pipeline with X2W_NATIVE_SHADERS set and no <key>.txt in the cache, the stand-in reads its own req_<key>.* files and compiles the pair in-process with the existing pieces (read_graphics_request, prepare_direct_graphics, format_graphics_runtime_manifest, ShaderDxilCompiler::runtime_worker). It then publishes <key>.vs.cso, <key>.ps.cso and <key>.txt (in that order) and loads them through the existing load_translation and PSO path. A fresh process with that cache loads the entry without recompiling. A refusal is logged with its stage and reason, and no <key>.txt is written.

The fixture is a source-built constant-colour triangle, one RTV with a known format, drawn through the stand-in. It compares one interior pixel and one exterior pixel against a clear-colour control and a skipped-draw control, does a second-process cache-hit run, and has an unsupported-pair case. Hardware run on the RTX 4090, WARP reported separately.

Shared interfaces I expect to touch: cached_translation in src/startup_stubs/d3d12_draw.inl, and the graphics request job in tools/startup/compile_dxil.cpp, which I plan to move into a shared function so the tool and the runtime run the same code. Mesh and RTV variants stay out of scope. I will say here if tracing shows otherwise.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7207682204 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2978#issuecomment-7207682204). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-27T01:55:10Z. --- Claiming this. Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100, plus WARP. Part I will do, on `cpp-migration`: on the first draw of a graphics pipeline with `X2W_NATIVE_SHADERS` set and no `<key>.txt` in the cache, the stand-in reads its own `req_<key>.*` files and compiles the pair in-process with the existing pieces (`read_graphics_request`, `prepare_direct_graphics`, `format_graphics_runtime_manifest`, `ShaderDxilCompiler::runtime_worker`). It then publishes `<key>.vs.cso`, `<key>.ps.cso` and `<key>.txt` (in that order) and loads them through the existing `load_translation` and PSO path. A fresh process with that cache loads the entry without recompiling. A refusal is logged with its stage and reason, and no `<key>.txt` is written. The fixture is a source-built constant-colour triangle, one RTV with a known format, drawn through the stand-in. It compares one interior pixel and one exterior pixel against a clear-colour control and a skipped-draw control, does a second-process cache-hit run, and has an unsupported-pair case. Hardware run on the RTX 4090, WARP reported separately. Shared interfaces I expect to touch: `cached_translation` in `src/startup_stubs/d3d12_draw.inl`, and the graphics request job in `tools/startup/compile_dxil.cpp`, which I plan to move into a shared function so the tool and the runtime run the same code. Mesh and RTV variants stay out of scope. I will say here if tracing shows otherwise. AI-assisted (Claude Code).
R0Y00 commented 2026-11-28 01:26:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T01:26:36Z.


The remaining PSO failure control has now passed independently on #3139 at dbca1851, on top of #3094. The source-built fixture enters the native compiler, injects a PSO creation failure, publishes a valid disk pair before fallback, and then reads back 16 red and 16 clear pixels. Native-only and missing-pair controls refuse, and the ordinary delayed RTV manifest still recovers. All six selected tests passed in both Debug and Release /O2 on inbox WARP and RTX 4060 Laptop with the D3D12 debug layer enabled.

Not-Saii's original #2981 remains linked and has green Windows CI at 850aba86; the new head is awaiting independent review. #3094 and #3139 are still stacked. This issue stays open until the first-draw path and its applicable controls are verified on main.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7231669097 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2978#issuecomment-7231669097). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-28T01:26:36Z. --- The remaining PSO failure control has now passed independently on #3139 at dbca1851, on top of #3094. The source-built fixture enters the native compiler, injects a PSO creation failure, publishes a valid disk pair before fallback, and then reads back 16 red and 16 clear pixels. Native-only and missing-pair controls refuse, and the ordinary delayed RTV manifest still recovers. All six selected tests passed in both Debug and Release /O2 on inbox WARP and RTX 4060 Laptop with the D3D12 debug layer enabled. Not-Saii's original #2981 remains linked and has green Windows CI at 850aba86; the new head is awaiting independent review. #3094 and #3139 are still stacked. This issue stays open until the first-draw path and its applicable controls are verified on main.
R0Y00 commented 2026-11-28 04:23:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T04:23:41Z.


Not-Saii’s #2981 is now on main at c827d8baa. The independent review of 3440edff reproduced the ordinary cold and warm draw on WARP and an RX 9060 XT. With an invalid generated manifest, the first target stayed clear. Publishing the valid disk pair let a later draw in the same process read back 16 red and 16 clear pixels, with all three cache files byte-identical. The early missing-DXC refusal was tested separately.

The later PSO-creation failure control is still tracked in #3139 on top of #3094. A local combined candidate passed that control, and the refreshed candidate d86ea977 passed seven focused Release regressions, including the WARP and hardware draw fixtures. This remains open for verification of the PSO recovery on main. All of these results are from source-built fixtures.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7234001697 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2978#issuecomment-7234001697). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-28T04:23:41Z. --- Not-Saii’s #2981 is now on `main` at `c827d8baa`. The independent review of `3440edff` reproduced the ordinary cold and warm draw on WARP and an RX 9060 XT. With an invalid generated manifest, the first target stayed clear. Publishing the valid disk pair let a later draw in the same process read back 16 red and 16 clear pixels, with all three cache files byte-identical. The early missing-DXC refusal was tested separately. The later PSO-creation failure control is still tracked in #3139 on top of #3094. A [local combined candidate](https://github.com/R0Y00/Xbox2Windows/pull/3094#issuecomment-7233747780) passed that control, and the refreshed candidate `d86ea977` passed seven focused Release regressions, including the WARP and hardware draw fixtures. This remains open for verification of the PSO recovery on `main`. All of these results are from source-built fixtures.
R0Y00 commented 2026-12-02 12:39:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T12:39:19Z.


Current-main check at 5770f14e: #3094 has merged to main, but #3139 merged into the former integration branch. The startup_native_graphics_draw fixture on main still injects only missing DXC, manifest failure and root-signature failure. I traced the translated draw on this revision: a null result from graphics PSO creation goes to pipeline_state_unavailable and exits the draw without reloading the published pair. This is a source inspection, not a new GPU result.

The remaining acceptance is a main-targeted change carrying over the late PSO recovery and its fixture from #3139. Inject failure only for the native candidate, publish a valid disk pair, and verify in the same process that the first target stays clear and the retry reads back 16 red and 16 clear pixels after the fence, with all three cache files byte-identical. Keep the native-only and missing-pair refusals, and record WARP and hardware separately.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7345668126 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2978#issuecomment-7345668126). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T12:39:19Z. --- Current-main check at `5770f14e`: #3094 has merged to `main`, but #3139 merged into the former integration branch. The `startup_native_graphics_draw` fixture on `main` still injects only missing DXC, manifest failure and root-signature failure. I traced the translated draw on this revision: a null result from graphics PSO creation goes to `pipeline_state_unavailable` and exits the draw without reloading the published pair. This is a source inspection, not a new GPU result. The remaining acceptance is a main-targeted change carrying over the late PSO recovery and its fixture from #3139. Inject failure only for the native candidate, publish a valid disk pair, and verify in the same process that the first target stays clear and the retry reads back 16 red and 16 clear pixels after the fence, with all three cache files byte-identical. Keep the native-only and missing-pair refusals, and record WARP and hardware separately.
R0Y00 commented 2026-12-02 18:40:23 +00:00 (Migrated from github.com)
Author
Contributor

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


@Ammmae0x @Leyukaka Thanks for bringing #3139 forward. #3873 and #3874 change the same PSO recovery path. Please coordinate on one PR to carry @lambirou’s original work and both timing cases. #3873 shows that a just-published pair can be hidden by the stale absent cache. #3874 also exercises publication after the first draw has already failed. The common fixture should cover both cases, keep the native-only and invalid-pair controls, and check the fenced pixels and cache files. Please link the chosen PR here so we can run one independent Windows review for #2978 and #3134.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7354972871 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2978#issuecomment-7354972871). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T18:40:23Z. --- @Ammmae0x @Leyukaka Thanks for bringing #3139 forward. #3873 and #3874 change the same PSO recovery path. Please coordinate on one PR to carry @lambirou’s original work and both timing cases. #3873 shows that a just-published pair can be hidden by the stale absent cache. #3874 also exercises publication after the first draw has already failed. The common fixture should cover both cases, keep the native-only and invalid-pair controls, and check the fenced pixels and cache files. Please link the chosen PR here so we can run one independent Windows review for #2978 and #3134.
R0Y00 commented 2026-12-03 05:15:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T05:15:23Z.


I independently tested #3874 (05eff611) in a local trial merge with main 9dfe168a. The source-built fixture matched the cold and warm draw on WARP and RTX 4060 Laptop. When native PSO creation was faulted, the first target stayed clear and the retry in the same process after disk publication read back 16 red and 16 clear pixels after the fence. The existing cache byte/mtime assertions passed. The fixed-entry draw and slot 67 regressions also passed on both adapters. Trial details

The remote PR still has merge conflicts. The just-published timing from #3873 and the command signature lifetime review remain open before this can land on main.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7368542749 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2978#issuecomment-7368542749). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T05:15:23Z. --- I independently tested #3874 (`05eff611`) in a local trial merge with main `9dfe168a`. The source-built fixture matched the cold and warm draw on WARP and RTX 4060 Laptop. When native PSO creation was faulted, the first target stayed clear and the retry in the same process after disk publication read back 16 red and 16 clear pixels after the fence. The existing cache byte/mtime assertions passed. The fixed-entry draw and slot 67 regressions also passed on both adapters. [Trial details](https://github.com/R0Y00/Xbox2Windows/pull/3874#pullrequestreview-6164070036) The remote PR still has merge conflicts. The just-published timing from #3873 and the command signature lifetime review remain open before this can land on main.
R0Y00 commented 2026-12-03 05:34:50 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T05:34:50Z.


The remaining main acceptance passed at 8a2f84d1b9bfc8815e224255a46c38d62d8bc39b (#3874). I checked out and rebuilt that exact main commit with MSVC Debug: cmake --build --preset dev --target compile_dxil d3d12_xs_shim startup_stream_consumer, then ctest --preset dev --no-tests=error -j 1 -V -R '^startup_native_graphics_(draw|fixed_entry)_(warp|hardware)$'. All four tests passed with no skips on Windows 11 build 26300, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the D3D12 debug layer enabled.

On each adapter the source-built triangle read back 16 red and 16 clear pixels on both the cold and warm native draws. The native-candidate PSO fault left all 32 pixels clear on the first draw. Publishing the disk pair let a later draw in that same process read back 16 red and 16 clear pixels after the fence, with its three cache files' bytes and mtimes unchanged. Native-only and missing-pair controls each left all 32 pixels clear. This completes the source-built first-draw acceptance started in #2981.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7368890813 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2978#issuecomment-7368890813). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T05:34:50Z. --- The remaining main acceptance passed at `8a2f84d1b9bfc8815e224255a46c38d62d8bc39b` (#3874). I checked out and rebuilt that exact main commit with MSVC Debug: `cmake --build --preset dev --target compile_dxil d3d12_xs_shim startup_stream_consumer`, then `ctest --preset dev --no-tests=error -j 1 -V -R '^startup_native_graphics_(draw|fixed_entry)_(warp|hardware)$'`. All four tests passed with no skips on Windows 11 build 26300, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the D3D12 debug layer enabled. On each adapter the source-built triangle read back 16 red and 16 clear pixels on both the cold and warm native draws. The native-candidate PSO fault left all 32 pixels clear on the first draw. Publishing the disk pair let a later draw in that same process read back 16 red and 16 clear pixels after the fence, with its three cache files' bytes and mtimes unchanged. Native-only and missing-pair controls each left all 32 pixels clear. This completes the source-built first-draw acceptance started in #2981.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#2978
No description provided.