diff options
| author | AlxcBTW <187763517+AlxcBTW@users.noreply.github.com> | 2026-11-22 12:34:41 +0100 |
|---|---|---|
| committer | AlxcBTW <187763517+AlxcBTW@users.noreply.github.com> | 2026-11-22 12:34:41 +0100 |
| commit | 40f239be13a09f3c0bb9e4e34ca53ef6b2ae098a (patch) | |
| tree | 31844fb0041d4b734afe4feabb03c3d43479546b /runtime/src | |
| parent | 877d2a5087214ac7e52520394136361a6bdccf7c (diff) | |
M2: pipelines bind the bindless set 0; textured quad through the descriptor path (d3d12_m2_textured_test)
Pipelines (graphics and compute) whose translated shader declares set-0 bindings were refused. Their layout now
holds the device's bindless set 0 and replay binds it at every draw and dispatch. d3d12_m2_textured_test drives
heaps, SRVs, a POINT sampler, two root descriptor tables and DrawIndexedInstanced with a translated PS that
loads the T#/S# from the tables; 4096 of 4096 pixels match, and the descriptor hash table is checked.
d3d12_translated_draw_test is registered with ctest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/vulkan_backend.h | 1 | ||||
| -rw-r--r-- | runtime/src/vulkan_replay.h | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h index a1479f50a..838b690cf 100644 --- a/runtime/src/vulkan_backend.h +++ b/runtime/src/vulkan_backend.h | |||
| @@ -648,6 +648,7 @@ public: | |||
| 648 | replay_.copy_query_pool_results = vk.vkCmdCopyQueryPoolResults; | 648 | replay_.copy_query_pool_results = vk.vkCmdCopyQueryPoolResults; |
| 649 | replay_.bind_pipeline = vk.vkCmdBindPipeline; | 649 | replay_.bind_pipeline = vk.vkCmdBindPipeline; |
| 650 | replay_.push_constants = vk.vkCmdPushConstants; | 650 | replay_.push_constants = vk.vkCmdPushConstants; |
| 651 | replay_.bind_descriptor_sets = vk.vkCmdBindDescriptorSets; | ||
| 651 | replay_.dispatch = vk.vkCmdDispatch; | 652 | replay_.dispatch = vk.vkCmdDispatch; |
| 652 | replay_.compute_pipeline = [this](std::uintptr_t id) -> const ComputePipeline* { | 653 | replay_.compute_pipeline = [this](std::uintptr_t id) -> const ComputePipeline* { |
| 653 | const auto it = pipelines_.find(id); | 654 | const auto it = pipelines_.find(id); |
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h index 3edcb80f4..ef7e2d285 100644 --- a/runtime/src/vulkan_replay.h +++ b/runtime/src/vulkan_replay.h | |||
| @@ -651,6 +651,7 @@ struct ComputePipeline { | |||
| 651 | VkPipeline pipeline = VK_NULL_HANDLE; | 651 | VkPipeline pipeline = VK_NULL_HANDLE; |
| 652 | VkPipelineLayout layout = VK_NULL_HANDLE; | 652 | VkPipelineLayout layout = VK_NULL_HANDLE; |
| 653 | std::uint64_t code_base = 0; | 653 | std::uint64_t code_base = 0; |
| 654 | VkDescriptorSet bindless_set = VK_NULL_HANDLE; // set 0 of the layout, bound at every dispatch; null: none | ||
| 654 | }; | 655 | }; |
| 655 | 656 | ||
| 656 | // A graphics pipeline as replay needs it: the formats its attachments must have and which vertex-input slots it | 657 | // A graphics pipeline as replay needs it: the formats its attachments must have and which vertex-input slots it |
| @@ -660,6 +661,7 @@ struct GraphicsPipeline { | |||
| 660 | VkPipelineLayout layout = VK_NULL_HANDLE; | 661 | VkPipelineLayout layout = VK_NULL_HANDLE; |
| 661 | VkShaderStageFlags push_stages = 0; // the layout's push-constant range; vkCmdPushConstants must name the same | 662 | VkShaderStageFlags push_stages = 0; // the layout's push-constant range; vkCmdPushConstants must name the same |
| 662 | std::uint64_t code_base = 0; | 663 | std::uint64_t code_base = 0; |
| 664 | VkDescriptorSet bindless_set = VK_NULL_HANDLE; // set 0 of the layout, bound at every draw; null: none | ||
| 663 | std::vector<VkFormat> color_formats; // by render-target slot | 665 | std::vector<VkFormat> color_formats; // by render-target slot |
| 664 | VkFormat depth_format = VK_FORMAT_UNDEFINED; | 666 | VkFormat depth_format = VK_FORMAT_UNDEFINED; |
| 665 | VkImageAspectFlags depth_aspects = 0; | 667 | VkImageAspectFlags depth_aspects = 0; |
| @@ -707,6 +709,7 @@ struct ReplayFunctions { | |||
| 707 | PFN_vkCmdCopyQueryPoolResults copy_query_pool_results = nullptr; | 709 | PFN_vkCmdCopyQueryPoolResults copy_query_pool_results = nullptr; |
| 708 | PFN_vkCmdBindPipeline bind_pipeline = nullptr; // dispatches | 710 | PFN_vkCmdBindPipeline bind_pipeline = nullptr; // dispatches |
| 709 | PFN_vkCmdPushConstants push_constants = nullptr; | 711 | PFN_vkCmdPushConstants push_constants = nullptr; |
| 712 | PFN_vkCmdBindDescriptorSets bind_descriptor_sets = nullptr; // set 0 of pipelines that declare bindings | ||
| 710 | PFN_vkCmdDispatch dispatch = nullptr; | 713 | PFN_vkCmdDispatch dispatch = nullptr; |
| 711 | std::function<const ComputePipeline*(std::uintptr_t)> compute_pipeline; | 714 | std::function<const ComputePipeline*(std::uintptr_t)> compute_pipeline; |
| 712 | PFN_vkCmdBindVertexBuffers2 bind_vertex_buffers2 = nullptr; // draws | 715 | PFN_vkCmdBindVertexBuffers2 bind_vertex_buffers2 = nullptr; // draws |
| @@ -2784,6 +2787,9 @@ inline void emit(const PreparedList& prepared, VkCommandBuffer command_buffer, c | |||
| 2784 | data.heap_base = vk.heap_base; | 2787 | data.heap_base = vk.heap_base; |
| 2785 | data.code_base = p.pipeline.code_base; | 2788 | data.code_base = p.pipeline.code_base; |
| 2786 | vk.bind_pipeline(command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, p.pipeline.pipeline); | 2789 | vk.bind_pipeline(command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, p.pipeline.pipeline); |
| 2790 | if (p.pipeline.bindless_set) | ||
| 2791 | vk.bind_descriptor_sets(command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, p.pipeline.layout, 0, 1, | ||
| 2792 | &p.pipeline.bindless_set, 0, nullptr); | ||
| 2787 | vk.push_constants(command_buffer, p.pipeline.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(data), &data); | 2793 | vk.push_constants(command_buffer, p.pipeline.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(data), &data); |
| 2788 | vk.dispatch(command_buffer, dispatch->x, dispatch->y, dispatch->z); | 2794 | vk.dispatch(command_buffer, dispatch->x, dispatch->y, dispatch->z); |
| 2789 | } else if (const auto* draw = std::get_if<Draw>(&command)) { | 2795 | } else if (const auto* draw = std::get_if<Draw>(&command)) { |
| @@ -2830,6 +2836,9 @@ inline void emit(const PreparedList& prepared, VkCommandBuffer command_buffer, c | |||
| 2830 | data.heap_base = vk.heap_base; | 2836 | data.heap_base = vk.heap_base; |
| 2831 | data.code_base = p.graphics.code_base; | 2837 | data.code_base = p.graphics.code_base; |
| 2832 | vk.bind_pipeline(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, p.graphics.pipeline); | 2838 | vk.bind_pipeline(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, p.graphics.pipeline); |
| 2839 | if (p.graphics.bindless_set) | ||
| 2840 | vk.bind_descriptor_sets(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, p.graphics.layout, 0, 1, | ||
| 2841 | &p.graphics.bindless_set, 0, nullptr); | ||
| 2833 | vk.push_constants(command_buffer, p.graphics.layout, p.graphics.push_stages, 0, sizeof(data), &data); | 2842 | vk.push_constants(command_buffer, p.graphics.layout, p.graphics.push_stages, 0, sizeof(data), &data); |
| 2834 | // Translated vertex shaders write D3D clip coordinates (y up); a negative-height viewport keeps the | 2843 | // Translated vertex shaders write D3D clip coordinates (y up); a negative-height viewport keeps the |
| 2835 | // image upright, and winding as D3D12 sees it. | 2844 | // image upright, and winding as D3D12 sees it. |