Index: gpu/vulkan/vulkan_swap_chain.h |
diff --git a/gpu/vulkan/vulkan_swap_chain.h b/gpu/vulkan/vulkan_swap_chain.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1596f6744f9e92225232d8ba109bfa94187acccd |
--- /dev/null |
+++ b/gpu/vulkan/vulkan_swap_chain.h |
@@ -0,0 +1,70 @@ |
+// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef GPU_VULKAN_VULKAN_SWAP_CHAIN_H_ |
+#define GPU_VULKAN_VULKAN_SWAP_CHAIN_H_ |
+ |
+#include <vector> |
+#include <vulkan/vulkan.h> |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "ui/gfx/swap_result.h" |
+ |
+namespace gpu { |
+ |
+class VulkanCommandBuffer; |
+class VulkanCommandPool; |
+ |
+class VulkanSwapChain { |
+ public: |
+ VulkanSwapChain(); |
+ ~VulkanSwapChain(); |
+ |
+ bool Initialize(VkSurfaceKHR surface, |
+ const VkSurfaceCapabilitiesKHR& surface_caps, |
+ const VkSurfaceFormatKHR& surface_format); |
+ void Destroy(); |
+ |
+ gfx::SwapResult SwapBuffers(); |
+ |
+ private: |
+ bool InitializeSwapChain(VkSurfaceKHR surface, |
+ const VkSurfaceCapabilitiesKHR& surface_caps, |
+ const VkSurfaceFormatKHR& surface_format); |
+ void DestroySwapChain(); |
+ |
+ bool InitializeImageLayoutCommandBuffer(); |
+ void DestroyImageLayoutCommandBuffer(); |
+ |
+ bool InitializeSwapImages(const VkSurfaceCapabilitiesKHR& surface_caps, |
+ const VkSurfaceFormatKHR& surface_format); |
+ void DestroySwapImages(); |
+ |
+ bool InitializeInitialBuffer(); |
+ |
+ VkSwapchainKHR swap_chain_ = VK_NULL_HANDLE; |
+ |
+ scoped_ptr<VulkanCommandPool> command_pool_; |
+ scoped_ptr<VulkanCommandBuffer> image_layout_command_buffer_; |
+ |
+ struct ImageData { |
+ ImageData(); |
+ ~ImageData(); |
+ |
+ VkImage image = VK_NULL_HANDLE; |
+ VkImageView image_view = VK_NULL_HANDLE; |
+ scoped_ptr<VulkanCommandBuffer> command_buffer; |
+ |
+ VkSemaphore render_layout_semaphore = VK_NULL_HANDLE; |
+ VkSemaphore render_semaphore = VK_NULL_HANDLE; |
+ VkSemaphore present_layout_semaphore = VK_NULL_HANDLE; |
+ VkSemaphore present_semaphore = VK_NULL_HANDLE; |
+ }; |
+ std::vector<scoped_ptr<ImageData>> images_; |
+ uint32_t current_image_ = 0; |
+}; |
+ |
+} // namespace gpu |
+ |
+#endif // GPU_VULKAN_VULKAN_SWAP_CHAIN_H_ |