[PR #1986] d3d12: support StreamOutput RasterizedStream other than 0 (D3D-STREAMOUTPUT-RASTERIZED-STREAM) #1993

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

📋 Pull Request Information

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

Base: main ← Head: feat/d3d-stream-output-rasterized-stream


📝 Commits (3)

  • c99f265 d3d12_vulkan_device: detect and enable VK_EXT_transform_feedback
  • 9fc0789 d3d12: accept StreamOutput PSOs, implement SOSetTargets, capture draws via VK_EXT_transform_feedback
  • e045ccc d3d12: support StreamOutput RasterizedStream other than 0 (D3D-302)

📊 Changes

11 files changed (+527 additions, -7 deletions)

View changed files

📝 runtime/CMakeLists.txt (+27 -0)
📝 runtime/shims/d3d12_com.cpp (+27 -0)
📝 runtime/shims/d3d12_com.h (+12 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+86 -6)
📝 runtime/src/command_list.h (+9 -0)
📝 runtime/src/vulkan_backend.h (+6 -1)
📝 runtime/src/vulkan_replay.h (+77 -0)
➕ runtime/test/d3d12_stream_output_test.cpp (+230 -0)
➕ runtime/test/glsl/ps_stream_output.frag (+9 -0)
➕ runtime/test/glsl/vs_stream_output.vert (+11 -0)
📝 runtime/test/vk_test_device.h (+33 -0)

📄 Description

Claimed in the coordination issue as: D3D-STREAMOUTPUT-RASTERIZED-STREAM (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7165139723)

Depends on: #1884

What and why

#1884 (D3D-STREAMOUTPUT-RUNTIME) refused any RasterizedStream other than 0. This PR handles the two remaining cases:

  • D3D12_SO_NO_RASTERIZED_STREAM (no stream reaches the rasterizer): rasterizerDiscardEnable on the pipeline's rasterization state. Needs no extra Vulkan feature; still captures everything via transform feedback.
  • An explicit non-default stream index: VkPipelineRasterizationStateStreamCreateInfoEXT chained into the rasterization state, gated on the geometryStreams feature (detected/enabled by #1236) and the index being below the device's maxTransformFeedbackStreams.

The pipeline-creation refusal and the Recipe/build() rasterization-state wiring are both updated; the draw-replay capture path is unaffected (capture is per XFB buffer slot, not per rasterized stream).

Tested

d3d12_stream_output_test.cpp now runs its capture check twice: once at RasterizedStream 0 (as before) and once at D3D12_SO_NO_RASTERIZED_STREAM. Both capture all 3 vertices correctly, 0 mismatches, on real hardware.

An explicit non-zero stream index needs a multi-stream geometry shader to exercise meaningfully, which this PR does not add; that code path is implemented per the Vulkan spec but not independently tested here.

Full ctest (runtime/build, RelWithDebInfo): same pattern as #1884, only the pre-existing d3d12_execute_indirect_validation failure (#1066, unrelated). No regressions.

GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11 26300.9974, Vulkan SDK 1.4.363.1.

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main (stacked on #1884, which is stacked on #1236) and merges cleanly.
  • One topic; follow-up work (testing a real non-zero stream with a multi-stream geometry shader) goes in a new pull request.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • N/A: no new translator rule.

🔄 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/1986 **Author:** [@Miici0](https://github.com/Miici0) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/d3d-stream-output-rasterized-stream` --- ### 📝 Commits (3) - [`c99f265`](https://github.com/ubiquitarianism/leonida/commit/c99f26559a4cca1866da4891a3cfb27cd5236c3e) d3d12_vulkan_device: detect and enable VK_EXT_transform_feedback - [`9fc0789`](https://github.com/ubiquitarianism/leonida/commit/9fc0789e2e6ec165eae3cff1ab0be7da633e9890) d3d12: accept StreamOutput PSOs, implement SOSetTargets, capture draws via VK_EXT_transform_feedback - [`e045ccc`](https://github.com/ubiquitarianism/leonida/commit/e045ccce33116f138137b2a15c916c581fd6ea33) d3d12: support StreamOutput RasterizedStream other than 0 (D3D-302) ### 📊 Changes **11 files changed** (+527 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+27 -0) 📝 `runtime/shims/d3d12_com.cpp` (+27 -0) 📝 `runtime/shims/d3d12_com.h` (+12 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+86 -6) 📝 `runtime/src/command_list.h` (+9 -0) 📝 `runtime/src/vulkan_backend.h` (+6 -1) 📝 `runtime/src/vulkan_replay.h` (+77 -0) ➕ `runtime/test/d3d12_stream_output_test.cpp` (+230 -0) ➕ `runtime/test/glsl/ps_stream_output.frag` (+9 -0) ➕ `runtime/test/glsl/vs_stream_output.vert` (+11 -0) 📝 `runtime/test/vk_test_device.h` (+33 -0) </details> ### 📄 Description Claimed in the coordination issue as: D3D-STREAMOUTPUT-RASTERIZED-STREAM (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7165139723) Depends on: #1884 ### What and why #1884 (D3D-STREAMOUTPUT-RUNTIME) refused any `RasterizedStream` other than 0. This PR handles the two remaining cases: - `D3D12_SO_NO_RASTERIZED_STREAM` (no stream reaches the rasterizer): `rasterizerDiscardEnable` on the pipeline's rasterization state. Needs no extra Vulkan feature; still captures everything via transform feedback. - An explicit non-default stream index: `VkPipelineRasterizationStateStreamCreateInfoEXT` chained into the rasterization state, gated on the `geometryStreams` feature (detected/enabled by #1236) and the index being below the device's `maxTransformFeedbackStreams`. The pipeline-creation refusal and the `Recipe`/`build()` rasterization-state wiring are both updated; the draw-replay capture path is unaffected (capture is per XFB buffer slot, not per rasterized stream). ### Tested `d3d12_stream_output_test.cpp` now runs its capture check twice: once at `RasterizedStream` 0 (as before) and once at `D3D12_SO_NO_RASTERIZED_STREAM`. Both capture all 3 vertices correctly, 0 mismatches, on real hardware. An explicit non-zero stream index needs a multi-stream geometry shader to exercise meaningfully, which this PR does not add; that code path is implemented per the Vulkan spec but not independently tested here. Full `ctest` (`runtime/build`, RelWithDebInfo): same pattern as #1884, only the pre-existing `d3d12_execute_indirect_validation` failure (#1066, unrelated). No regressions. GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11 26300.9974, Vulkan SDK 1.4.363.1. AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` (stacked on #1884, which is stacked on #1236) and merges cleanly. - [x] One topic; follow-up work (testing a real non-zero stream with a multi-stream geometry shader) goes in a new pull request. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [ ] N/A: no new translator rule. --- <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#1993
No description provided.