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:
authorRafael <rafaelalvesp2005@gmail.com>2026-11-23 15:36:26 -0300
committerRafael <rafaelalvesp2005@gmail.com>2026-11-23 15:36:26 -0300
commit63f0e0dea3a9d44201db408c4e2c3f2f5b2b94d6 (patch)
tree86f0dcad8070e2a3a693ef4897aa83950cfeb224 /runtime/src/vulkan_present.h
parentf78f7d6a2a9364cb128c03ac539fe540d5c70df1 (diff)
parent6dda0630bd6fc0514baadb94fb98e36bd7d64c0b (diff)
Merge main into fix/walk-bink_names
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/vulkan_present.h')
-rw-r--r--runtime/src/vulkan_present.h183
1 files changed, 171 insertions, 12 deletions
diff --git a/runtime/src/vulkan_present.h b/runtime/src/vulkan_present.h
index a29cce3fa..8644346c5 100644
--- a/runtime/src/vulkan_present.h
+++ b/runtime/src/vulkan_present.h
@@ -35,13 +35,18 @@
35 35
36#include <algorithm> 36#include <algorithm>
37#include <array> 37#include <array>
38#include <atomic>
39#include <chrono>
38#include <cmath> 40#include <cmath>
39#include <cstdint> 41#include <cstdint>
40#include <cstdio> 42#include <cstdio>
41#include <cstring> 43#include <cstring>
42#include <functional> 44#include <functional>
43#include <map> 45#include <map>
46#include <deque>
44#include <memory> 47#include <memory>
48#include <mutex>
49#include <thread>
45#include <vector> 50#include <vector>
46 51
47namespace leonida { 52namespace leonida {
@@ -104,9 +109,11 @@ public:
104 VulkanPresenter(VulkanContext& context, PFN_vkGetInstanceProcAddr get_instance, VkInstance instance, 109 VulkanPresenter(VulkanContext& context, PFN_vkGetInstanceProcAddr get_instance, VkInstance instance,
105 VkPhysicalDevice physical, VkQueue queue, std::uint32_t family, VkSurfaceKHR surface, 110 VkPhysicalDevice physical, VkQueue queue, std::uint32_t family, VkSurfaceKHR surface,
106 bool swapchain_maintenance1 = false, 111 bool swapchain_maintenance1 = false,
107 std::function<VkExtent2D()> extent_fn = nullptr) 112 std::function<VkExtent2D()> extent_fn = nullptr,
113 std::function<VkSurfaceKHR()> recreate_surface_fn = nullptr)
108 : context_(context), instance_(instance), physical_(physical), queue_(queue), surface_(surface), 114 : context_(context), instance_(instance), physical_(physical), queue_(queue), surface_(surface),
109 maintenance1_(swapchain_maintenance1), extent_fn_(std::move(extent_fn)) { 115 maintenance1_(swapchain_maintenance1), extent_fn_(std::move(extent_fn)),
116 recreate_surface_fn_(std::move(recreate_surface_fn)) {
110#define LEONIDA_INSTANCE_FN(name) name##_ = reinterpret_cast<PFN_##name>(get_instance(instance, #name)); 117#define LEONIDA_INSTANCE_FN(name) name##_ = reinterpret_cast<PFN_##name>(get_instance(instance, #name));
111 LEONIDA_INSTANCE_FN(vkGetPhysicalDeviceSurfaceSupportKHR) 118 LEONIDA_INSTANCE_FN(vkGetPhysicalDeviceSurfaceSupportKHR)
112 LEONIDA_INSTANCE_FN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) 119 LEONIDA_INSTANCE_FN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR)
@@ -161,6 +168,7 @@ public:
161 } 168 }
162 169
163 ~VulkanPresenter() { 170 ~VulkanPresenter() {
171 context_.holds().cancel_after(this); // presents still queued behind held work are dropped
164 auto& vk = context_.vk; 172 auto& vk = context_.vk;
165 const VkDevice device = context_.device(); 173 const VkDevice device = context_.device();
166 { 174 {
@@ -186,7 +194,10 @@ public:
186 VulkanPresenter& operator=(const VulkanPresenter&) = delete; 194 VulkanPresenter& operator=(const VulkanPresenter&) = delete;
187 195
188 bool ok() const { return ok_; } 196 bool ok() const { return ok_; }
189 VkExtent2D extent() const { return extent_; } 197 VkExtent2D extent() const {
198 const std::uint64_t packed = extent_packed_;
199 return {std::uint32_t(packed >> 32), std::uint32_t(packed)};
200 }
190 VkFormat format() const { return format_; } 201 VkFormat format() const { return format_; }
191 std::uint64_t presented() const { return presented_; } 202 std::uint64_t presented() const { return presented_; }
192 // The present mode a tearing present uses (IMMEDIATE, else FIFO_RELAXED) while the current swapchain was created 203 // The present mode a tearing present uses (IMMEDIATE, else FIFO_RELAXED) while the current swapchain was created
@@ -194,6 +205,7 @@ public:
194 VkPresentModeKHR tear_mode() const { return tear_mode_; } 205 VkPresentModeKHR tear_mode() const { return tear_mode_; }
195 bool tear_supported() const { return tear_mode_ != VK_PRESENT_MODE_MAX_ENUM_KHR; } 206 bool tear_supported() const { return tear_mode_ != VK_PRESENT_MODE_MAX_ENUM_KHR; }
196 // Whether the last present was queued in the tearing mode, and how many were. 207 // Whether the last present was queued in the tearing mode, and how many were.
208 // A present queued behind held work (see submit()) is reported as not tearing.
197 bool last_present_tore() const { return last_tore_; } 209 bool last_present_tore() const { return last_tore_; }
198 std::uint64_t tear_presents() const { return tear_presents_; } 210 std::uint64_t tear_presents() const { return tear_presents_; }
199 211
@@ -279,7 +291,10 @@ public:
279 291
280 // Polled while a present waits for a swapchain image (every 50 ms): when it returns true the present gives up with 292 // Polled while a present waits for a swapchain image (every 50 ms): when it returns true the present gives up with
281 // VK_NOT_READY, so a caller that is being suspended is never held by a window that stopped taking frames. 293 // VK_NOT_READY, so a caller that is being suspended is never held by a window that stopped taking frames.
282 void set_abort(std::function<bool()> abort) { abort_ = std::move(abort); } 294 void set_abort(std::function<bool()> abort) {
295 std::lock_guard lock(abort_mutex_);
296 abort_ = std::move(abort);
297 }
283 298
284 // Presents a black frame: the swapchain image cleared, nothing read. PresentX with no planes. 299 // Presents a black frame: the swapchain image cleared, nothing read. PresentX with no planes.
285 VkResult present_blank(bool vsync, bool tear = false) { 300 VkResult present_blank(bool vsync, bool tear = false) {
@@ -290,6 +305,7 @@ public:
290 // read_back(). False when the surface cannot do it or its format is not 8 bits per channel with 4 channels. 305 // read_back(). False when the surface cannot do it or its format is not 8 bits per channel with 4 channels.
291 // Call before the first present. 306 // Call before the first present.
292 bool enable_capture() { 307 bool enable_capture() {
308 std::lock_guard lock(present_mutex_);
293 if (!ok_) return false; 309 if (!ok_) return false;
294 capture_ = true; 310 capture_ = true;
295 stale_ = true; 311 stale_ = true;
@@ -305,6 +321,7 @@ public:
305 // that was skipped because the window is minimised (it returned VK_SUCCESS but showed nothing), until the next 321 // that was skipped because the window is minimised (it returned VK_SUCCESS but showed nothing), until the next
306 // frame that is shown (the frame before it is not what the window was last asked to show), or when the wait fails. 322 // frame that is shown (the frame before it is not what the window was last asked to show), or when the wait fails.
307 bool read_back(std::vector<std::uint8_t>& pixels, VkExtent2D* extent, VkFormat* format) { 323 bool read_back(std::vector<std::uint8_t>& pixels, VkExtent2D* extent, VkFormat* format) {
324 std::lock_guard lock(present_mutex_);
308 if (!capture_ || !capture_ptr_ || !captured_) return false; 325 if (!capture_ || !capture_ptr_ || !captured_) return false;
309 const Frame& frame = frames_[(frame_index_ + frames_.size() - 1) % frames_.size()]; 326 const Frame& frame = frames_[(frame_index_ + frames_.size() - 1) % frames_.size()];
310 if (vkWaitForFences_(context_.device(), 1, &frame.done, VK_TRUE, UINT64_MAX) != VK_SUCCESS) 327 if (vkWaitForFences_(context_.device(), 1, &frame.done, VK_TRUE, UINT64_MAX) != VK_SUCCESS)
@@ -315,12 +332,109 @@ public:
315 return true; 332 return true;
316 } 333 }
317 334
318 // Shared by present(), present_blank() and present_planes(). `binding` null and `planes` null: clear instead of blit; 335 // Shared by present(), present_blank() and present_planes().
319 // `planes`: compose them (`binding`, `source`, `source_rect` unused). 336 //
337 // A Present is ordered behind the work the queues hold (a batch that waits for a Signal not yet submitted,
338 // queue_holds.h): it would otherwise blit whatever the source texture held before that batch ran. It is not
339 // blocked: it is queued, returns VK_SUCCESS as ExecuteCommandLists does for a held batch, and is submitted,
340 // in order with the presents before it, by the thread that releases the last operation held when it was called
341 // (its failure is printed there). Held work that is never released holds back the presents after it, as it
342 // holds back the queue's own work; with nothing held this is the plain path. A blank present reads nothing and
343 // is only ordered behind earlier presents. Waiting instead was rejected: the Signal that releases the work may
344 // be one the application's own thread makes after Present returns. Like a full frame-latency queue, a Present that
345 // finds max_deferred_presents queued ahead of it does wait, for held work to release (logged once; set_abort ends
346 // the wait), so the queue behind never-released work is bounded. A queued Present reports its tear as false
347 // (last_present_tore()): the frame pacer's default sync.
348 static constexpr std::size_t max_deferred_presents = 8;
349
320 VkResult submit(const ResourceBinding* binding, ResourceId source, bool vsync, const PresentRect* source_rect, 350 VkResult submit(const ResourceBinding* binding, ResourceId source, bool vsync, const PresentRect* source_rect,
321 bool srgb, bool tear = false, const PresentPlanes* planes = nullptr) { 351 bool srgb, bool tear = false, const PresentPlanes* planes = nullptr) {
352 wait_for_room();
353 std::lock_guard lock(present_mutex_);
354 // `binding` null and `planes` null: clear instead of blit; `planes`: compose them (`binding`, `source`,
355 // `source_rect` unused). Only a present that reads a texture waits for held work.
356 if (deferred_.empty() && !((binding || planes) && context_.holds().any_held()))
357 return submit_now(binding, source, vsync, source_rect, srgb, tear, planes);
358 PendingPresent pending{binding != nullptr, source, vsync, source_rect != nullptr, {}, srgb, tear,
359 planes != nullptr, {}};
360 if (source_rect) pending.rect = *source_rect;
361 if (planes) pending.planes = *planes;
362 deferred_.push_back(pending);
363 last_tore_ = false;
364 context_.holds().after_held(this, [this] { run_deferred(); });
365 return VK_SUCCESS;
366 }
367
368private:
369 bool should_abort() {
370 std::function<bool()> abort;
371 {
372 std::lock_guard lock(abort_mutex_);
373 abort = abort_;
374 }
375 return abort && abort();
376 }
377
378 // Called without present_mutex_: the thread that releases the queued presents needs it.
379 void wait_for_room() {
380 bool logged = false;
381 for (;;) {
382 {
383 std::lock_guard lock(present_mutex_);
384 if (deferred_.size() < max_deferred_presents) return;
385 }
386 if (!logged) {
387 logged = true;
388 std::fprintf(stderr, "[rt] d3d12: %zu Presents are queued behind held work; this one waits for it\n",
389 max_deferred_presents);
390 }
391 if (should_abort()) return;
392 std::this_thread::sleep_for(std::chrono::milliseconds(1));
393 }
394 }
395
396 struct PendingPresent {
397 bool has_source;
398 ResourceId source;
399 bool vsync;
400 bool has_rect;
401 PresentRect rect;
402 bool srgb;
403 bool tear;
404 bool has_planes;
405 PresentPlanes planes;
406 };
407
408 void run_deferred() {
409 std::lock_guard lock(present_mutex_);
410 if (deferred_.empty()) return;
411 const PendingPresent p = deferred_.front();
412 deferred_.pop_front();
413 ResourceBinding binding{};
414 const VkResult result = submit_now(p.has_source ? &binding : nullptr, p.source, p.vsync,
415 p.has_rect ? &p.rect : nullptr, p.srgb, p.tear,
416 p.has_planes ? &p.planes : nullptr);
417 if (result != VK_SUCCESS)
418 std::fprintf(stderr, "[rt] d3d12: a Present held behind queued work failed when it was released (%d)\n",
419 int(result));
420 }
421
422 VkResult submit_now(const ResourceBinding* binding, ResourceId source, bool vsync, const PresentRect* source_rect,
423 bool srgb, bool tear = false, const PresentPlanes* planes = nullptr) {
322 last_tore_ = false; 424 last_tore_ = false;
323 if (!ok_) return VK_ERROR_INITIALIZATION_FAILED; 425 if (!ok_) return VK_ERROR_INITIALIZATION_FAILED;
426 if (surface_lost_) { // the window's display went away under a presented swapchain
427 // Try to make a new surface for the same window (the hwnd is retained by the factory's callback).
428 // Until that succeeds, vkd3d's precedent keeps rendering to nothing: the frame is not shown, but
429 // the run continues instead of wedging on a sticky E_FAIL.
430 surface_ = recreate_surface_fn_ ? recreate_surface_fn_() : VK_NULL_HANDLE;
431 if (!surface_) {
432 captured_ = false; // nothing was shown: read_back() must not hand out the frame
433 return VK_SUCCESS;
434 }
435 surface_lost_ = false;
436 stale_ = true; // the old swapchain is gone: rebuild on the new surface below
437 }
324 // The swapchain's HDR10 format is only for composed planes that ask for it; a blit of an SDR source or a blank 438 // The swapchain's HDR10 format is only for composed planes that ask for it; a blit of an SDR source or a blank
325 // frame keeps whatever the swapchain has (black is black), except that a blit needs the SDR one. 439 // frame keeps whatever the swapchain has (black is black), except that a blit needs the SDR one.
326 bool want_hdr = swapchain_hdr_req_; 440 bool want_hdr = swapchain_hdr_req_;
@@ -358,6 +472,11 @@ public:
358 } 472 }
359 acquired = acquire(frame.acquired, &image); 473 acquired = acquire(frame.acquired, &image);
360 } 474 }
475 if (acquired == VK_ERROR_SURFACE_LOST_KHR) {
476 captured_ = false; // nothing was acquired, nothing was shown
477 mark_surface_lost();
478 return VK_SUCCESS;
479 }
361 if (acquired != VK_SUCCESS && acquired != VK_SUBOPTIMAL_KHR) return acquired; // nothing was acquired 480 if (acquired != VK_SUCCESS && acquired != VK_SUBOPTIMAL_KHR) return acquired; // nothing was acquired
362 if (acquired == VK_SUBOPTIMAL_KHR) stale_ = true; 481 if (acquired == VK_SUBOPTIMAL_KHR) stale_ = true;
363 // An out-of-date retry above may have given the swapchain another extent: the compose target follows it. 482 // An out-of-date retry above may have given the swapchain another extent: the compose target follows it.
@@ -476,6 +595,13 @@ public:
476 captured_extent_ = extent_; 595 captured_extent_ = extent_;
477 captured_format_ = format_; 596 captured_format_ = format_;
478 } 597 }
598 if (result == VK_ERROR_SURFACE_LOST_KHR) {
599 // The surface was lost during the present (display disconnected, a driver reset of the window's
600 // plane): vkd3d keeps rendering to nothing, and the next present recreates surface and swapchain.
601 captured_ = false;
602 mark_surface_lost();
603 result = VK_SUCCESS;
604 }
479 if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR) { 605 if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR) {
480 stale_ = true; 606 stale_ = true;
481 result = VK_SUCCESS; 607 result = VK_SUCCESS;
@@ -535,6 +661,25 @@ private:
535 return failure; 661 return failure;
536 } 662 }
537 663
664 // The window's surface is dead (VK_ERROR_SURFACE_LOST_KHR): the swapchain that presented into it is retired
665 // and the surface destroyed. The next submit_now() first tries the factory's recreate-surface callback; until
666 // it succeeds the presenter keeps the vkd3d "render to nothing" behaviour, not a sticky failure.
667 void mark_surface_lost() {
668 auto& vk = context_.vk;
669 const VkDevice device = context_.device();
670 {
671 std::lock_guard lock(context_.submit_mutex());
672 vk.vkQueueWaitIdle(queue_); // the old swapchain's images and semaphores may still be in use
673 release(swapchain_);
674 }
675 swapchain_ = VK_NULL_HANDLE;
676 if (surface_ && vkDestroySurfaceKHR_) vkDestroySurfaceKHR_(instance_, surface_, nullptr);
677 surface_ = VK_NULL_HANDLE;
678 surface_lost_ = true;
679 stale_ = true;
680 captured_ = false;
681 }
682
538 void record(VkCommandBuffer commands, const ResourceBinding& binding, ResourceId source, std::uint32_t image, 683 void record(VkCommandBuffer commands, const ResourceBinding& binding, ResourceId source, std::uint32_t image,
539 const PresentRect* source_rect) { 684 const PresentRect* source_rect) {
540 auto& vk = context_.vk; 685 auto& vk = context_.vk;
@@ -741,7 +886,7 @@ private:
741 const VkResult result = vkAcquireNextImageKHR_(context_.device(), swapchain_, 50'000'000, semaphore, 886 const VkResult result = vkAcquireNextImageKHR_(context_.device(), swapchain_, 50'000'000, semaphore,
742 VK_NULL_HANDLE, image); 887 VK_NULL_HANDLE, image);
743 if (result != VK_TIMEOUT && result != VK_NOT_READY) return result; 888 if (result != VK_TIMEOUT && result != VK_NOT_READY) return result;
744 if (abort_ && abort_()) return VK_NOT_READY; 889 if (should_abort()) return VK_NOT_READY;
745 } 890 }
746 } 891 }
747 892
@@ -896,6 +1041,13 @@ private:
896 VkImageUsageFlags usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT; 1041 VkImageUsageFlags usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT;
897 if (capture_) usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; 1042 if (capture_) usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
898 if ((caps.supportedUsageFlags & usage) != usage) return false; 1043 if ((caps.supportedUsageFlags & usage) != usage) return false;
1044 // Not used by the presenter itself (it blits or copies into the images), but overlays that hook the swapchain
1045 // draw their own frame into its images through a framebuffer, which needs COLOR_ATTACHMENT: without it
1046 // Bandicam's VK_LAYER_bandicam_helper builds framebuffers and image views on images that don't allow it
1047 // (VUID-VkFramebufferCreateInfo-pAttachments-00877, VUID-VkImageViewCreateInfo-image-04441). The surface
1048 // reports it for every swapchain (the spec requires it in supportedUsageFlags), and the DXGI swapchain
1049 // (dxgi_swapchain.h) already asks for it.
1050 if (caps.supportedUsageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
899 1051
900 std::uint32_t count = 0; 1052 std::uint32_t count = 0;
901 if (vkGetPhysicalDeviceSurfaceFormatsKHR_(physical_, surface_, &count, nullptr) != VK_SUCCESS || !count) 1053 if (vkGetPhysicalDeviceSurfaceFormatsKHR_(physical_, surface_, &count, nullptr) != VK_SUCCESS || !count)
@@ -1029,6 +1181,7 @@ private:
1029 ready_ = std::move(ready); 1181 ready_ = std::move(ready);
1030 format_ = chosen.format; 1182 format_ = chosen.format;
1031 extent_ = extent; 1183 extent_ = extent;
1184 extent_packed_ = (std::uint64_t(extent.width) << 32) | extent.height;
1032 hdr_active_ = chose_hdr; 1185 hdr_active_ = chose_hdr;
1033 if (capture_) { 1186 if (capture_) {
1034 // A capture that cannot be made fails the recreation with the swapchain in place and stale_ still set. 1187 // A capture that cannot be made fails the recreation with the swapchain in place and stale_ still set.
@@ -1112,11 +1265,15 @@ private:
1112 VkInstance instance_; 1265 VkInstance instance_;
1113 VkPhysicalDevice physical_; 1266 VkPhysicalDevice physical_;
1114 VkQueue queue_; 1267 VkQueue queue_;
1268 mutable std::recursive_mutex present_mutex_; // all presenter state: submit(), a deferred present, the accessors
1269 mutable std::mutex abort_mutex_; // abort_ alone: set_abort() must work while a present waits
1270 std::deque<PendingPresent> deferred_; // presents queued behind held work, in call order
1115 VkSurfaceKHR surface_; 1271 VkSurfaceKHR surface_;
1116 bool maintenance1_ = false; // VK_KHR/EXT_swapchain_maintenance1 (and the surface extension) are enabled 1272 bool maintenance1_ = false; // VK_KHR/EXT_swapchain_maintenance1 (and the surface extension) are enabled
1117 VkPresentModeKHR tear_mode_ = VK_PRESENT_MODE_MAX_ENUM_KHR; // set with the swapchain, see tear_mode() 1273 VkPresentModeKHR tear_mode_ = VK_PRESENT_MODE_MAX_ENUM_KHR; // set with the swapchain, see tear_mode()
1118 bool last_tore_ = false; 1274 std::atomic<bool> last_tore_{false};
1119 std::uint64_t tear_presents_ = 0; 1275 std::atomic<std::uint64_t> extent_packed_{0}; // extent_ for readers that must not wait for a present
1276 std::atomic<std::uint64_t> tear_presents_{0};
1120 VkSwapchainKHR swapchain_ = VK_NULL_HANDLE; 1277 VkSwapchainKHR swapchain_ = VK_NULL_HANDLE;
1121 VkFormat format_ = VK_FORMAT_UNDEFINED; 1278 VkFormat format_ = VK_FORMAT_UNDEFINED;
1122 VkExtent2D extent_{}; 1279 VkExtent2D extent_{};
@@ -1125,19 +1282,21 @@ private:
1125 std::array<Frame, 2> frames_{}; 1282 std::array<Frame, 2> frames_{};
1126 VkCommandPool pool_ = VK_NULL_HANDLE; 1283 VkCommandPool pool_ = VK_NULL_HANDLE;
1127 std::uint64_t frame_index_ = 0; 1284 std::uint64_t frame_index_ = 0;
1128 std::uint64_t presented_ = 0; 1285 std::atomic<std::uint64_t> presented_{0};
1129 bool vsync_ = true; 1286 bool vsync_ = true;
1130 bool stale_ = false; 1287 bool stale_ = false;
1131 bool ok_ = false; 1288 bool ok_ = false;
1132 bool swapchain_srgb_ = false; // the swapchain format follows the source being presented (set once it exists) 1289 bool swapchain_srgb_ = false; // the swapchain format follows the source being presented (set once it exists)
1133 bool swapchain_hdr_req_ = false; // the swapchain was built for an HDR10 request (it has the format only if hdr_active_) 1290 bool swapchain_hdr_req_ = false; // the swapchain was built for an HDR10 request (it has the format only if hdr_active_)
1134 bool hdr_active_ = false; 1291 bool hdr_active_ = false;
1135 std::uint64_t composed_ = 0; 1292 std::atomic<std::uint64_t> composed_{0};
1136 bool force_hdr_encoding_ = false; 1293 std::atomic<bool> force_hdr_encoding_{false};
1137 bool warned_hdr_ = false; 1294 bool warned_hdr_ = false;
1138 std::unique_ptr<PresentComposer> composer_; 1295 std::unique_ptr<PresentComposer> composer_;
1139 std::function<bool()> abort_; 1296 std::function<bool()> abort_;
1140 std::function<VkExtent2D()> extent_fn_; 1297 std::function<VkExtent2D()> extent_fn_;
1298 std::function<VkSurfaceKHR()> recreate_surface_fn_; // makes a new Win32 surface for the same window
1299 bool surface_lost_ = false; // set by mark_surface_lost(); cleared once a new surface was created
1141 std::map<VkFormat, VkFormatFeatureFlags> features_; 1300 std::map<VkFormat, VkFormatFeatureFlags> features_;
1142 bool warned_srgb_ = false; 1301 bool warned_srgb_ = false;
1143 bool capture_ = false; 1302 bool capture_ = false;