Flutter Engine
 
Loading...
Searching...
No Matches
vulkan::VulkanCommandBuffer Class Reference

#include <vulkan_command_buffer.h>

Public Member Functions

 VulkanCommandBuffer (const VulkanProcTable &vk, const VulkanHandle< VkDevice > &device, const VulkanHandle< VkCommandPool > &pool)
 
 ~VulkanCommandBuffer ()
 
bool IsValid () const
 
VkCommandBuffer Handle () const
 
bool Begin () const
 
bool End () const
 
bool InsertPipelineBarrier (VkPipelineStageFlagBits src_stage_flags, VkPipelineStageFlagBits dest_stage_flags, uint32_t dependency_flags, uint32_t memory_barrier_count, const VkMemoryBarrier *memory_barriers, uint32_t buffer_memory_barrier_count, const VkBufferMemoryBarrier *buffer_memory_barriers, uint32_t image_memory_barrier_count, const VkImageMemoryBarrier *image_memory_barriers) const
 

Detailed Description

Definition at line 15 of file vulkan_command_buffer.h.

Constructor & Destructor Documentation

◆ VulkanCommandBuffer()

vulkan::VulkanCommandBuffer::VulkanCommandBuffer ( const VulkanProcTable vk,
const VulkanHandle< VkDevice > &  device,
const VulkanHandle< VkCommandPool > &  pool 
)

Definition at line 11 of file vulkan_command_buffer.cc.

15 : vk_(p_vk), device_(device), pool_(pool), valid_(false) {
16 const VkCommandBufferAllocateInfo allocate_info = {
17 .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
18 .pNext = nullptr,
19 .commandPool = pool_,
20 .level = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
21 .commandBufferCount = 1,
22 };
23
24 VkCommandBuffer buffer = VK_NULL_HANDLE;
25
26 if (VK_CALL_LOG_ERROR(vk_.AllocateCommandBuffers(device_, &allocate_info,
27 &buffer)) != VK_SUCCESS) {
28 FML_DLOG(INFO) << "Could not allocate command buffers.";
29 return;
30 }
31
32 auto buffer_collect = [this](VkCommandBuffer buffer) {
33 vk_.FreeCommandBuffers(device_, pool_, 1, &buffer);
34 };
35
36 handle_ = VulkanHandle<VkCommandBuffer>{buffer, buffer_collect};
37
38 valid_ = true;
39}
VkDevice device
Definition main.cc:69
#define FML_DLOG(severity)
Definition logging.h:121
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98
#define VK_CALL_LOG_ERROR(expression)

References FML_DLOG, and VK_CALL_LOG_ERROR.

◆ ~VulkanCommandBuffer()

vulkan::VulkanCommandBuffer::~VulkanCommandBuffer ( )
default

Member Function Documentation

◆ Begin()

bool vulkan::VulkanCommandBuffer::Begin ( ) const

Definition at line 51 of file vulkan_command_buffer.cc.

51 {
52 const VkCommandBufferBeginInfo info{
53 .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
54 .pNext = nullptr,
55 .flags = 0,
56 .pInheritanceInfo = nullptr,
57 };
58
59 return VK_CALL_LOG_ERROR(vk_.BeginCommandBuffer(handle_, &info)) ==
60 VK_SUCCESS;
61}

References VK_CALL_LOG_ERROR.

◆ End()

bool vulkan::VulkanCommandBuffer::End ( ) const

Definition at line 63 of file vulkan_command_buffer.cc.

63 {
64 return VK_CALL_LOG_ERROR(vk_.EndCommandBuffer(handle_)) == VK_SUCCESS;
65}

References VK_CALL_LOG_ERROR.

◆ Handle()

VkCommandBuffer vulkan::VulkanCommandBuffer::Handle ( ) const

Definition at line 47 of file vulkan_command_buffer.cc.

47 {
48 return handle_;
49}

◆ InsertPipelineBarrier()

bool vulkan::VulkanCommandBuffer::InsertPipelineBarrier ( VkPipelineStageFlagBits  src_stage_flags,
VkPipelineStageFlagBits  dest_stage_flags,
uint32_t  dependency_flags,
uint32_t  memory_barrier_count,
const VkMemoryBarrier *  memory_barriers,
uint32_t  buffer_memory_barrier_count,
const VkBufferMemoryBarrier *  buffer_memory_barriers,
uint32_t  image_memory_barrier_count,
const VkImageMemoryBarrier *  image_memory_barriers 
) const

Definition at line 67 of file vulkan_command_buffer.cc.

76 {
77 vk_.CmdPipelineBarrier(handle_, src_stage_flags, dest_stage_flags,
78 dependency_flags, memory_barrier_count,
79 memory_barriers, buffer_memory_barrier_count,
80 buffer_memory_barriers, image_memory_barrier_count,
81 image_memory_barriers);
82 return true;
83}

Referenced by vulkan::VulkanImage::InsertImageMemoryBarrier().

◆ IsValid()

bool vulkan::VulkanCommandBuffer::IsValid ( ) const

Definition at line 43 of file vulkan_command_buffer.cc.

43 {
44 return valid_;
45}

Referenced by vulkan::VulkanBackbuffer::VulkanBackbuffer().


The documentation for this class was generated from the following files: