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..b370ff25ba01f52780079a2bee55e629f440901d |
--- /dev/null |
+++ b/gpu/vulkan/vulkan_swap_chain.h |
@@ -0,0 +1,58 @@ |
+// 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 "gpu/vulkan/vulkan_command_buffer.h" |
+ |
+namespace gfx { |
+ |
+class VulkanSwapChain { |
+ public: |
+ VulkanSwapChain(); |
+ ~VulkanSwapChain(); |
+ |
+ bool Initialize(VkCommandBuffer command_buffer, |
+ VkSurfaceKHR surface, |
+ const VkSurfaceCapabilitiesKHR& surface_caps, |
+ const VkSurfaceFormatKHR& surface_format, |
+ const VkComponentMapping& view_mapping); |
+ void Destroy(); |
+ |
+ void SwapBuffers(); |
+ |
+ private: |
+ bool InitializeSwapChain(VkSurfaceKHR surface, |
+ const VkSurfaceCapabilitiesKHR& surface_caps, |
+ const VkSurfaceFormatKHR& surface_format); |
+ bool InitializeRenderPass(const VkSurfaceFormatKHR& surface_format); |
+ bool InitializeSwapBuffers(VkCommandBuffer command_buffer, |
+ const VkSurfaceCapabilitiesKHR& surface_caps, |
+ const VkSurfaceFormatKHR& surface_format, |
+ const VkComponentMapping& view_mapping); |
+ |
+ VkSwapchainKHR swap_chain_ = VK_NULL_HANDLE; |
+ VkRenderPass render_pass_ = VK_NULL_HANDLE; |
+ |
+ struct BufferData { |
+ BufferData(); |
+ ~BufferData(); |
+ |
+ VkImage image = VK_NULL_HANDLE; |
+ VkImageView image_view = VK_NULL_HANDLE; |
+ VkFramebuffer frame_buffer = VK_NULL_HANDLE; |
+ scoped_ptr<VulkanCommandBuffer> command_buffer; |
+ }; |
+ std::vector<scoped_ptr<BufferData>> buffers_; |
piman
2016/03/09 01:25:35
nit: "buffer" can be a bit confusing, because in V
David Yen
2016/03/10 01:39:49
Renamed to ImageData/images_. Done.
|
+ uint32_t current_buffer_ = 0; |
+}; |
+ |
+} // namespace gfx |
+ |
+#endif // GPU_VULKAN_VULKAN_SWAP_CHAIN_H_ |