upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_present.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src/vulkan_present.h')
-rw-r--r--runtime/src/vulkan_present.h5
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_;