Recreate swap chain on window resize.

This commit is contained in:
Ben Vanik
2016-02-17 19:43:42 -08:00
parent a97fa36512
commit ca5902c111
3 changed files with 61 additions and 25 deletions

View File

@@ -41,7 +41,12 @@ class VulkanSwapChain {
// Render command buffer, active inside the render pass from Begin to End.
VkCommandBuffer render_cmd_buffer() const { return render_cmd_buffer_; }
// Initializes the swap chain with the given WSI surface.
bool Initialize(VkSurfaceKHR surface);
// Reinitializes the swap chain with the initial surface.
// The surface will be retained but all other swap chain resources will be
// torn down and recreated with the new surface properties (size/etc).
bool Reinitialize();
// Begins the swap operation, preparing state for rendering.
bool Begin();
@@ -58,6 +63,9 @@ class VulkanSwapChain {
bool InitializeBuffer(Buffer* buffer, VkImage target_image);
void DestroyBuffer(Buffer* buffer);
// Safely releases all swap chain resources.
void Shutdown();
VulkanInstance* instance_ = nullptr;
VulkanDevice* device_ = nullptr;