[PR #1549] d3d12: LEONIDA_STUB_PIPELINES builds a real graphics pipeline from built-in stages (MVP-GPU-04) #1576

Open
opened 2026-11-26 20:21:44 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1549
Author: @Mike7581
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: mvp-gpu-04-stub-pipeline


📝 Commits (2)

  • 78159b8 d3d12: LEONIDA_STUB_PIPELINES builds a real graphics pipeline from built-in stages (MVP-GPU-04)
  • bbc7506 d3d12: stub draws only for this device's mesh stubs; =color stubs override the state that hides them

📊 Changes

8 files changed (+875 additions, -29 deletions)

View changed files

📝 docs/boot.md (+13 -5)
📝 runtime/CMakeLists.txt (+9 -1)
📝 runtime/shims/d3d12_com.cpp (+9 -4)
📝 runtime/shims/d3d12_com.h (+5 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+124 -13)
➕ runtime/src/stub_pipeline.h (+222 -0)
➕ runtime/test/d3d12_stub_draw_test.cpp (+487 -0)
📝 runtime/test/d3d12_stub_pipelines_test.cpp (+6 -6)

📄 Description

Claimed in the coordination issue as: MVP-GPU-04 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151252490)

What and why

MVP-GPU-04 asks for a stub pipeline for the first draw: a minimal VS/PS that passes validation.

Today LEONIDA_STUB_PIPELINES=1 creates a graphics PSO whose translated shader is missing with no Vulkan pipeline and never registers it. Its draws did not become no-ops as the comment in d3d12_com.cpp said: record_draw refused them (!graphics_pipeline_), so the whole list failed to close. Only dispatches were skipped.

With this change a vertex pipeline with a missing translation (no shader library, or no entry for its FSSM/FSPX program) takes a vertex and a pixel stage from the new runtime/src/stub_pipeline.h and goes through the normal create_graphics path: registered, built eagerly (the lazy path reads stages from the library again), drawn through replay and the validation layer.

  • LEONIDA_STUB_PIPELINES=1: the vertex stage puts every vertex outside the clip volume, so a draw changes no pixel (the old intent), but the render pass, attachments, layouts and push constants are real.
  • LEONIDA_STUB_PIPELINES=color: every three vertices cover the viewport and the pixel stage writes magenta (1 to UINT/SINT targets) to each render target, so stubbed passes show on screen.
  • The stages are plain SPIR-V words built in C++ (like depth24_depth_only_fragment), no compiler at build time. No set 0, no code base, no vertex input read; the 144-byte push range is kept. Point-list PSOs get a PointSize write. Position is a bare output, so rect_list_geometry takes it.
  • Compute and mesh stubs stay unregistered. record_draw and DispatchMesh now skip a draw on an unregistered pipeline, as record_dispatch already did, instead of failing the list.
  • docs/boot.md describes the switch.

The MVP table names runtime/src/vulkan_pipeline.cpp; that file does not exist, the code is in runtime/shims/d3d12_vulkan_device.cpp (create_graphics).

Tested

  • New d3d12_stub_draw_test: no shader library; PSOs created with the switch off (E_FAIL), =1 (triangle and point list) and =color; draws into an R8G8B8A8_UNORM and an R32_UINT target and reads both back. =1 leaves blue / 7 on all 4096 pixels, =color gives magenta / 1 on all 4096 pixels.
  • d3d12_stub_pipelines_test now expects a registered graphics pipeline.
  • Both pass with LEONIDA_VK_VALIDATION=1 and no validation message (the test fails on any).
  • Full ctest on this branch rebased on bfef489c: 378/378 passed.

GPUs tested: NVIDIA GeForce RTX 4050 Laptop GPU, driver 621.40 (32.0.16.2140), Vulkan SDK 1.4.363.0, Windows 11 Pro 10.0.26200, MSVC (VS 2022 Build Tools 17.14) + Ninja via scripts\build_runtime.ps1

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1549 **Author:** [@Mike7581](https://github.com/Mike7581) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `mvp-gpu-04-stub-pipeline` --- ### 📝 Commits (2) - [`78159b8`](https://github.com/ubiquitarianism/leonida/commit/78159b88658f5a923a67b1b5c5380258a669ca39) d3d12: LEONIDA_STUB_PIPELINES builds a real graphics pipeline from built-in stages (MVP-GPU-04) - [`bbc7506`](https://github.com/ubiquitarianism/leonida/commit/bbc750655935a4b36a8f23bab7761ca6cbe29bc6) d3d12: stub draws only for this device's mesh stubs; =color stubs override the state that hides them ### 📊 Changes **8 files changed** (+875 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `docs/boot.md` (+13 -5) 📝 `runtime/CMakeLists.txt` (+9 -1) 📝 `runtime/shims/d3d12_com.cpp` (+9 -4) 📝 `runtime/shims/d3d12_com.h` (+5 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+124 -13) ➕ `runtime/src/stub_pipeline.h` (+222 -0) ➕ `runtime/test/d3d12_stub_draw_test.cpp` (+487 -0) 📝 `runtime/test/d3d12_stub_pipelines_test.cpp` (+6 -6) </details> ### 📄 Description Claimed in the coordination issue as: MVP-GPU-04 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151252490) ### What and why MVP-GPU-04 asks for a stub pipeline for the first draw: a minimal VS/PS that passes validation. Today `LEONIDA_STUB_PIPELINES=1` creates a graphics PSO whose translated shader is missing with no Vulkan pipeline and never registers it. Its draws did not become no-ops as the comment in `d3d12_com.cpp` said: `record_draw` refused them (`!graphics_pipeline_`), so the whole list failed to close. Only dispatches were skipped. With this change a vertex pipeline with a missing translation (no shader library, or no entry for its FSSM/FSPX program) takes a vertex and a pixel stage from the new `runtime/src/stub_pipeline.h` and goes through the normal `create_graphics` path: registered, built eagerly (the lazy path reads stages from the library again), drawn through replay and the validation layer. - `LEONIDA_STUB_PIPELINES=1`: the vertex stage puts every vertex outside the clip volume, so a draw changes no pixel (the old intent), but the render pass, attachments, layouts and push constants are real. - `LEONIDA_STUB_PIPELINES=color`: every three vertices cover the viewport and the pixel stage writes magenta (1 to UINT/SINT targets) to each render target, so stubbed passes show on screen. - The stages are plain SPIR-V words built in C++ (like `depth24_depth_only_fragment`), no compiler at build time. No set 0, no code base, no vertex input read; the 144-byte push range is kept. Point-list PSOs get a PointSize write. Position is a bare output, so `rect_list_geometry` takes it. - Compute and mesh stubs stay unregistered. `record_draw` and `DispatchMesh` now skip a draw on an unregistered pipeline, as `record_dispatch` already did, instead of failing the list. - `docs/boot.md` describes the switch. The MVP table names `runtime/src/vulkan_pipeline.cpp`; that file does not exist, the code is in `runtime/shims/d3d12_vulkan_device.cpp` (`create_graphics`). ### Tested - New `d3d12_stub_draw_test`: no shader library; PSOs created with the switch off (E_FAIL), `=1` (triangle and point list) and `=color`; draws into an R8G8B8A8_UNORM and an R32_UINT target and reads both back. `=1` leaves blue / 7 on all 4096 pixels, `=color` gives magenta / 1 on all 4096 pixels. - `d3d12_stub_pipelines_test` now expects a registered graphics pipeline. - Both pass with `LEONIDA_VK_VALIDATION=1` and no validation message (the test fails on any). - Full `ctest` on this branch rebased on `bfef489c`: 378/378 passed. GPUs tested: NVIDIA GeForce RTX 4050 Laptop GPU, driver 621.40 (32.0.16.2140), Vulkan SDK 1.4.363.0, Windows 11 Pro 10.0.26200, MSVC (VS 2022 Build Tools 17.14) + Ninja via `scripts\build_runtime.ps1` AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1576
No description provided.