Skip to content

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

Backlog

Description

@R0Y00

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 c827d8b, after independent review of 3440edf. 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.

Activity

  1. added
    enhancement
    help wanted
    on Nov 27, 2026
  2. Not-Saii commented on Nov 27, 2026

    @Not-Saii
    Contributor

    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).

  3. R0Y00 commented on Nov 28, 2026

    @R0Y00
    OwnerAuthor

    The remaining PSO failure control has now passed independently on #3139 at dbca185, 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 850aba8; 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.

  4. R0Y00 commented on Nov 28, 2026

    @R0Y00
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions