upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/vulkan_backend.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index 03ab7ba26..97959be69 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -1500,6 +1500,10 @@ public:
1500 1500
1501 bool ok() const { return ok_; } 1501 bool ok() const { return ok_; }
1502 1502
1503 // Entries kept between executions. Execute only uses the first lists.size(); a larger count is retained storage,
1504 // not work the next submission will replay (vk_queue_test checks both halves of that contract).
1505 std::size_t prepared_entries() const { return prepared_.size(); }
1506
1503 template<typename GetHeap> 1507 template<typename GetHeap>
1504 bool update_tiles(ResourceId id, std::span<const BufferTileRegion> regions, 1508 bool update_tiles(ResourceId id, std::span<const BufferTileRegion> regions,
1505 std::span<const BufferTileRange> ranges, GetHeap&& get_heap) { 1509 std::span<const BufferTileRange> ranges, GetHeap&& get_heap) {
@@ -1679,7 +1683,10 @@ private:
1679 // Kept between executions: prepare refills each list's entries in the storage the last execution left, where 1683 // Kept between executions: prepare refills each list's entries in the storage the last execution left, where
1680 // making them fresh for every command was about half the layer's CPU cost per command (replay_cpu_bench). 1684 // making them fresh for every command was about half the layer's CPU cost per command (replay_cpu_bench).
1681 auto& prepared = prepared_; 1685 auto& prepared = prepared_;
1682 prepared.resize(lists.size()); 1686 // Keep the storage from a larger batch. resize() down would destroy the unused entries and their vectors, so
1687 // a queue that sees 8 lists and then 1 in every frame would rebuild them on each execution. The loops below
1688 // use only the first lists.size() entries, so stale entries are never prepared, queried or emitted.
1689 if (prepared.size() < lists.size()) prepared.resize(lists.size());
1683 ReplayFunctions replay = context_.replay_; 1690 ReplayFunctions replay = context_.replay_;
1684 replay.queue_stages = kind_ == QueueKind::copy ? detail::queue_stages_copy 1691 replay.queue_stages = kind_ == QueueKind::copy ? detail::queue_stages_copy
1685 : kind_ == QueueKind::compute ? detail::queue_stages_compute 1692 : kind_ == QueueKind::compute ? detail::queue_stages_compute
@@ -1797,7 +1804,8 @@ private:
1797 if (has_queries && !tracker_lock.owns_lock()) tracker_lock.lock(); 1804 if (has_queries && !tracker_lock.owns_lock()) tracker_lock.lock();
1798 QueryReplay queries; 1805 QueryReplay queries;
1799 std::uint32_t base = 0, statistics_base = 0; 1806 std::uint32_t base = 0, statistics_base = 0;
1800 for (auto& list : prepared) { 1807 for (std::size_t i = 0; i < lists.size(); ++i) {
1808 auto& list = prepared[i];
1801 const auto result = queries.plan(list, physical, base, can_resolve_occlusion, statistics, statistics_base); 1809 const auto result = queries.plan(list, physical, base, can_resolve_occlusion, statistics, statistics_base);
1802 if (result != ReplayResult::success) return result; 1810 if (result != ReplayResult::success) return result;
1803 base += list.segment_count; 1811 base += list.segment_count;
@@ -1893,7 +1901,8 @@ private:
1893 bool wrote_readback = false; 1901 bool wrote_readback = false;
1894 VkPipelineStageFlags2 readback_stages = 0; 1902 VkPipelineStageFlags2 readback_stages = 0;
1895 std::uint32_t open_labels = 0; // events may span the lists of one ExecuteCommandLists 1903 std::uint32_t open_labels = 0; // events may span the lists of one ExecuteCommandLists
1896 for (const auto& list : prepared) { 1904 for (std::size_t i = 0; i < lists.size(); ++i) {
1905 const auto& list = prepared[i];
1897 emit(list, command_buffer, replay, &next_tracker, &open_labels); 1906 emit(list, command_buffer, replay, &next_tracker, &open_labels);
1898 wrote_readback |= list.wrote_readback; 1907 wrote_readback |= list.wrote_readback;
1899 readback_stages |= list.readback_src_stages; 1908 readback_stages |= list.readback_src_stages;