Skip to content

d3d12_vulkan_device: detect and enable VK_EXT_transform_feedback (D3D-TRANSFORM-FEEDBACK-DEVICE) - #1236

Closed
Miici0 wants to merge 1 commit into
ProjectLeonida:mainfrom
Miici0:feat/d3d-transform-feedback-device
Closed

Miici0 wants to merge 1 commit into
ProjectLeonida:mainfrom
Miici0:feat/d3d-transform-feedback-device

Conversation

@Miici0

@Miici0 Miici0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: D3D-TRANSFORM-FEEDBACK-DEVICE (#14 (comment))

Depends on: none

Fixes: none

What and why

Foundation for D3D-302 (stream output, docs/d3d12_vulkan.md): detects VK_EXT_transform_feedback and reads its transformFeedback/geometryStreams features on the physical device where the extension is present, records them on the new VulkanDeviceInfo::transform_feedback / transform_feedback_geometry_streams fields, and enables them on the logical device - the same detect/record/enable pattern the existing VK_EXT_mesh_shader code already uses a few lines above.

This is device-capability plumbing only, no behaviour change: a graphics PSO that declares StreamOutput is still refused with E_NOTIMPL and SOSetTargets is still not implemented, exactly as on main today. Actually implementing stream output (accepting the PSO, binding real buffers in SOSetTargets, wrapping draws in vkCmdBeginTransformFeedbackEXT/EndTransformFeedbackEXT, and wiring the SO_STATISTICS queries to VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT) is separate, larger follow-up work.

Tested

ctest --test-dir runtime/build -C RelWithDebInfo -R "d3d12_vulkan_device|d3d12_mesh|xbox_present_readback_size": 3/3 pass. Full runtime/build compiles clean (these two files are included by ~100 translation units; all rebuilt without warnings from this change).

A standalone probe confirmed VK_EXT_transform_feedback is available on this GPU with transformFeedback/geometryStreams both true, maxTransformFeedbackStreams/maxTransformFeedbackBuffers both 4 - matching D3D12's stream-output model (4 streams, 4 buffers) exactly, so there's no capability mismatch to work around when the real implementation lands.

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 and merges cleanly.
  • One topic; follow-up work (the actual stream-output implementation) 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.

Foundation for D3D-302 (stream output): read the physical device's
transformFeedback/geometryStreams features where the extension is
present, record them on VulkanDeviceInfo, and enable them on the
logical device when supported, exactly the same pattern the existing
VK_EXT_mesh_shader detection/enable code already follows.

Device-capability plumbing only: no behaviour changes yet. A graphics
PSO declaring StreamOutput is still refused and SOSetTargets is still
not implemented, same as before this commit. Confirmed
VK_EXT_transform_feedback is available (4 streams, 4 buffers) on an
NVIDIA GeForce RTX 4070 SUPER, driver 621.24.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Snooozs

Snooozs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Read the whole diff and tested c99f26559 merged on main 6261ca916 (clean): Windows 10 Pro 19045, VS 2022 RelWithDebInfo, LEONIDA_VK_VALIDATION=1.

  • RTX 5060 Ti (NVIDIA 621.01): d3d12_vulkan_device and d3d12_mesh pass, 0 VUID lines.
  • Ryzen 7 7700 iGPU (AMD 31.0.22044.1): d3d12_vulkan_device exits 1 as on main; d3d12_mesh stops at its first pipeline (144 push-constant bytes, 128 available), before anything this PR could affect. Device creation works with the extra feature enabled, no VUID lines.

One thing to change: the comments describe behaviour this PR doesn't have. d3d12_com.h says that with transform_feedback "a graphics PSO that declares StreamOutput is accepted, SOSetTargets binds real buffers, and draws between them are captured", and that geometryStreams lets another RasterizedStream be rasterized; the description says StreamOutput PSOs are still refused and SOSetTargets isn't implemented. The stderr line has the same problem the other way round: without the extension it says StreamOutput PSOs are unsupported, which reads as if they work with it. "Detected and enabled; nothing uses it yet" would fit, and the log line could come with the implementation.

AI-assisted (Claude Code, Claude Opus 5.5).

@BubsMcgee

Copy link
Copy Markdown
Contributor

Heads-up for when this lands: enabling VK_EXT_transform_feedback makes pipeline_cache_seed fail on AMD (RX 7900 XT, 3/3) because vk_pipeline_check does not link the same VkPhysicalDeviceTransformFeedbackFeaturesEXT (transformFeedback, and geometryStreams when the device offers it), and AMD keys the pipeline cache on it. The fix is in #1630 commit ed7ab37a6: link the feature next to the mesh-shader one and list it in docs/pipeline_check.md ("The cache and the runtime's device"). NVIDIA does not key on it, so it does not show up on a 3080 Ti.

Also noting the label workflow here is currently failing ("Needs rebase label").

@BubsMcgee

Copy link
Copy Markdown
Contributor

Tested #1236 merged onto current main 98c2f7777 (Windows 11 Pro build 26300, MSVC RelWithDebInfo, NVIDIA RTX 3080 Ti, driver 616.64, Vulkan SDK 1.4.363.0):

  • d3d12_vulkan_device — Passed
  • d3d12_mesh — Passed

Both also pass with LEONIDA_VK_VALIDATION=1 (Khronos validation layer active), with no VUIDs.

The PR is MERGEABLE; the only check is the label workflow, which is cancelled (not a code failure), and no rebase is needed. Looks ready to merge. #1630 will then rebase onto it and drop its duplicated device setup.

(The AMD pipeline_cache_seed key for the new extension is the vk_pipeline_check change in #1630; the separate robustBufferAccess mismatch from #1723 is #1833.)

AI-assisted.

@BubsMcgee

Copy link
Copy Markdown
Contributor

Adopted into #1891: the device commit is unchanged and credited to @Miici0, with the vk_pipeline_check parity fix on top, because this PR has been stuck waiting on workflow approval. If you would rather keep this PR, say so and I will back #1891 out; otherwise the maintainer can merge #1891 and close this (I cannot close it myself).

AI-assisted.

BubsMcgee added a commit to BubsMcgee/leonida that referenced this pull request Nov 25, 2026
…g uses it yet

Addresses Snooozs's review on ProjectLeonida#1236: the comments and the log line no longer claim StreamOutput PSO acceptance, SOSetTargets or capture that this foundation does not have. ProjectLeonida#1630 adds the SO_STATISTICS query pools that use it.
@BubsMcgee

Copy link
Copy Markdown
Contributor

Addressed Snooozs's review in #1891 (adopted commit + follow-up): the comments and log now say detected/enabled, nothing uses it yet. Thanks for the catch.

@BubsMcgee

Copy link
Copy Markdown
Contributor

Superseded by #1891: the same device detect/enable commit, unchanged, plus the vk_pipeline_check parity fix and Snooozs's comment/log correction. #1891 is the foundation in the TF merge order (note on #1608). With that, this can close.

AI-assisted.

@BubsMcgee

Copy link
Copy Markdown
Contributor

Note for the queue: #1891 adopts this commit verbatim (the detect/enable code is credited to Miici0) because the workflow approval was stuck, and it is now CLEAN. With #1891 open, this one is redundant and would be reviewed twice; closing it is the author's/maintainer's call, I am only flagging it.

@aslan2142

Copy link
Copy Markdown
Collaborator

Thanks for this! It landed through #1891, which adopted it with the vk_pipeline_check parity fix (merged as 1bf5eeafd), so I'm closing this one as included.

AI-assisted (Claude Code, Claude Opus 5.5).

@aslan2142 aslan2142 closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants