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