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

Closed
Miici0 wants to merge 1 commit from upstream-pr/1236 into main
Miici0 commented 2026-11-24 20:40:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Miici0 on 2026-11-24T20:40:58Z.


Claimed in the coordination issue as: D3D-TRANSFORM-FEEDBACK-DEVICE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143836989)

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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5479976644 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236). Originally posted by [Miici0](https://github.com/Miici0) on 2026-11-24T20:40:58Z. --- Claimed in the coordination issue as: D3D-TRANSFORM-FEEDBACK-DEVICE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143836989) 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 - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work (the actual stream-output implementation) 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.
Snooozs commented 2026-11-24 21:29:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Snooozs on 2026-11-24T21:29:33Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7145001178 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236#issuecomment-7145001178). Originally posted by [Snooozs](https://github.com/Snooozs) on 2026-11-24T21:29:33Z. --- 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 commented 2026-11-25 11:52:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BubsMcgee on 2026-11-25T11:52:21Z.


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").

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7161614828 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236#issuecomment-7161614828). Originally posted by [BubsMcgee](https://github.com/BubsMcgee) on 2026-11-25T11:52:21Z. --- 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 commented 2026-11-25 12:59:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BubsMcgee on 2026-11-25T12:59:33Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7163137881 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236#issuecomment-7163137881). Originally posted by [BubsMcgee](https://github.com/BubsMcgee) on 2026-11-25T12:59:33Z. --- 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 commented 2026-11-25 14:40:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BubsMcgee on 2026-11-25T14:40:05Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165628689 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236#issuecomment-7165628689). Originally posted by [BubsMcgee](https://github.com/BubsMcgee) on 2026-11-25T14:40:05Z. --- 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 commented 2026-11-25 14:58:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BubsMcgee on 2026-11-25T14:58:10Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166097204 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236#issuecomment-7166097204). Originally posted by [BubsMcgee](https://github.com/BubsMcgee) on 2026-11-25T14:58:10Z. --- 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 commented 2026-11-25 15:51:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BubsMcgee on 2026-11-25T15:51:14Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7167370437 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236#issuecomment-7167370437). Originally posted by [BubsMcgee](https://github.com/BubsMcgee) on 2026-11-25T15:51:14Z. --- 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 commented 2026-11-25 17:11:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BubsMcgee on 2026-11-25T17:11:47Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7169147946 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236#issuecomment-7169147946). Originally posted by [BubsMcgee](https://github.com/BubsMcgee) on 2026-11-25T17:11:47Z. --- 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 commented 2026-11-25 22:32:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T22:32:45Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7176496087 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1236#issuecomment-7176496087). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T22:32:45Z. --- 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).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1236
No description provided.