diff options
| author | AlxcBTW <187763517+AlxcBTW@users.noreply.github.com> | 2026-11-22 19:22:39 +0100 |
|---|---|---|
| committer | AlxcBTW <187763517+AlxcBTW@users.noreply.github.com> | 2026-11-22 19:22:39 +0100 |
| commit | 2e5c9a9c4368e8ee339d9b13ee42e6b156093fd4 (patch) | |
| tree | f9c9550824e59fb93fc5c80fc6fcf3aeace4e630 /runtime/src/vulkan_present.h | |
| parent | fbc11e973d5a1de721f8b70cd5721a8fe709fc3c (diff) | |
| parent | ec8ec4c9a46c6623f1a9c125afd3566da97f1e0c (diff) | |
Merge remote-tracking branch 'origin/main' into queue-wait-before-signal
Diffstat (limited to 'runtime/src/vulkan_present.h')
| -rw-r--r-- | runtime/src/vulkan_present.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/src/vulkan_present.h b/runtime/src/vulkan_present.h index 15a706668..9a73d2f82 100644 --- a/runtime/src/vulkan_present.h +++ b/runtime/src/vulkan_present.h | |||
| @@ -224,11 +224,12 @@ public: | |||
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | // The last presented frame as the swapchain stores it (4 bytes a texel, rows tightly packed, format() order). | 226 | // The last presented frame as the swapchain stores it (4 bytes a texel, rows tightly packed, format() order). |
| 227 | // Waits for the frame to finish. False when nothing was presented since enable_capture(). | 227 | // Waits for the frame to finish. False if no captured frame is available or the wait fails. |
| 228 | bool read_back(std::vector<std::uint8_t>& pixels, VkExtent2D* extent, VkFormat* format) { | 228 | bool read_back(std::vector<std::uint8_t>& pixels, VkExtent2D* extent, VkFormat* format) { |
| 229 | if (!capture_ || !capture_ptr_ || !captured_) return false; | 229 | if (!capture_ || !capture_ptr_ || !captured_) return false; |
| 230 | const Frame& frame = frames_[(frame_index_ + frames_.size() - 1) % frames_.size()]; | 230 | const Frame& frame = frames_[(frame_index_ + frames_.size() - 1) % frames_.size()]; |
| 231 | vkWaitForFences_(context_.device(), 1, &frame.done, VK_TRUE, UINT64_MAX); | 231 | if (vkWaitForFences_(context_.device(), 1, &frame.done, VK_TRUE, UINT64_MAX) != VK_SUCCESS) |
| 232 | return false; | ||
| 232 | pixels.assign(capture_ptr_, capture_ptr_ + std::size_t(captured_extent_.width) * captured_extent_.height * 4); | 233 | pixels.assign(capture_ptr_, capture_ptr_ + std::size_t(captured_extent_.width) * captured_extent_.height * 4); |
| 233 | if (extent) *extent = captured_extent_; | 234 | if (extent) *extent = captured_extent_; |
| 234 | if (format) *format = captured_format_; | 235 | if (format) *format = captured_format_; |