Flutter Engine
vulkan::VulkanImage Class Reference

#include <vulkan_image.h>

Public Member Functions

 VulkanImage (VulkanHandle< VkImage > image)
 
 ~VulkanImage ()
 
bool IsValid () const
 
bool InsertImageMemoryBarrier (const VulkanCommandBuffer &command_buffer, VkPipelineStageFlagBits src_pipline_bits, VkPipelineStageFlagBits dest_pipline_bits, VkAccessFlagBits dest_access_flags, VkImageLayout dest_layout)
 

Detailed Description

Definition at line 17 of file vulkan_image.h.

Constructor & Destructor Documentation

◆ VulkanImage()

vulkan::VulkanImage::VulkanImage ( VulkanHandle< VkImage >  image)

Definition at line 12 of file vulkan_image.cc.

References ~VulkanImage().

13  : handle_(std::move(image)),
14  layout_(VK_IMAGE_LAYOUT_UNDEFINED),
15  access_flags_(0),
16  valid_(false) {
17  if (!handle_) {
18  return;
19  }
20 
21  valid_ = true;
22 }

◆ ~VulkanImage()

vulkan::VulkanImage::~VulkanImage ( )
default

Referenced by VulkanImage().

Member Function Documentation

◆ InsertImageMemoryBarrier()

bool vulkan::VulkanImage::InsertImageMemoryBarrier ( const VulkanCommandBuffer command_buffer,
VkPipelineStageFlagBits  src_pipline_bits,
VkPipelineStageFlagBits  dest_pipline_bits,
VkAccessFlagBits  dest_access_flags,
VkImageLayout  dest_layout 
)

Definition at line 30 of file vulkan_image.cc.

References vulkan::VulkanCommandBuffer::InsertPipelineBarrier().

35  {
36  const VkImageMemoryBarrier image_memory_barrier = {
37  .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
38  .pNext = nullptr,
39  .srcAccessMask = access_flags_,
40  .dstAccessMask = dest_access_flags,
41  .oldLayout = layout_,
42  .newLayout = dest_layout,
43  .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
44  .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
45  .image = handle_,
46  .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1},
47  };
48 
49  bool success = command_buffer.InsertPipelineBarrier(
50  src_pipline_bits, // src_stage_flags
51  dest_pipline_bits, // dest_stage_flags
52  0, // dependency_flags
53  0, // memory_barrier_count
54  nullptr, // memory_barriers
55  0, // buffer_memory_barrier_count
56  nullptr, // buffer_memory_barriers
57  1, // image_memory_barrier_count
58  &image_memory_barrier // image_memory_barriers
59  );
60 
61  if (success) {
62  access_flags_ = dest_access_flags;
63  layout_ = dest_layout;
64  }
65 
66  return success;
67 }

◆ IsValid()

bool vulkan::VulkanImage::IsValid ( ) const

Definition at line 26 of file vulkan_image.cc.

26  {
27  return valid_;
28 }

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