diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 19:08:54 +0100 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 19:08:54 +0100 |
| commit | 3af42c619253941610d9809e8a28a07e8dfdfdf2 (patch) | |
| tree | a675793195f8bc69c3caebb0e9614ecfb65e1c4c /runtime/src/vulkan_present.h | |
| parent | e6af0a0931639ff33cdd4a28289da984f194c87e (diff) | |
| parent | ec8ec4c9a46c6623f1a9c125afd3566da97f1e0c (diff) | |
merge: preserve upstream changes alongside the asset fix
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_; |