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

Side by Side 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: rebase 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
6 #define GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
7
8 #include <vector>
9 #include <vulkan/vulkan.h>
10
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/swap_result.h"
13
14 namespace gpu {
15
16 class VulkanCommandBuffer;
17 class VulkanCommandPool;
18
19 class VulkanSwapChain {
20 public:
21 VulkanSwapChain();
22 ~VulkanSwapChain();
23
24 bool Initialize(VkSurfaceKHR surface,
25 const VkSurfaceCapabilitiesKHR& surface_caps,
26 const VkSurfaceFormatKHR& surface_format);
27 void Destroy();
28
29 gfx::SwapResult SwapBuffers();
30
31 private:
32 bool InitializeSwapChain(VkSurfaceKHR surface,
33 const VkSurfaceCapabilitiesKHR& surface_caps,
34 const VkSurfaceFormatKHR& surface_format);
35 void DestroySwapChain();
36
37 bool InitializeImageLayoutCommandBuffer();
38 void DestroyImageLayoutCommandBuffer();
39
40 bool InitializeSwapImages(const VkSurfaceCapabilitiesKHR& surface_caps,
41 const VkSurfaceFormatKHR& surface_format);
42 void DestroySwapImages();
43
44 bool InitializeInitialBuffer();
45
46 VkSwapchainKHR swap_chain_ = VK_NULL_HANDLE;
47
48 scoped_ptr<VulkanCommandPool> command_pool_;
49 scoped_ptr<VulkanCommandBuffer> image_layout_command_buffer_;
50
51 struct ImageData {
52 ImageData();
53 ~ImageData();
54
55 VkImage image = VK_NULL_HANDLE;
56 VkImageView image_view = VK_NULL_HANDLE;
57 scoped_ptr<VulkanCommandBuffer> command_buffer;
58
59 VkSemaphore render_layout_semaphore = VK_NULL_HANDLE;
60 VkSemaphore render_semaphore = VK_NULL_HANDLE;
61 VkSemaphore present_layout_semaphore = VK_NULL_HANDLE;
62 VkSemaphore present_semaphore = VK_NULL_HANDLE;
63 };
64 std::vector<scoped_ptr<ImageData>> images_;
65 uint32_t current_image_ = 0;
66 };
67
68 } // namespace gpu
69
70 #endif // GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698