Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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< VulkanSamplerYcbcrConversion >)
 

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.

Constructor & Destructor Documentation

◆ ~VulkanImageView()

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

Definition at line 90 of file VulkanImageView.cpp.

90 {
91 VULKAN_CALL(fSharedContext->interface(),
92 DestroyImageView(fSharedContext->device(), fImageView, nullptr));
93}
#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< VulkanSamplerYcbcrConversion 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;
45 break;
46 default:
47 aspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
48 break;
49 }
50 // Attachments can only expose the top level MIP
51 miplevels = 1;
52 } else {
53 aspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
54 }
55 VkImageViewCreateInfo viewInfo = {
57 pNext, // pNext
58 0, // flags
59 image, // image
60 VK_IMAGE_VIEW_TYPE_2D, // viewType
61 format, // format
65 VK_COMPONENT_SWIZZLE_IDENTITY }, // components
66 { aspectFlags, 0, miplevels, 0, 1 }, // subresourceRange
67 };
68
70 VULKAN_CALL_RESULT(sharedCtx,
71 result,
72 CreateImageView(sharedCtx->device(), &viewInfo, nullptr, &imageView));
73 if (result != VK_SUCCESS) {
74 return nullptr;
75 }
76
77 return std::unique_ptr<VulkanImageView>(new VulkanImageView(sharedCtx, imageView, usage,
78 ycbcrConversion));
79}
#define VULKAN_CALL_RESULT(SHARED_CONTEXT, RESULT, X)
sk_sp< SkImage > image
Definition examples.cpp:29
GAsyncResult * result
uint32_t uint32_t * format
VkSamplerYcbcrConversion conversion
VkFlags VkImageAspectFlags
@ VK_IMAGE_VIEW_TYPE_2D
@ VK_IMAGE_ASPECT_COLOR_BIT
@ VK_IMAGE_ASPECT_STENCIL_BIT
@ VK_IMAGE_ASPECT_DEPTH_BIT
@ VK_COMPONENT_SWIZZLE_IDENTITY
VkResult
@ VK_SUCCESS
@ VK_FORMAT_D24_UNORM_S8_UINT
@ VK_FORMAT_S8_UINT
@ VK_FORMAT_D32_SFLOAT_S8_UINT
@ VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO
@ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO

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