1 | // Copyright 2013 The Flutter 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 FLUTTER_VULKAN_VULKAN_COMMAND_BUFFER_H_ |
6 | #define FLUTTER_VULKAN_VULKAN_COMMAND_BUFFER_H_ |
7 | |
8 | #include "flutter/fml/compiler_specific.h" |
9 | #include "flutter/fml/macros.h" |
10 | #include "vulkan_handle.h" |
11 | |
12 | namespace vulkan { |
13 | |
14 | class VulkanProcTable; |
15 | |
16 | class VulkanCommandBuffer { |
17 | public: |
18 | VulkanCommandBuffer(const VulkanProcTable& vk, |
19 | const VulkanHandle<VkDevice>& device, |
20 | const VulkanHandle<VkCommandPool>& pool); |
21 | |
22 | ~VulkanCommandBuffer(); |
23 | |
24 | bool IsValid() const; |
25 | |
26 | VkCommandBuffer Handle() const; |
27 | |
28 | [[nodiscard]] bool Begin() const; |
29 | |
30 | [[nodiscard]] bool End() const; |
31 | |
32 | [[nodiscard]] bool InsertPipelineBarrier( |
33 | VkPipelineStageFlagBits src_stage_flags, |
34 | VkPipelineStageFlagBits dest_stage_flags, |
35 | uint32_t /* mask of VkDependencyFlagBits */ dependency_flags, |
36 | uint32_t memory_barrier_count, |
37 | const VkMemoryBarrier* memory_barriers, |
38 | uint32_t buffer_memory_barrier_count, |
39 | const VkBufferMemoryBarrier* buffer_memory_barriers, |
40 | uint32_t image_memory_barrier_count, |
41 | const VkImageMemoryBarrier* image_memory_barriers) const; |
42 | |
43 | private: |
44 | const VulkanProcTable& vk; |
45 | const VulkanHandle<VkDevice>& device_; |
46 | const VulkanHandle<VkCommandPool>& pool_; |
47 | VulkanHandle<VkCommandBuffer> handle_; |
48 | bool valid_; |
49 | |
50 | FML_DISALLOW_COPY_AND_ASSIGN(VulkanCommandBuffer); |
51 | }; |
52 | |
53 | } // namespace vulkan |
54 | |
55 | #endif // FLUTTER_VULKAN_VULKAN_COMMAND_BUFFER_H_ |
56 | |