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_BUFFER_H_ | 5 #ifndef GPU_VULKAN_VULKAN_COMMAND_BUFFER_H_ |
6 #define GPU_VULKAN_VULKAN_COMMAND_BUFFER_H_ | 6 #define GPU_VULKAN_VULKAN_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include <vulkan/vulkan.h> | 8 #include <vulkan/vulkan.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "gpu/vulkan/vulkan_export.h" | 13 #include "gpu/vulkan/vulkan_export.h" |
14 | 14 |
15 namespace gpu { | 15 namespace gpu { |
16 | 16 |
17 class VulkanCommandPool; | 17 class VulkanCommandPool; |
| 18 class VulkanDeviceQueue; |
18 | 19 |
19 class VULKAN_EXPORT VulkanCommandBuffer { | 20 class VULKAN_EXPORT VulkanCommandBuffer { |
20 public: | 21 public: |
21 VulkanCommandBuffer(VulkanCommandPool* command_pool, bool primary); | 22 VulkanCommandBuffer(VulkanDeviceQueue* device_queue, |
| 23 VulkanCommandPool* command_pool, |
| 24 bool primary); |
22 ~VulkanCommandBuffer(); | 25 ~VulkanCommandBuffer(); |
23 | 26 |
24 bool Initialize(); | 27 bool Initialize(); |
25 void Destroy(); | 28 void Destroy(); |
26 | 29 |
27 // Submit primary command buffer to the queue. | 30 // Submit primary command buffer to the queue. |
28 bool Submit(VkQueue queue, | 31 bool Submit(uint32_t num_wait_semaphores, |
29 uint32_t num_wait_semaphores, | |
30 VkSemaphore* wait_semaphores, | 32 VkSemaphore* wait_semaphores, |
31 uint32_t num_signal_semaphores, | 33 uint32_t num_signal_semaphores, |
32 VkSemaphore* signal_semaphores); | 34 VkSemaphore* signal_semaphores); |
33 | 35 |
34 // Enqueue secondary command buffer within a primary command buffer. | 36 // Enqueue secondary command buffer within a primary command buffer. |
35 void Enqueue(VkCommandBuffer primary_command_buffer); | 37 void Enqueue(VkCommandBuffer primary_command_buffer); |
36 | 38 |
37 void Clear(); | 39 void Clear(); |
38 | 40 |
39 // This blocks until the commands from the previous submit are done. | 41 // This blocks until the commands from the previous submit are done. |
(...skipping 23 matching lines...) Expand all Loading... |
63 // synchronized and the command buffer is no longer in use. | 65 // synchronized and the command buffer is no longer in use. |
64 RECORD_TYPE_DIRTY, | 66 RECORD_TYPE_DIRTY, |
65 }; | 67 }; |
66 | 68 |
67 void PostExecution(); | 69 void PostExecution(); |
68 void ResetIfDirty(); | 70 void ResetIfDirty(); |
69 | 71 |
70 const bool primary_; | 72 const bool primary_; |
71 bool recording_ = false; | 73 bool recording_ = false; |
72 RecordType record_type_ = RECORD_TYPE_EMPTY; | 74 RecordType record_type_ = RECORD_TYPE_EMPTY; |
| 75 VulkanDeviceQueue* device_queue_; |
73 VulkanCommandPool* command_pool_; | 76 VulkanCommandPool* command_pool_; |
74 VkCommandBuffer command_buffer_ = VK_NULL_HANDLE; | 77 VkCommandBuffer command_buffer_ = VK_NULL_HANDLE; |
75 VkFence submission_fence_ = VK_NULL_HANDLE; | 78 VkFence submission_fence_ = VK_NULL_HANDLE; |
76 | 79 |
77 DISALLOW_COPY_AND_ASSIGN(VulkanCommandBuffer); | 80 DISALLOW_COPY_AND_ASSIGN(VulkanCommandBuffer); |
78 }; | 81 }; |
79 | 82 |
80 class VULKAN_EXPORT CommandBufferRecorderBase { | 83 class VULKAN_EXPORT CommandBufferRecorderBase { |
81 public: | 84 public: |
82 VkCommandBuffer handle() const { return handle_; } | 85 VkCommandBuffer handle() const { return handle_; } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 ScopedSingleUseCommandBufferRecorder(VulkanCommandBuffer& command_buffer); | 127 ScopedSingleUseCommandBufferRecorder(VulkanCommandBuffer& command_buffer); |
125 ~ScopedSingleUseCommandBufferRecorder() override {} | 128 ~ScopedSingleUseCommandBufferRecorder() override {} |
126 | 129 |
127 private: | 130 private: |
128 DISALLOW_COPY_AND_ASSIGN(ScopedSingleUseCommandBufferRecorder); | 131 DISALLOW_COPY_AND_ASSIGN(ScopedSingleUseCommandBufferRecorder); |
129 }; | 132 }; |
130 | 133 |
131 } // namespace gpu | 134 } // namespace gpu |
132 | 135 |
133 #endif // GPU_VULKAN_VULKAN_COMMAND_BUFFER_H_ | 136 #endif // GPU_VULKAN_VULKAN_COMMAND_BUFFER_H_ |
OLD | NEW |