Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
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, VkAccessFlags 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)
explicit

Definition at line 12 of file vulkan_image.cc.

13 : handle_(std::move(image)),
15 access_flags_(0),
16 valid_(false) {
17 if (!handle_) {
18 return;
19 }
20
21 valid_ = true;
22}
sk_sp< const SkImage > image
Definition: SkRecords.h:269
@ VK_IMAGE_LAYOUT_UNDEFINED
Definition: vulkan_core.h:1331

◆ ~VulkanImage()

vulkan::VulkanImage::~VulkanImage ( )
default

Member Function Documentation

◆ InsertImageMemoryBarrier()

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

Definition at line 30 of file vulkan_image.cc.

35 {
36 const VkImageMemoryBarrier 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}
VkStructureType sType
Definition: vulkan_core.h:2936
@ VK_IMAGE_ASPECT_COLOR_BIT
Definition: vulkan_core.h:2238
#define VK_QUEUE_FAMILY_IGNORED
Definition: vulkan_core.h:127
@ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
Definition: vulkan_core.h:247

◆ 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: