[PR #628] [CLOSED] d3d12: BeginRenderPass and EndRenderPass on the Vulkan-backed list (D3D-27) #669

Closed
opened 2026-11-26 20:18:39 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/628
Author: @dkdknight
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: d3d-27-render-passes


📝 Commits (1)

  • a2e9ee3 d3d12: BeginRenderPass and EndRenderPass on the Vulkan-backed list (D3D-27)

📊 Changes

4 files changed (+764 additions, -7 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+19 -7)
📝 runtime/CMakeLists.txt (+9 -0)
📝 runtime/shims/d3d12_com.cpp (+128 -0)
➕ runtime/test/d3d12_render_pass_test.cpp (+608 -0)

📄 Description

Claimed in the coordination issue as: D3D-27 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128178677)

What and why

On main, ID3D12GraphicsCommandList4::BeginRenderPass / EndRenderPass are the generated stubs (GraphicsCommandList in runtime/shims/d3d12_com.cpp does not override them): a render pass binds no targets and runs none of its beginning or ending accesses, while the device reports RenderPassesTier = TIER_0 and docs/d3d12_vulkan.md lists render passes as handled.

This emulates them on the list's own commands, which is what the PC runtime does for a driver at tier 0 (WARP reports tier 0 too):

  • BeginRenderPass binds the pass's render targets and depth/stencil view as OMSetRenderTargets would, and records a clear for each CLEAR beginning access (colour targets one by one; depth and stencil planes with their own flags and values).
  • EndRenderPass records a ResolveSubresourceRegion for every subresource of each RESOLVE ending access (colour, depth or stencil). ResolveSubresourceRegion's body moved into a private resolve_region so both paths share it.
  • DISCARD, PRESERVE, PRESERVE_LOCAL_* and NO_ACCESS record nothing, which each of them allows.
  • A SUSPENDING_PASS keeps its ending accesses for the pass that resumes it; a RESUMING_PASS does not run its beginning accesses again (matches WARP byte for byte).
  • Recording rules, all measured against WARP (Close's verdict, not its code): no nesting, no EndRenderPass without a pass, at most 8 targets, direct lists only (bundles fail), Close fails while a pass is open but not while one is suspended, copies / resolves / Clear*View / DiscardResource / OMSetRenderTargets fail inside a pass while barriers do not, and the pass after a suspended one must be a RESUMING_PASS with nothing recorded in between (a barrier counts).

docs/d3d12_vulkan.md section 4.3 describes this (it used to describe a planned vkCmdBeginRendering mapping), and the command table and the M3 row point at it.

Tested

New runtime/test/d3d12_render_pass_test.cpp (ctest d3d12_render_pass, exit 77 without a Vulkan GPU or under Wine): 6 data cases compared byte for byte with WARP after readback (colour CLEAR + PRESERVE with depth or stencil CLEAR, two passes on one target, SUSPENDING then RESUMING, RESOLVE ending into a region and into the whole texture) and 26 Close cases.

  • On main before the change: 8 matched WARP, 24 differ (all 6 data cases and 18 of the 26 Close cases).
  • With the change: 32 matched WARP, 0 differ; also with LEONIDA_VK_VALIDATION=1, validation clean.
  • Full runtime ctest on Windows (MSVC 19.51, RelWithDebInfo): 295 registered, 282 passed, 11 skipped, 1 disabled, 1 failed — the failure is the known d3d12_execute_indirect_validation parity case (#337), the same as on main without this change (281 passed there; the new test is the one more).
  • tests/test_ctest_registration.py, test_docs_list_items.py, test_docs_repeated_lines.py, test_docs_table_ids.py: OK. git diff --check clean; scripts/check_no_game_data.py on the changed files: OK.

Not covered: draws inside a pass (the test has no shaders; draws keep using their own dynamic-rendering scope), and which targets are bound after EndRenderPass (they stay bound here).

GPUs tested: NVIDIA GeForce RTX 5080, driver 621.14, Windows 11 Home build 26200 (WARP from the same Windows).

AI-assisted: yes (Claude Code). No game files.

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)

🤖 Generated with Claude Code


🔄 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/628 **Author:** [@dkdknight](https://github.com/dkdknight) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `d3d-27-render-passes` --- ### 📝 Commits (1) - [`a2e9ee3`](https://github.com/ubiquitarianism/leonida/commit/a2e9ee387afd383c67b9975d5b7d2d72720682fc) d3d12: BeginRenderPass and EndRenderPass on the Vulkan-backed list (D3D-27) ### 📊 Changes **4 files changed** (+764 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+19 -7) 📝 `runtime/CMakeLists.txt` (+9 -0) 📝 `runtime/shims/d3d12_com.cpp` (+128 -0) ➕ `runtime/test/d3d12_render_pass_test.cpp` (+608 -0) </details> ### 📄 Description Claimed in the coordination issue as: D3D-27 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128178677) ### What and why On `main`, `ID3D12GraphicsCommandList4::BeginRenderPass` / `EndRenderPass` are the generated stubs (`GraphicsCommandList` in `runtime/shims/d3d12_com.cpp` does not override them): a render pass binds no targets and runs none of its beginning or ending accesses, while the device reports `RenderPassesTier = TIER_0` and `docs/d3d12_vulkan.md` lists render passes as handled. This emulates them on the list's own commands, which is what the PC runtime does for a driver at tier 0 (WARP reports tier 0 too): - `BeginRenderPass` binds the pass's render targets and depth/stencil view as `OMSetRenderTargets` would, and records a clear for each `CLEAR` beginning access (colour targets one by one; depth and stencil planes with their own flags and values). - `EndRenderPass` records a `ResolveSubresourceRegion` for every subresource of each `RESOLVE` ending access (colour, depth or stencil). `ResolveSubresourceRegion`'s body moved into a private `resolve_region` so both paths share it. - `DISCARD`, `PRESERVE`, `PRESERVE_LOCAL_*` and `NO_ACCESS` record nothing, which each of them allows. - A `SUSPENDING_PASS` keeps its ending accesses for the pass that resumes it; a `RESUMING_PASS` does not run its beginning accesses again (matches WARP byte for byte). - Recording rules, all measured against WARP (Close's verdict, not its code): no nesting, no `EndRenderPass` without a pass, at most 8 targets, direct lists only (bundles fail), Close fails while a pass is open but not while one is suspended, copies / resolves / `Clear*View` / `DiscardResource` / `OMSetRenderTargets` fail inside a pass while barriers do not, and the pass after a suspended one must be a `RESUMING_PASS` with nothing recorded in between (a barrier counts). `docs/d3d12_vulkan.md` section 4.3 describes this (it used to describe a planned `vkCmdBeginRendering` mapping), and the command table and the M3 row point at it. ### Tested New `runtime/test/d3d12_render_pass_test.cpp` (ctest `d3d12_render_pass`, exit 77 without a Vulkan GPU or under Wine): 6 data cases compared byte for byte with WARP after readback (colour CLEAR + PRESERVE with depth or stencil CLEAR, two passes on one target, SUSPENDING then RESUMING, RESOLVE ending into a region and into the whole texture) and 26 Close cases. - On `main` before the change: 8 matched WARP, 24 differ (all 6 data cases and 18 of the 26 Close cases). - With the change: 32 matched WARP, 0 differ; also with `LEONIDA_VK_VALIDATION=1`, validation clean. - Full runtime `ctest` on Windows (MSVC 19.51, RelWithDebInfo): 295 registered, 282 passed, 11 skipped, 1 disabled, 1 failed — the failure is the known `d3d12_execute_indirect_validation` parity case (#337), the same as on `main` without this change (281 passed there; the new test is the one more). - `tests/test_ctest_registration.py`, `test_docs_list_items.py`, `test_docs_repeated_lines.py`, `test_docs_table_ids.py`: OK. `git diff --check` clean; `scripts/check_no_game_data.py` on the changed files: OK. Not covered: draws inside a pass (the test has no shaders; draws keep using their own dynamic-rendering scope), and which targets are bound after `EndRenderPass` (they stay bound here). GPUs tested: NVIDIA GeForce RTX 5080, driver 621.14, Windows 11 Home build 26200 (WARP from the same Windows). AI-assisted: yes (Claude Code). No game files. ### 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) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:39 +01:00
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#669
No description provided.