• 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 #include "flutter/fml/compiler_specific.h"
9 #include "flutter/fml/macros.h"
10 #include "flutter/vulkan/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   FML_WARN_UNUSED_RESULT
29   bool Begin() const;
30 
31   FML_WARN_UNUSED_RESULT
32   bool End() const;
33 
34   FML_WARN_UNUSED_RESULT
35   bool InsertPipelineBarrier(
36       VkPipelineStageFlagBits src_stage_flags,
37       VkPipelineStageFlagBits dest_stage_flags,
38       uint32_t /* mask of VkDependencyFlagBits */ dependency_flags,
39       uint32_t memory_barrier_count,
40       const VkMemoryBarrier* memory_barriers,
41       uint32_t buffer_memory_barrier_count,
42       const VkBufferMemoryBarrier* buffer_memory_barriers,
43       uint32_t image_memory_barrier_count,
44       const VkImageMemoryBarrier* image_memory_barriers) const;
45 
46  private:
47   const VulkanProcTable& vk;
48   const VulkanHandle<VkDevice>& device_;
49   const VulkanHandle<VkCommandPool>& pool_;
50   VulkanHandle<VkCommandBuffer> handle_;
51   bool valid_;
52 
53   FML_DISALLOW_COPY_AND_ASSIGN(VulkanCommandBuffer);
54 };
55 
56 }  // namespace vulkan
57 
58 #endif  // FLUTTER_VULKAN_VULKAN_COMMAND_BUFFER_H_
59