Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: gpu/vulkan/vulkan_swap_chain.h

Issue 1776453003: Added initial implementation of Vulkan Render Passes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn_vulkan
Patch Set: Fix SwapBuffers() present layout, test in unittests instead of injections Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698