| 654 | } |
| 655 | |
| 656 | void VulkanContext::notifyFramebufferResized(const int width, |
| 657 | const int height, |
| 658 | const ResizeIntent intent) { |
| 659 | const bool exact_resize = intent == ResizeIntent::Exact; |
| 660 | const bool exact_extent_mismatch = |
| 661 | exact_resize && |
| 662 | swapchain_ != VK_NULL_HANDLE && |
| 663 | width > 0 && |
| 664 | height > 0 && |
| 665 | (static_cast<std::uint32_t>(width) != swapchain_extent_.width || |
| 666 | static_cast<std::uint32_t>(height) != swapchain_extent_.height); |
| 667 | if (width == framebuffer_width_ && height == framebuffer_height_ && |
| 668 | !exact_extent_mismatch) { |
| 669 | return; |
| 670 | } |
| 671 | framebuffer_width_ = width; |
| 672 | framebuffer_height_ = height; |
| 673 | framebuffer_resize_allow_headroom_ = !exact_resize; |
| 674 | if (width <= 0 || height <= 0) { |
| 675 | framebuffer_resize_deferred_ = false; |
| 676 | framebuffer_resize_requires_recreate_ = false; |
| 677 | framebuffer_resize_allow_headroom_ = false; |
| 678 | framebuffer_resize_exact_after_headroom_ = false; |
| 679 | framebuffer_resized_ = true; |
| 680 | return; |
| 681 | } |
| 682 | |
| 683 | framebuffer_resize_exact_after_headroom_ = !exact_resize; |
| 684 | const bool requires_recreate = |
| 685 | framebufferResizeRequiresSwapchainRecreate() || exact_extent_mismatch; |
| 686 | if (requires_recreate) { |
| 687 | deferSwapchainResizeRecreate(requires_recreate, framebuffer_resize_allow_headroom_); |
| 688 | } else { |
| 689 | framebuffer_resize_deferred_ = false; |
| 690 | framebuffer_resize_requires_recreate_ = false; |
| 691 | framebuffer_resize_last_change_ = std::chrono::steady_clock::now(); |
| 692 | last_error_.clear(); |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | bool VulkanContext::presentBootstrapFrame(const float r, const float g, const float b, const float a) { |
| 697 | VkClearValue clear_value{}; |