diff options
| author | Ash Hopkins <ashleighhopkins87@gmail.com> | 2026-11-22 13:45:11 +0000 |
|---|---|---|
| committer | Ash Hopkins <ashleighhopkins87@gmail.com> | 2026-11-22 13:45:11 +0000 |
| commit | 19b261bb99735ceb33dd2daaefe31ac9ef9ed26a (patch) | |
| tree | 791a75129861d575d2a1c41fc8e62d200733208b /runtime/src/vulkan_backend.h | |
| parent | 6eb5bce3920b68006e6058a48aab5938f3f59a8b (diff) | |
| parent | 89b047cd8fab50675a43d76722a6a8a881f55dc2 (diff) | |
Merge remote-tracking branch 'origin/main' into runtime-vulkan12-khr
# Conflicts:
# runtime/shims/d3d12_vulkan_device.cpp
# runtime/test/vk_test_device.h
Diffstat (limited to 'runtime/src/vulkan_backend.h')
| -rw-r--r-- | runtime/src/vulkan_backend.h | 121 |
1 files changed, 94 insertions, 27 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h index 245aad6bb..95803fe34 100644 --- a/runtime/src/vulkan_backend.h +++ b/runtime/src/vulkan_backend.h | |||
| @@ -11,11 +11,13 @@ | |||
| 11 | #endif | 11 | #endif |
| 12 | #include "binary_occlusion_spirv.h" | 12 | #include "binary_occlusion_spirv.h" |
| 13 | #include "occlusion_sum_spirv.h" | 13 | #include "occlusion_sum_spirv.h" |
| 14 | #include "retire_tickets.h" | ||
| 14 | #include "statistics_sum_spirv.h" | 15 | #include "statistics_sum_spirv.h" |
| 15 | #include "vulkan13_features.h" | 16 | #include "vulkan13_features.h" |
| 16 | #include "vulkan_depth24.h" | 17 | #include "vulkan_depth24.h" |
| 17 | #include "vulkan_scratch.h" | 18 | #include "vulkan_scratch.h" |
| 18 | #include "vulkan_replay.h" | 19 | #include "vulkan_replay.h" |
| 20 | #include "xdxr_build.h" | ||
| 19 | 21 | ||
| 20 | #include <algorithm> | 22 | #include <algorithm> |
| 21 | #include <atomic> | 23 | #include <atomic> |
| @@ -73,7 +75,8 @@ struct VulkanDeviceFunctions { | |||
| 73 | X(vkCreateComputePipelines) X(vkDestroyPipeline) X(vkCmdBindPipeline) X(vkCmdBindDescriptorSets) \ | 75 | X(vkCreateComputePipelines) X(vkDestroyPipeline) X(vkCmdBindPipeline) X(vkCmdBindDescriptorSets) \ |
| 74 | X(vkCmdPushConstants) X(vkCmdDispatch) \ | 76 | X(vkCmdPushConstants) X(vkCmdDispatch) \ |
| 75 | X(vkCmdBindVertexBuffers2) X(vkCmdBindIndexBuffer) X(vkCmdSetViewport) X(vkCmdSetScissor) \ | 77 | X(vkCmdBindVertexBuffers2) X(vkCmdBindIndexBuffer) X(vkCmdSetViewport) X(vkCmdSetScissor) \ |
| 76 | X(vkCmdSetPrimitiveTopology) X(vkCmdSetStencilReference) X(vkCmdSetBlendConstants) X(vkCmdDraw) \ | 78 | X(vkCmdSetPrimitiveTopology) X(vkCmdSetPrimitiveRestartEnable) X(vkCmdSetStencilReference) \ |
| 79 | X(vkCmdSetBlendConstants) X(vkCmdDraw) \ | ||
| 77 | X(vkCmdDrawIndexed) X(vkCreateGraphicsPipelines) | 80 | X(vkCmdDrawIndexed) X(vkCreateGraphicsPipelines) |
| 78 | #define LEONIDA_VK_MEMBER(name) PFN_##name name = nullptr; | 81 | #define LEONIDA_VK_MEMBER(name) PFN_##name name = nullptr; |
| 79 | LEONIDA_VK_DEVICE_FUNCTIONS(LEONIDA_VK_MEMBER) | 82 | LEONIDA_VK_DEVICE_FUNCTIONS(LEONIDA_VK_MEMBER) |
| @@ -105,7 +108,8 @@ struct VulkanDeviceFunctions { | |||
| 105 | 108 | ||
| 106 | // Graphics pipelines also need these Vulkan 1.3 entry points (dynamic rendering, extended dynamic state). | 109 | // Graphics pipelines also need these Vulkan 1.3 entry points (dynamic rendering, extended dynamic state). |
| 107 | bool graphics_complete() const { | 110 | bool graphics_complete() const { |
| 108 | return vkCmdBeginRendering && vkCmdEndRendering && vkCmdBindVertexBuffers2 && vkCmdSetPrimitiveTopology; | 111 | return vkCmdBeginRendering && vkCmdEndRendering && vkCmdBindVertexBuffers2 && vkCmdSetPrimitiveTopology && |
| 112 | vkCmdSetPrimitiveRestartEnable; | ||
| 109 | } | 113 | } |
| 110 | }; | 114 | }; |
| 111 | 115 | ||
| @@ -648,8 +652,9 @@ class VulkanContext { | |||
| 648 | public: | 652 | public: |
| 649 | // conditional_rendering: VK_EXT_conditional_rendering is enabled on `device` (SetPredication). | 653 | // conditional_rendering: VK_EXT_conditional_rendering is enabled on `device` (SetPredication). |
| 650 | // ray_tracing: VK_KHR_acceleration_structure + VK_KHR_ray_query are enabled on `device`. | 654 | // ray_tracing: VK_KHR_acceleration_structure + VK_KHR_ray_query are enabled on `device`. |
| 655 | // xdxr: acceleration-structure builds write XDXR BVH4 records (xdxr_build.h) instead; needs bufferDeviceAddress. | ||
| 651 | VulkanContext(PFN_vkGetDeviceProcAddr get, VkDevice device, bool separate_depth_stencil_layouts, | 656 | VulkanContext(PFN_vkGetDeviceProcAddr get, VkDevice device, bool separate_depth_stencil_layouts, |
| 652 | bool conditional_rendering = false, bool ray_tracing = false) | 657 | bool conditional_rendering = false, bool ray_tracing = false, bool xdxr = false) |
| 653 | : device_(device), tracker_(separate_depth_stencil_layouts), ray_tracing_(ray_tracing) { | 658 | : device_(device), tracker_(separate_depth_stencil_layouts), ray_tracing_(ray_tracing) { |
| 654 | loaded_ = vk.load(get, device); | 659 | loaded_ = vk.load(get, device); |
| 655 | replay_.pipeline_barrier = vk.vkCmdPipelineBarrier; | 660 | replay_.pipeline_barrier = vk.vkCmdPipelineBarrier; |
| @@ -682,6 +687,7 @@ public: | |||
| 682 | replay_.copy_query_pool_results = vk.vkCmdCopyQueryPoolResults; | 687 | replay_.copy_query_pool_results = vk.vkCmdCopyQueryPoolResults; |
| 683 | replay_.bind_pipeline = vk.vkCmdBindPipeline; | 688 | replay_.bind_pipeline = vk.vkCmdBindPipeline; |
| 684 | replay_.push_constants = vk.vkCmdPushConstants; | 689 | replay_.push_constants = vk.vkCmdPushConstants; |
| 690 | replay_.bind_descriptor_sets = vk.vkCmdBindDescriptorSets; | ||
| 685 | replay_.dispatch = vk.vkCmdDispatch; | 691 | replay_.dispatch = vk.vkCmdDispatch; |
| 686 | replay_.compute_pipeline = [this](std::uintptr_t id) -> const ComputePipeline* { | 692 | replay_.compute_pipeline = [this](std::uintptr_t id) -> const ComputePipeline* { |
| 687 | const auto it = pipelines_.find(id); | 693 | const auto it = pipelines_.find(id); |
| @@ -692,6 +698,7 @@ public: | |||
| 692 | replay_.set_viewport = vk.vkCmdSetViewport; | 698 | replay_.set_viewport = vk.vkCmdSetViewport; |
| 693 | replay_.set_scissor = vk.vkCmdSetScissor; | 699 | replay_.set_scissor = vk.vkCmdSetScissor; |
| 694 | replay_.set_primitive_topology = vk.vkCmdSetPrimitiveTopology; | 700 | replay_.set_primitive_topology = vk.vkCmdSetPrimitiveTopology; |
| 701 | replay_.set_primitive_restart_enable = vk.vkCmdSetPrimitiveRestartEnable; | ||
| 695 | replay_.set_stencil_reference = vk.vkCmdSetStencilReference; | 702 | replay_.set_stencil_reference = vk.vkCmdSetStencilReference; |
| 696 | replay_.set_blend_constants = vk.vkCmdSetBlendConstants; | 703 | replay_.set_blend_constants = vk.vkCmdSetBlendConstants; |
| 697 | replay_.draw = vk.vkCmdDraw; | 704 | replay_.draw = vk.vkCmdDraw; |
| @@ -713,7 +720,34 @@ public: | |||
| 713 | } | 720 | } |
| 714 | return false; | 721 | return false; |
| 715 | }; | 722 | }; |
| 716 | if (ray_tracing_ && vk.vkCmdBuildAccelerationStructuresKHR) { | 723 | if (xdxr && loaded_) { |
| 724 | xdxr_ = std::make_unique<XdxrBuilder>(get, device); | ||
| 725 | if (xdxr_->loaded()) { | ||
| 726 | replay_.xdxr_check = [](const BuildAccelerationStructure& b) { | ||
| 727 | XdxrLayout layout; | ||
| 728 | return xdxr_inputs(b, nullptr, 0) && layout.compute(xdxr_elements(b), b.is_tlas) && b.dst_va && | ||
| 729 | b.scratch_va && (!b.is_tlas || !b.instance_count || b.instances_va); | ||
| 730 | }; | ||
| 731 | replay_.xdxr_record = [this](VkCommandBuffer cb, const BuildAccelerationStructure& b) { | ||
| 732 | // Every address is a console VA in the GPU address arena: the device address is heap_base + VA, | ||
| 733 | // and the BLAS addresses in instance descs get the same bias. | ||
| 734 | const std::uint64_t base = replay_.heap_base; | ||
| 735 | XdxrLayout layout; | ||
| 736 | layout.compute(xdxr_elements(b), b.is_tlas); | ||
| 737 | if (b.is_tlas) { | ||
| 738 | xdxr_->record_tlas(cb, layout, b.instances_va ? base + b.instances_va : 0, base + b.dst_va, | ||
| 739 | base + b.scratch_va, base); | ||
| 740 | } else { | ||
| 741 | std::vector<XdxrTriangles> geometries; | ||
| 742 | xdxr_inputs(b, &geometries, base); | ||
| 743 | xdxr_->record_blas(cb, layout, geometries, base + b.dst_va, base + b.scratch_va); | ||
| 744 | } | ||
| 745 | }; | ||
| 746 | } else { | ||
| 747 | xdxr_.reset(); | ||
| 748 | } | ||
| 749 | } | ||
| 750 | if (!xdxr_ && ray_tracing_ && vk.vkCmdBuildAccelerationStructuresKHR) { | ||
| 717 | replay_.build_acceleration_structures = vk.vkCmdBuildAccelerationStructuresKHR; | 751 | replay_.build_acceleration_structures = vk.vkCmdBuildAccelerationStructuresKHR; |
| 718 | replay_.resolve_acceleration_structure = [this](std::uint64_t va) { | 752 | replay_.resolve_acceleration_structure = [this](std::uint64_t va) { |
| 719 | const auto it = acceleration_structures_.find(va); | 753 | const auto it = acceleration_structures_.find(va); |
| @@ -729,12 +763,6 @@ public: | |||
| 729 | }; | 763 | }; |
| 730 | replay_.separate_depth_stencil_layouts = separate_depth_stencil_layouts; | 764 | replay_.separate_depth_stencil_layouts = separate_depth_stencil_layouts; |
| 731 | if (loaded_) { | 765 | if (loaded_) { |
| 732 | VkSemaphoreTypeCreateInfo type{VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO}; | ||
| 733 | type.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; | ||
| 734 | type.initialValue = 0; | ||
| 735 | VkSemaphoreCreateInfo info{VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, &type}; | ||
| 736 | if (vk.vkCreateSemaphore(device_, &info, nullptr, &retire_timeline_) != VK_SUCCESS) | ||
| 737 | retire_timeline_ = VK_NULL_HANDLE; | ||
| 738 | fence_dispatcher_ = std::make_unique<FenceWaitDispatcher>(device_, vk, device_lost_); | 766 | fence_dispatcher_ = std::make_unique<FenceWaitDispatcher>(device_, vk, device_lost_); |
| 739 | } | 767 | } |
| 740 | } | 768 | } |
| @@ -743,7 +771,6 @@ public: | |||
| 743 | fence_dispatcher_.reset(); | 771 | fence_dispatcher_.reset(); |
| 744 | deletion_queue_.drain(UINT64_MAX, device_, vk); | 772 | deletion_queue_.drain(UINT64_MAX, device_, vk); |
| 745 | for (const auto& [key, view] : views_) vk.vkDestroyImageView(device_, view, nullptr); | 773 | for (const auto& [key, view] : views_) vk.vkDestroyImageView(device_, view, nullptr); |
| 746 | if (retire_timeline_) vk.vkDestroySemaphore(device_, retire_timeline_, nullptr); | ||
| 747 | } | 774 | } |
| 748 | 775 | ||
| 749 | VulkanContext(const VulkanContext&) = delete; | 776 | VulkanContext(const VulkanContext&) = delete; |
| @@ -885,6 +912,40 @@ public: | |||
| 885 | } | 912 | } |
| 886 | 913 | ||
| 887 | bool ray_tracing_supported() const { return ray_tracing_ && vk.vkCmdBuildAccelerationStructuresKHR != nullptr; } | 914 | bool ray_tracing_supported() const { return ray_tracing_ && vk.vkCmdBuildAccelerationStructuresKHR != nullptr; } |
| 915 | bool xdxr_acceleration_structures() const { return xdxr_ != nullptr; } | ||
| 916 | |||
| 917 | // Triangles (BLAS) or instances (TLAS) a build has: what XdxrLayout is computed from, for the build and for | ||
| 918 | // GetRaytracingAccelerationStructurePrebuildInfo. | ||
| 919 | static std::uint32_t xdxr_elements(const BuildAccelerationStructure& b) { | ||
| 920 | if (b.is_tlas) return b.instance_count; | ||
| 921 | std::uint64_t n = 0; | ||
| 922 | for (const auto& t : b.triangles) n += (t.index_type ? t.index_count : t.vertex_count) / 3; | ||
| 923 | return n > 0xffffffffu ? 0xffffffffu : std::uint32_t(n); | ||
| 924 | } | ||
| 925 | // The geometries as the builder reads them, with `base` added to their VAs; false for an input it cannot read | ||
| 926 | // (a vertex format other than R32G32B32_FLOAT or R32G32_FLOAT, an index type other than none/R16/R32). | ||
| 927 | static bool xdxr_inputs(const BuildAccelerationStructure& b, std::vector<XdxrTriangles>* out, std::uint64_t base) { | ||
| 928 | if (b.is_tlas) return true; | ||
| 929 | for (const auto& t : b.triangles) { | ||
| 930 | if (t.vertex_format != VK_FORMAT_R32G32B32_SFLOAT && t.vertex_format != VK_FORMAT_R32G32_SFLOAT) return false; | ||
| 931 | if (t.index_type > 2) return false; | ||
| 932 | const std::uint32_t count = (t.index_type ? t.index_count : t.vertex_count) / 3; | ||
| 933 | if (count && !t.vertex_va) return false; | ||
| 934 | if (count && t.index_type && !t.index_va) return false; | ||
| 935 | if (!out) continue; | ||
| 936 | XdxrTriangles g; | ||
| 937 | g.vertices = t.vertex_va ? base + t.vertex_va : 0; | ||
| 938 | g.vertex_stride = t.vertex_stride; | ||
| 939 | g.xy_only = t.vertex_format == VK_FORMAT_R32G32_SFLOAT; | ||
| 940 | g.indices = t.index_type && t.index_va ? base + t.index_va : 0; | ||
| 941 | g.index_type = t.index_type; | ||
| 942 | g.triangle_count = count; | ||
| 943 | g.transform = t.transform_va ? base + t.transform_va : 0; | ||
| 944 | g.flags = t.flags | (t.opaque ? 1u : 0u); | ||
| 945 | out->push_back(g); | ||
| 946 | } | ||
| 947 | return true; | ||
| 948 | } | ||
| 888 | 949 | ||
| 889 | void register_acceleration_structure(std::uint64_t va, VkAccelerationStructureKHR as) { | 950 | void register_acceleration_structure(std::uint64_t va, VkAccelerationStructureKHR as) { |
| 890 | if (!va || !as) return; | 951 | if (!va || !as) return; |
| @@ -951,30 +1012,38 @@ public: | |||
| 951 | void defer_destroy(DeferredDeletionQueue::Kind kind, VkHandle handle) { | 1012 | void defer_destroy(DeferredDeletionQueue::Kind kind, VkHandle handle) { |
| 952 | const auto raw = static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(handle)); | 1013 | const auto raw = static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(handle)); |
| 953 | if (!raw) return; | 1014 | if (!raw) return; |
| 1015 | std::lock_guard lock(submit_mutex_); | ||
| 954 | const std::uint64_t safe_ticket = submitted_ticket_.load(std::memory_order_acquire) + 1; | 1016 | const std::uint64_t safe_ticket = submitted_ticket_.load(std::memory_order_acquire) + 1; |
| 955 | deletion_queue_.push(safe_ticket, kind, raw); | 1017 | deletion_queue_.push(safe_ticket, kind, raw); |
| 956 | } | 1018 | } |
| 957 | 1019 | ||
| 958 | void defer_destroy(DeferredDeletionQueue::Kind kind, std::uint64_t raw_handle) { | 1020 | void defer_destroy(DeferredDeletionQueue::Kind kind, std::uint64_t raw_handle) { |
| 959 | if (!raw_handle && kind != DeferredDeletionQueue::Kind::bindless_slot) return; | 1021 | if (!raw_handle && kind != DeferredDeletionQueue::Kind::bindless_slot) return; |
| 1022 | std::lock_guard lock(submit_mutex_); | ||
| 960 | const std::uint64_t safe_ticket = submitted_ticket_.load(std::memory_order_acquire) + 1; | 1023 | const std::uint64_t safe_ticket = submitted_ticket_.load(std::memory_order_acquire) + 1; |
| 961 | deletion_queue_.push(safe_ticket, kind, raw_handle); | 1024 | deletion_queue_.push(safe_ticket, kind, raw_handle); |
| 962 | } | 1025 | } |
| 963 | 1026 | ||
| 964 | std::uint64_t completed_retire_ticket() const { | 1027 | std::uint64_t completed_retire_ticket() { |
| 965 | if (!retire_timeline_) return submitted_ticket_.load(std::memory_order_acquire); | 1028 | std::lock_guard lock(submit_mutex_); |
| 966 | std::uint64_t done = 0; | 1029 | return retire_tickets_.completed([this](VkSemaphore semaphore, std::uint64_t value) { |
| 967 | vk.vkGetSemaphoreCounterValue(device_, retire_timeline_, &done); | 1030 | std::uint64_t done = 0; |
| 968 | return done; | 1031 | return vk.vkGetSemaphoreCounterValue(device_, semaphore, &done) == VK_SUCCESS && done >= value; |
| 1032 | }); | ||
| 969 | } | 1033 | } |
| 970 | 1034 | ||
| 971 | void drain_deleted_resources(std::uint64_t current_ticket) { | 1035 | void drain_deleted_resources(std::uint64_t current_ticket) { |
| 972 | deletion_queue_.drain(current_ticket, device_, vk); | 1036 | deletion_queue_.drain(current_ticket, device_, vk); |
| 973 | } | 1037 | } |
| 974 | 1038 | ||
| 975 | VkSemaphore retire_timeline() const noexcept { return retire_timeline_; } | 1039 | // Both methods are called with submit_mutex_ held. A queue's own progress timeline is |
| 976 | std::uint64_t advance_retire_ticket() noexcept { | 1040 | // monotonic even when another queue completes first; global tickets are retired in order. |
| 977 | return submitted_ticket_.fetch_add(1, std::memory_order_acq_rel) + 1; | 1041 | void record_submit_locked(VkSemaphore progress, std::uint64_t value) { |
| 1042 | const auto ticket = submitted_ticket_.fetch_add(1, std::memory_order_acq_rel) + 1; | ||
| 1043 | retire_tickets_.record(ticket, progress, value); | ||
| 1044 | } | ||
| 1045 | void retire_queue_idle_locked(VkSemaphore progress) { | ||
| 1046 | retire_tickets_.queue_idle(progress); | ||
| 978 | } | 1047 | } |
| 979 | 1048 | ||
| 980 | VulkanDeviceFunctions vk; | 1049 | VulkanDeviceFunctions vk; |
| @@ -1033,12 +1102,13 @@ private: | |||
| 1033 | VkDevice device_; | 1102 | VkDevice device_; |
| 1034 | bool loaded_ = false; | 1103 | bool loaded_ = false; |
| 1035 | bool ray_tracing_ = false; | 1104 | bool ray_tracing_ = false; |
| 1105 | std::unique_ptr<XdxrBuilder> xdxr_; // set: acceleration structures are XDXR BVH4 records | ||
| 1036 | std::atomic<bool> device_lost_{false}; | 1106 | std::atomic<bool> device_lost_{false}; |
| 1037 | alignas(64) std::shared_mutex resource_mutex_; // shared for prepare lookups, unique for add/remove | 1107 | alignas(64) std::shared_mutex resource_mutex_; // shared for prepare lookups, unique for add/remove |
| 1038 | alignas(64) std::mutex tracker_mutex_; | 1108 | alignas(64) std::mutex tracker_mutex_; |
| 1039 | alignas(64) std::mutex views_mutex_; | 1109 | alignas(64) std::mutex views_mutex_; |
| 1040 | alignas(64) std::mutex submit_mutex_; | 1110 | alignas(64) std::mutex submit_mutex_; |
| 1041 | VkSemaphore retire_timeline_ = VK_NULL_HANDLE; | 1111 | RetireTickets<VkSemaphore> retire_tickets_; |
| 1042 | std::atomic<std::uint64_t> submitted_ticket_{0}; | 1112 | std::atomic<std::uint64_t> submitted_ticket_{0}; |
| 1043 | DeferredDeletionQueue deletion_queue_; | 1113 | DeferredDeletionQueue deletion_queue_; |
| 1044 | std::unique_ptr<FenceWaitDispatcher> fence_dispatcher_; | 1114 | std::unique_ptr<FenceWaitDispatcher> fence_dispatcher_; |
| @@ -1153,6 +1223,7 @@ public: | |||
| 1153 | std::lock_guard lock(context_.submit_mutex()); | 1223 | std::lock_guard lock(context_.submit_mutex()); |
| 1154 | for (; open_labels_; --open_labels_) context_.labels_.queue_end(queue_); | 1224 | for (; open_labels_; --open_labels_) context_.labels_.queue_end(queue_); |
| 1155 | vk.vkQueueWaitIdle(queue_); | 1225 | vk.vkQueueWaitIdle(queue_); |
| 1226 | if (progress_) context_.retire_queue_idle_locked(progress_); | ||
| 1156 | } | 1227 | } |
| 1157 | if (progress_) { | 1228 | if (progress_) { |
| 1158 | std::lock_guard lock(context_.tracker_mutex_); | 1229 | std::lock_guard lock(context_.tracker_mutex_); |
| @@ -1495,14 +1566,9 @@ private: | |||
| 1495 | VkResult res = VK_SUCCESS; | 1566 | VkResult res = VK_SUCCESS; |
| 1496 | { | 1567 | { |
| 1497 | std::lock_guard lock(context_.submit_mutex()); | 1568 | std::lock_guard lock(context_.submit_mutex()); |
| 1498 | VkSemaphore signals[3]{progress_, VK_NULL_HANDLE, VK_NULL_HANDLE}; | 1569 | VkSemaphore signals[2]{progress_, VK_NULL_HANDLE}; |
| 1499 | std::uint64_t signal_values[3]{ticket, 0, 0}; | 1570 | std::uint64_t signal_values[2]{ticket, 0}; |
| 1500 | std::uint32_t signal_count = 1; | 1571 | std::uint32_t signal_count = 1; |
| 1501 | if (context_.retire_timeline()) { | ||
| 1502 | signals[signal_count] = context_.retire_timeline(); | ||
| 1503 | signal_values[signal_count] = context_.advance_retire_ticket(); | ||
| 1504 | ++signal_count; | ||
| 1505 | } | ||
| 1506 | if (fence) { | 1572 | if (fence) { |
| 1507 | signals[signal_count] = fence; | 1573 | signals[signal_count] = fence; |
| 1508 | signal_values[signal_count] = value; | 1574 | signal_values[signal_count] = value; |
| @@ -1522,6 +1588,7 @@ private: | |||
| 1522 | submit.signalSemaphoreCount = signal_count; | 1588 | submit.signalSemaphoreCount = signal_count; |
| 1523 | submit.pSignalSemaphores = signals; | 1589 | submit.pSignalSemaphores = signals; |
| 1524 | res = context_.vk.vkQueueSubmit(queue_, 1, &submit, VK_NULL_HANDLE); | 1590 | res = context_.vk.vkQueueSubmit(queue_, 1, &submit, VK_NULL_HANDLE); |
| 1591 | if (res == VK_SUCCESS) context_.record_submit_locked(progress_, ticket); | ||
| 1525 | } | 1592 | } |
| 1526 | if (res == VK_ERROR_DEVICE_LOST) { | 1593 | if (res == VK_ERROR_DEVICE_LOST) { |
| 1527 | context_.mark_device_lost(); | 1594 | context_.mark_device_lost(); |