OLD | NEW |
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_COMMAND_POOL_H_ | 5 #ifndef GPU_VULKAN_VULKAN_COMMAND_POOL_H_ |
6 #define GPU_VULKAN_VULKAN_COMMAND_POOL_H_ | 6 #define GPU_VULKAN_VULKAN_COMMAND_POOL_H_ |
7 | 7 |
8 #include <vulkan/vulkan.h> | 8 #include <vulkan/vulkan.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 | 13 |
13 namespace gpu { | 14 namespace gpu { |
14 | 15 |
15 class VulkanCommandBuffer; | 16 class VulkanCommandBuffer; |
16 class VulkanDeviceQueue; | 17 class VulkanDeviceQueue; |
17 | 18 |
18 class VulkanCommandPool { | 19 class VulkanCommandPool { |
19 public: | 20 public: |
20 explicit VulkanCommandPool(VulkanDeviceQueue* device_queue); | 21 explicit VulkanCommandPool(VulkanDeviceQueue* device_queue); |
21 ~VulkanCommandPool(); | 22 ~VulkanCommandPool(); |
22 | 23 |
23 bool Initialize(); | 24 bool Initialize(); |
24 void Destroy(); | 25 void Destroy(); |
25 | 26 |
26 scoped_ptr<VulkanCommandBuffer> CreatePrimaryCommandBuffer(); | 27 std::unique_ptr<VulkanCommandBuffer> CreatePrimaryCommandBuffer(); |
27 scoped_ptr<VulkanCommandBuffer> CreateSecondaryCommandBuffer(); | 28 std::unique_ptr<VulkanCommandBuffer> CreateSecondaryCommandBuffer(); |
28 | 29 |
29 VkCommandPool handle() { return handle_; } | 30 VkCommandPool handle() { return handle_; } |
30 | 31 |
31 private: | 32 private: |
32 friend class VulkanCommandBuffer; | 33 friend class VulkanCommandBuffer; |
33 | 34 |
34 void IncrementCommandBufferCount(); | 35 void IncrementCommandBufferCount(); |
35 void DecrementCommandBufferCount(); | 36 void DecrementCommandBufferCount(); |
36 | 37 |
37 VulkanDeviceQueue* device_queue_; | 38 VulkanDeviceQueue* device_queue_; |
38 VkCommandPool handle_ = VK_NULL_HANDLE; | 39 VkCommandPool handle_ = VK_NULL_HANDLE; |
39 uint32_t command_buffer_count_ = 0; | 40 uint32_t command_buffer_count_ = 0; |
40 | 41 |
41 DISALLOW_COPY_AND_ASSIGN(VulkanCommandPool); | 42 DISALLOW_COPY_AND_ASSIGN(VulkanCommandPool); |
42 }; | 43 }; |
43 | 44 |
44 } // namespace gpu | 45 } // namespace gpu |
45 | 46 |
46 #endif // GPU_VULKAN_VULKAN_COMMAND_POOL_H_ | 47 #endif // GPU_VULKAN_VULKAN_COMMAND_POOL_H_ |
OLD | NEW |