Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
skgpu::graphite::VulkanImageView Class Reference

#include <VulkanImageView.h>

Public Types

enum class  Usage { kShaderInput , kAttachment }
 

Public Member Functions

 ~VulkanImageView ()
 
VkImageView imageView () const
 
Usage usage () const
 

Static Public Member Functions

static std::unique_ptr< const VulkanImageViewMake (const VulkanSharedContext *sharedContext, VkImage image, VkFormat format, Usage usage, uint32_t miplevels, sk_sp< VulkanYcbcrConversion >)
 

Detailed Description

Definition at line 26 of file VulkanImageView.h.

Member Enumeration Documentation

◆ Usage

Enumerator
kShaderInput 
kAttachment 

Definition at line 28 of file VulkanImageView.h.

28 {
29 kShaderInput,
30 kAttachment
31 };

Constructor & Destructor Documentation

◆ ~VulkanImageView()

skgpu::graphite::VulkanImageView::~VulkanImageView ( )

Definition at line 94 of file VulkanImageView.cpp.

94 {
95 VULKAN_CALL(fSharedContext->interface(),
96 DestroyImageView(fSharedContext->device(), fImageView, nullptr));
97}
#define VULKAN_CALL(IFACE, X)
const skgpu::VulkanInterface * interface() const

Member Function Documentation

◆ imageView()

VkImageView skgpu::graphite::VulkanImageView::imageView ( ) const
inline

Definition at line 42 of file VulkanImageView.h.

42{ return fImageView; }

◆ Make()

std::unique_ptr< const VulkanImageView > skgpu::graphite::VulkanImageView::Make ( const VulkanSharedContext sharedContext,
VkImage  image,
VkFormat  format,
Usage  usage,
uint32_t  miplevels,
sk_sp< VulkanYcbcrConversion ycbcrConversion 
)
static

Definition at line 17 of file VulkanImageView.cpp.

23 {
24
25 void* pNext = nullptr;
26 VkSamplerYcbcrConversionInfo conversionInfo;
27 if (ycbcrConversion) {
29 conversionInfo.pNext = nullptr;
30 conversionInfo.conversion = ycbcrConversion->ycbcrConversion();
31 pNext = &conversionInfo;
32 }
33
34 VkImageView imageView;
35 // Create the VkImageView
36 VkImageAspectFlags aspectFlags;
38 switch (format) {
40 aspectFlags = VK_IMAGE_ASPECT_STENCIL_BIT;
41 break;
44 aspectFlags = VK_IMAGE_ASPECT_DEPTH_BIT;
45 break;
49 break;
50 default:
51 aspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
52 break;
53 }
54 // Attachments can only expose the top level MIP
55 miplevels = 1;
56 } else {
57 aspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
58 }
59 VkImageViewCreateInfo viewInfo = {
61 pNext, // pNext
62 0, // flags
63 image, // image
64 VK_IMAGE_VIEW_TYPE_2D, // viewType
65 format, // format
69 VK_COMPONENT_SWIZZLE_IDENTITY }, // components
70 { aspectFlags, 0, miplevels, 0, 1 }, // subresourceRange
71 };
72
74 VULKAN_CALL_RESULT(sharedCtx,
75 result,
76 CreateImageView(sharedCtx->device(), &viewInfo, nullptr, &imageView));
77 if (result != VK_SUCCESS) {
78 return nullptr;
79 }
80
81 return std::unique_ptr<VulkanImageView>(new VulkanImageView(sharedCtx, imageView, usage,
82 ycbcrConversion));
83}
#define VULKAN_CALL_RESULT(SHARED_CONTEXT, RESULT, X)
GAsyncResult * result
uint32_t uint32_t * format
sk_sp< const SkImage > image
Definition: SkRecords.h:269
VkSamplerYcbcrConversion conversion
Definition: vulkan_core.h:5438
VkFlags VkImageAspectFlags
Definition: vulkan_core.h:2256
@ VK_IMAGE_VIEW_TYPE_2D
Definition: vulkan_core.h:1831
@ VK_IMAGE_ASPECT_COLOR_BIT
Definition: vulkan_core.h:2238
@ VK_IMAGE_ASPECT_STENCIL_BIT
Definition: vulkan_core.h:2240
@ VK_IMAGE_ASPECT_DEPTH_BIT
Definition: vulkan_core.h:2239
@ VK_COMPONENT_SWIZZLE_IDENTITY
Definition: vulkan_core.h:1819
VkResult
Definition: vulkan_core.h:140
@ VK_SUCCESS
Definition: vulkan_core.h:141
@ VK_FORMAT_D24_UNORM_S8_UINT
Definition: vulkan_core.h:1588
@ VK_FORMAT_D32_SFLOAT
Definition: vulkan_core.h:1585
@ VK_FORMAT_S8_UINT
Definition: vulkan_core.h:1586
@ VK_FORMAT_D16_UNORM
Definition: vulkan_core.h:1583
@ VK_FORMAT_D32_SFLOAT_S8_UINT
Definition: vulkan_core.h:1589
@ VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO
Definition: vulkan_core.h:293
@ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
Definition: vulkan_core.h:217

◆ usage()

Usage skgpu::graphite::VulkanImageView::usage ( ) const
inline

Definition at line 43 of file VulkanImageView.h.

43{ return fUsage; }

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