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

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: Ensure vulkan handles all initialized to null, check destruction in destructor 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 "gpu/vulkan/vulkan_command_buffer.h"
13
14 namespace gfx {
15
16 class VulkanSwapChain {
17 public:
18 VulkanSwapChain();
19 ~VulkanSwapChain();
20
21 bool Initialize(VkCommandBuffer command_buffer,
22 VkSurfaceKHR surface,
23 const VkSurfaceCapabilitiesKHR& surface_caps,
24 const VkSurfaceFormatKHR& surface_format,
25 const VkComponentMapping& view_mapping);
26 void Destroy();
27
28 void SwapBuffers();
29
30 private:
31 bool InitializeSwapChain(VkSurfaceKHR surface,
32 const VkSurfaceCapabilitiesKHR& surface_caps,
33 const VkSurfaceFormatKHR& surface_format);
34 bool InitializeRenderPass(const VkSurfaceFormatKHR& surface_format);
35 bool InitializeSwapBuffers(VkCommandBuffer command_buffer,
36 const VkSurfaceCapabilitiesKHR& surface_caps,
37 const VkSurfaceFormatKHR& surface_format,
38 const VkComponentMapping& view_mapping);
39
40 VkSwapchainKHR swap_chain_ = VK_NULL_HANDLE;
41 VkRenderPass render_pass_ = VK_NULL_HANDLE;
42
43 struct BufferData {
44 BufferData();
45 ~BufferData();
46
47 VkImage image = VK_NULL_HANDLE;
48 VkImageView image_view = VK_NULL_HANDLE;
49 VkFramebuffer frame_buffer = VK_NULL_HANDLE;
50 scoped_ptr<VulkanCommandBuffer> command_buffer;
51 };
52 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.
53 uint32_t current_buffer_ = 0;
54 };
55
56 } // namespace gfx
57
58 #endif // GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698