mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:25:53 +01:00
[PR #1884] d3d12: accept StreamOutput PSOs, implement SOSetTargets, capture draws via VK_EXT_transform_feedback (D3D-STREAMOUTPUT-RUNTIME) #1897
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1897
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1884
Author: @Miici0
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:feat/d3d-stream-output-runtime📝 Commits (2)
c99f265d3d12_vulkan_device: detect and enable VK_EXT_transform_feedback9fc0789d3d12: accept StreamOutput PSOs, implement SOSetTargets, capture draws via VK_EXT_transform_feedback📊 Changes
11 files changed (+477 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(+60 -6)📝
runtime/src/command_list.h(+9 -0)📝
runtime/src/vulkan_backend.h(+6 -1)📝
runtime/src/vulkan_replay.h(+76 -0)➕
runtime/test/d3d12_stream_output_test.cpp(+207 -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-RUNTIME (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164990951)
Depends on: #1236
What and why
The capture path #1630 (D3D-302) explicitly left unclaimed: "StreamOutput PSOs are still refused and SOSetTargets is still not implemented; the capture path is not part of this PR." This PR is that capture path.
A graphics PSO that declares
StreamOutputis now accepted instead of refused (the common case:RasterizedStream0,NumStrideswithin the device'smaxTransformFeedbackBuffers).SOSetTargetsstores the bound buffers on the command list the same wayIASetVertexBuffersalready does. A draw whose pipeline hasStreamOutputand every declared buffer slot currently bound wraps itself invkCmdBindTransformFeedbackBuffersEXT+vkCmdBeginTransformFeedbackEXT/vkCmdEndTransformFeedbackEXT, writing real captured data to the bound buffers.Stacked on #1236, same as #1630: the first commit is #1236's device detect/enable, unchanged. When #1236 merges I will rebase and drop that copy.
Touches the same few files as #1630 (
d3d12_com.h,d3d12_vulkan_device.cpp,vulkan_backend.h,vulkan_replay.h) but a different part of each - the query-heap code I touched is only a comment update (theSO_STATISTICSpools themselves stay #1630's). A rebase against each other may be needed depending on merge order.Not done, left as follow-up (noted in the code and in
docs/d3d12_vulkan.md):RasterizedStreamother than 0 (needsVkPipelineRasterizationStateStreamCreateInfoEXT/rasterizerDiscardEnableat pipeline creation)SO_STATISTICSqueries (#1630's follow-up)Xfbdecorations into its SPIR-V at PSO-creation time (the translator runs before any PSO exists, so it cannot know this ahead of time)Tested
New test
d3d12_stream_output_test.cpp: a StreamOutput PSO with a hand-written vertex shader (runtime/test/glsl/vs_stream_output.vert,Xfb-decorated, writes the fixed vec4(1,2,3,4)) draws 3 vertices; the bufferSOSetTargetsbound is read back and every vertex's 16 bytes are checked against that constant. 0 mismatches on real hardware.Full
ctest(runtime/build, RelWithDebInfo): 307/308 pass (one more test thanmain, the new one); the only failure is the pre-existingd3d12_execute_indirect_validation(#504, fixed by the separate PR #1066, unrelated to this change). 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
main(stacked on #1236) and merges cleanly.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.