[PR #581] runtime/d3d12: implement ForcedSampleCount target-independent rasterization (OLD-7205) #624

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/581
Author: @Taffyyy-ops
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: feat/d3d12-forced-sample-count


📝 Commits (2)

  • 93bd7c8 runtime/d3d12: implement ForcedSampleCount target-independent rasterization
  • dd604fd runtime/d3d12: gate VK_AMD_mixed_attachment_samples opt-in and harden AMD TIR tests

📊 Changes

7 files changed (+1723 additions, -43 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+41 -1)
📝 runtime/CMakeLists.txt (+8 -0)
📝 runtime/shims/d3d12_com.h (+8 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+117 -41)
📝 runtime/src/vulkan_replay.h (+1 -1)
➕ runtime/test/d3d12_forced_sample_count_test.cpp (+1527 -0)
📝 runtime/test/vk_test_device.h (+21 -0)

📄 Description

Claimed in the coordination issue as: OLD-7205 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7126487215)

What and why

Carried over from the closed upstream ItsNotRexed/Leonida PR #7205 and rebased cleanly onto ubiquitarianism/leonida main (fecb3cc1b, 2830b134a).

Implements D3D12 Target-Independent Rasterization (D3D12_RASTERIZER_DESC::ForcedSampleCount ∈ {0, 1, 4, 8, 16}):

  • Captures and validates ForcedSampleCount (plus depth/stencil disabled and DXGI_FORMAT_UNKNOWN DSV rules, and SampleDesc.Count == 1 when ForcedSampleCount > 1) in runtime/shims/d3d12_vulkan_device.cpp (D3D12_RESOURCE_DESC / PSO creation and d3d12_com.h).
  • Supports attachmentless TIR on Vulkan (0 color attachments + rasterizationSamples = ForcedSampleCount) unconditionally when supported, and 1x-RTV mixed-sample TIR via VK_NV_framebuffer_mixed_samples (enabled by default on NVIDIA) or VK_AMD_mixed_attachment_samples (gated behind explicit opt-in LEONIDA_VK_AMD_MIXED_SAMPLES=1 due to AMD SV_Coverage / SampleMask / RDNA4 occlusion divergences measured in upstream #7205 review).
  • Exposes/queries mixed-sample capability through runtime/src/vulkan_replay.h and runtime/test/vk_test_device.h, updates docs/d3d12_vulkan.md, and adds comprehensive host-parity tests (d3d12_forced_sample_count) in runtime/test/d3d12_forced_sample_count_test.cpp and runtime/CMakeLists.txt.

Tested

Built cleanly with MSVC 19.44 / Ninja (cmake --build runtime/build, 0 new /W4 warnings on modified files) and verified after rebasing onto 1c93c8697:

  • NVIDIA GeForce RTX 5060 Laptop GPU (driver 621.24, Windows 11, vs native D3D12 + Microsoft WARP):
    • ctest --test-dir runtime/build -R "^d3d12_forced_sample_count$" --output-on-failure -V -> Passed (2.39 sec, all checks passed: 22 PSO validation cases, 15+ attachmentless occlusion scenes, mixed-sample RGBA8 / SV_Coverage / MRT / unbound-RTV / conservative TIR, capability gating, multi-submission PSO switching sequence).
  • Intel RaptorLake-S Mobile Graphics Controller (Windows 11, vs Microsoft WARP / D3D12):
    • ctest --test-dir runtime/build -R "^d3d12_forced_sample_count$" --output-on-failure -V -> Passed (0.63 sec, attachmentless TIR 15/15 passed, capability gating mixed_attachment_samples=0 verified).
  • python -I scripts/check_no_game_data.py -> exit 0
  • git diff --check upstream/main..HEAD -> exit 0

Previous independent runs on the identical rebased code (upstream ItsNotRexed/Leonida PR #7205 before repo closure): NVIDIA RTX 3060, RTX 3070 (Khronos core+sync validation 1.4.363.0, 0 errors), RTX 5070 Ti, RTX 5080, and AMD Radeon RX 9060 XT (RDNA4, driver 26.11.2, including LEONIDA_VK_VALIDATION=1).

GPUs tested: NVIDIA GeForce RTX 5060 Laptop GPU (driver 621.24, Windows 11); Intel(R) RaptorLake-S Mobile Graphics Controller (Windows 11); plus WARP reference

AI-assisted: yes

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.

🔄 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/581 **Author:** [@Taffyyy-ops](https://github.com/Taffyyy-ops) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/d3d12-forced-sample-count` --- ### 📝 Commits (2) - [`93bd7c8`](https://github.com/ubiquitarianism/leonida/commit/93bd7c8ed8ee2a4c7c8c587cc5608c134a735944) runtime/d3d12: implement ForcedSampleCount target-independent rasterization - [`dd604fd`](https://github.com/ubiquitarianism/leonida/commit/dd604fd4752074af00d59dad1b7e685fd2784547) runtime/d3d12: gate VK_AMD_mixed_attachment_samples opt-in and harden AMD TIR tests ### 📊 Changes **7 files changed** (+1723 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+41 -1) 📝 `runtime/CMakeLists.txt` (+8 -0) 📝 `runtime/shims/d3d12_com.h` (+8 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+117 -41) 📝 `runtime/src/vulkan_replay.h` (+1 -1) ➕ `runtime/test/d3d12_forced_sample_count_test.cpp` (+1527 -0) 📝 `runtime/test/vk_test_device.h` (+21 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7205 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7126487215) ### What and why Carried over from the closed upstream `ItsNotRexed/Leonida` PR #7205 and rebased cleanly onto `ubiquitarianism/leonida` `main` (`fecb3cc1b`, `2830b134a`). Implements D3D12 Target-Independent Rasterization (`D3D12_RASTERIZER_DESC::ForcedSampleCount` ∈ `{0, 1, 4, 8, 16}`): - Captures and validates `ForcedSampleCount` (plus depth/stencil disabled and `DXGI_FORMAT_UNKNOWN` DSV rules, and `SampleDesc.Count == 1` when `ForcedSampleCount > 1`) in `runtime/shims/d3d12_vulkan_device.cpp` (`D3D12_RESOURCE_DESC` / PSO creation and `d3d12_com.h`). - Supports attachmentless TIR on Vulkan (0 color attachments + rasterizationSamples = `ForcedSampleCount`) unconditionally when supported, and 1x-RTV mixed-sample TIR via `VK_NV_framebuffer_mixed_samples` (enabled by default on NVIDIA) or `VK_AMD_mixed_attachment_samples` (gated behind explicit opt-in `LEONIDA_VK_AMD_MIXED_SAMPLES=1` due to AMD `SV_Coverage` / `SampleMask` / RDNA4 occlusion divergences measured in upstream #7205 review). - Exposes/queries mixed-sample capability through `runtime/src/vulkan_replay.h` and `runtime/test/vk_test_device.h`, updates `docs/d3d12_vulkan.md`, and adds comprehensive host-parity tests (`d3d12_forced_sample_count`) in `runtime/test/d3d12_forced_sample_count_test.cpp` and `runtime/CMakeLists.txt`. ### Tested Built cleanly with MSVC 19.44 / Ninja (`cmake --build runtime/build`, 0 new `/W4` warnings on modified files) and verified after rebasing onto `1c93c8697`: - **NVIDIA GeForce RTX 5060 Laptop GPU** (`driver 621.24`, Windows 11, vs native D3D12 + Microsoft WARP): - `ctest --test-dir runtime/build -R "^d3d12_forced_sample_count$" --output-on-failure -V` -> Passed (`2.39 sec`, all checks passed: 22 PSO validation cases, 15+ attachmentless occlusion scenes, mixed-sample RGBA8 / SV_Coverage / MRT / unbound-RTV / conservative TIR, capability gating, multi-submission PSO switching sequence). - **Intel RaptorLake-S Mobile Graphics Controller** (Windows 11, vs Microsoft WARP / D3D12): - `ctest --test-dir runtime/build -R "^d3d12_forced_sample_count$" --output-on-failure -V` -> Passed (`0.63 sec`, attachmentless TIR 15/15 passed, capability gating `mixed_attachment_samples=0` verified). - `python -I scripts/check_no_game_data.py` -> exit 0 - `git diff --check upstream/main..HEAD` -> exit 0 Previous independent runs on the identical rebased code (upstream `ItsNotRexed/Leonida` PR #7205 before repo closure): NVIDIA RTX 3060, RTX 3070 (Khronos core+sync validation 1.4.363.0, 0 errors), RTX 5070 Ti, RTX 5080, and AMD Radeon RX 9060 XT (RDNA4, driver 26.11.2, including `LEONIDA_VK_VALIDATION=1`). GPUs tested: NVIDIA GeForce RTX 5060 Laptop GPU (driver 621.24, Windows 11); Intel(R) RaptorLake-S Mobile Graphics Controller (Windows 11); plus WARP reference AI-assisted: yes ### 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. --- <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#624
No description provided.