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

Side by Side Diff: gpu/vulkan/vulkan_swap_chain.h

Issue 1829163003: Added initial implementation of the Vulkan Context Provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vk_surface_patch
Patch Set: Block off vulkan_cc with enable_vulkan (not relevant in future patch) Created 4 years, 8 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
« no previous file with comments | « gpu/vulkan/vulkan_surface.cc ('k') | gpu/vulkan/vulkan_swap_chain.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GPU_VULKAN_VULKAN_SWAP_CHAIN_H_ 5 #ifndef GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
6 #define GPU_VULKAN_VULKAN_SWAP_CHAIN_H_ 6 #define GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
7 7
8 #include <vulkan/vulkan.h> 8 #include <vulkan/vulkan.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "gpu/vulkan/vulkan_export.h" 12 #include "gpu/vulkan/vulkan_export.h"
13 #include "ui/gfx/geometry/size.h" 13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/swap_result.h" 14 #include "ui/gfx/swap_result.h"
15 15
16 namespace gpu { 16 namespace gpu {
17 17
18 class VulkanCommandBuffer; 18 class VulkanCommandBuffer;
19 class VulkanCommandPool; 19 class VulkanCommandPool;
20 class VulkanDeviceQueue;
20 class VulkanImageView; 21 class VulkanImageView;
21 22
22 class VulkanSwapChain { 23 class VulkanSwapChain {
23 public: 24 public:
24 VulkanSwapChain(); 25 VulkanSwapChain();
25 ~VulkanSwapChain(); 26 ~VulkanSwapChain();
26 27
27 bool Initialize(VkSurfaceKHR surface, 28 bool Initialize(VulkanDeviceQueue* device_queue,
29 VkSurfaceKHR surface,
28 const VkSurfaceCapabilitiesKHR& surface_caps, 30 const VkSurfaceCapabilitiesKHR& surface_caps,
29 const VkSurfaceFormatKHR& surface_format); 31 const VkSurfaceFormatKHR& surface_format);
30 void Destroy(); 32 void Destroy();
31 33
32 gfx::SwapResult SwapBuffers(); 34 gfx::SwapResult SwapBuffers();
33 35
34 uint32_t num_images() const { return static_cast<uint32_t>(images_.size()); } 36 uint32_t num_images() const { return static_cast<uint32_t>(images_.size()); }
35 uint32_t current_image() const { return current_image_; } 37 uint32_t current_image() const { return current_image_; }
36 const gfx::Size& size() const { return size_; } 38 const gfx::Size& size() const { return size_; }
37 39
(...skipping 14 matching lines...) Expand all
52 private: 54 private:
53 bool InitializeSwapChain(VkSurfaceKHR surface, 55 bool InitializeSwapChain(VkSurfaceKHR surface,
54 const VkSurfaceCapabilitiesKHR& surface_caps, 56 const VkSurfaceCapabilitiesKHR& surface_caps,
55 const VkSurfaceFormatKHR& surface_format); 57 const VkSurfaceFormatKHR& surface_format);
56 void DestroySwapChain(); 58 void DestroySwapChain();
57 59
58 bool InitializeSwapImages(const VkSurfaceCapabilitiesKHR& surface_caps, 60 bool InitializeSwapImages(const VkSurfaceCapabilitiesKHR& surface_caps,
59 const VkSurfaceFormatKHR& surface_format); 61 const VkSurfaceFormatKHR& surface_format);
60 void DestroySwapImages(); 62 void DestroySwapImages();
61 63
64 VulkanDeviceQueue* device_queue_;
62 VkSwapchainKHR swap_chain_ = VK_NULL_HANDLE; 65 VkSwapchainKHR swap_chain_ = VK_NULL_HANDLE;
63 66
64 scoped_ptr<VulkanCommandPool> command_pool_; 67 scoped_ptr<VulkanCommandPool> command_pool_;
65 68
66 gfx::Size size_; 69 gfx::Size size_;
67 70
68 struct ImageData { 71 struct ImageData {
69 ImageData(); 72 ImageData();
70 ~ImageData(); 73 ~ImageData();
71 74
72 VkImage image = VK_NULL_HANDLE; 75 VkImage image = VK_NULL_HANDLE;
73 scoped_ptr<VulkanImageView> image_view; 76 scoped_ptr<VulkanImageView> image_view;
74 scoped_ptr<VulkanCommandBuffer> command_buffer; 77 scoped_ptr<VulkanCommandBuffer> command_buffer;
75 78
76 VkSemaphore render_semaphore = VK_NULL_HANDLE; 79 VkSemaphore render_semaphore = VK_NULL_HANDLE;
77 VkSemaphore present_semaphore = VK_NULL_HANDLE; 80 VkSemaphore present_semaphore = VK_NULL_HANDLE;
78 }; 81 };
79 std::vector<scoped_ptr<ImageData>> images_; 82 std::vector<scoped_ptr<ImageData>> images_;
80 uint32_t current_image_ = 0; 83 uint32_t current_image_ = 0;
81 84
82 VkSemaphore next_present_semaphore_ = VK_NULL_HANDLE; 85 VkSemaphore next_present_semaphore_ = VK_NULL_HANDLE;
83 }; 86 };
84 87
85 } // namespace gpu 88 } // namespace gpu
86 89
87 #endif // GPU_VULKAN_VULKAN_SWAP_CHAIN_H_ 90 #endif // GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
OLDNEW
« no previous file with comments | « gpu/vulkan/vulkan_surface.cc ('k') | gpu/vulkan/vulkan_swap_chain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698