• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef RS_ENABLE_VK
9 #include "flutter/fml/compiler_specific.h"
10 #include "flutter/fml/macros.h"
11 #endif
12 #include "flutter/vulkan/vulkan_handle.h"
13 
14 namespace vulkan {
15 
16 class VulkanProcTable;
17 
18 class VulkanCommandBuffer {
19  public:
20   VulkanCommandBuffer(const VulkanProcTable& vk,
21                       const VulkanHandle<VkDevice>& device,
22                       const VulkanHandle<VkCommandPool>& pool);
23 
24   ~VulkanCommandBuffer();
25 
26   bool IsValid() const;
27 
28   VkCommandBuffer Handle() const;
29 
30 #ifndef RS_ENABLE_VK
31   FML_WARN_UNUSED_RESULT
32 #endif
33   bool Begin() const;
34 
35 #ifndef RS_ENABLE_VK
36   FML_WARN_UNUSED_RESULT
37 #endif
38   bool End() const;
39 
40 #ifndef RS_ENABLE_VK
41   FML_WARN_UNUSED_RESULT
42 #endif
43   bool InsertPipelineBarrier(
44       VkPipelineStageFlagBits src_stage_flags,
45       VkPipelineStageFlagBits dest_stage_flags,
46       uint32_t /* mask of VkDependencyFlagBits */ dependency_flags,
47       uint32_t memory_barrier_count,
48       const VkMemoryBarrier* memory_barriers,
49       uint32_t buffer_memory_barrier_count,
50       const VkBufferMemoryBarrier* buffer_memory_barriers,
51       uint32_t image_memory_barrier_count,
52       const VkImageMemoryBarrier* image_memory_barriers) const;
53 
54  private:
55   const VulkanProcTable& vk;
56   const VulkanHandle<VkDevice>& device_;
57   const VulkanHandle<VkCommandPool>& pool_;
58   VulkanHandle<VkCommandBuffer> handle_;
59   bool valid_;
60 
61 #ifndef RS_ENABLE_VK
62   FML_DISALLOW_COPY_AND_ASSIGN(VulkanCommandBuffer);
63 #endif
64 };
65 
66 }  // namespace vulkan
67 
68 #endif  // FLUTTER_VULKAN_VULKAN_COMMAND_BUFFER_H_
69