Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
GrVkImageView Class Reference

#include <GrVkImageView.h>

Inheritance diagram for GrVkImageView:
GrVkManagedResource GrManagedResource SkNoncopyable

Public Types

enum  Type { kColor_Type , kStencil_Type }
 

Public Member Functions

VkImageView imageView () const
 
- Public Member Functions inherited from GrVkManagedResource
 GrVkManagedResource (const GrVkGpu *gpu)
 
- Public Member Functions inherited from GrManagedResource
 GrManagedResource ()
 
virtual ~GrManagedResource ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< const GrVkImageViewMake (GrVkGpu *gpu, VkImage image, VkFormat format, Type viewType, uint32_t miplevels, const skgpu::VulkanYcbcrConversionInfo &ycbcrInfo)
 

Additional Inherited Members

- Protected Attributes inherited from GrVkManagedResource
const GrVkGpufGpu
 

Detailed Description

Definition at line 19 of file GrVkImageView.h.

Member Enumeration Documentation

◆ Type

Enumerator
kColor_Type 
kStencil_Type 

Definition at line 21 of file GrVkImageView.h.

Member Function Documentation

◆ imageView()

VkImageView GrVkImageView::imageView ( ) const
inline

Definition at line 33 of file GrVkImageView.h.

33{ return fImageView; }

◆ Make()

sk_sp< const GrVkImageView > GrVkImageView::Make ( GrVkGpu gpu,
VkImage  image,
VkFormat  format,
Type  viewType,
uint32_t  miplevels,
const skgpu::VulkanYcbcrConversionInfo ycbcrInfo 
)
static

Definition at line 13 of file GrVkImageView.cpp.

18 {
19 void* pNext = nullptr;
20 VkSamplerYcbcrConversionInfo conversionInfo;
21 GrVkSamplerYcbcrConversion* ycbcrConversion = nullptr;
22
23 if (ycbcrInfo.isValid()) {
24 SkASSERT(gpu->vkCaps().supportsYcbcrConversion() && format == ycbcrInfo.fFormat);
25
26 ycbcrConversion =
28 if (!ycbcrConversion) {
29 return nullptr;
30 }
31
33 conversionInfo.pNext = nullptr;
34 conversionInfo.conversion = ycbcrConversion->ycbcrConversion();
35 pNext = &conversionInfo;
36 }
37
38 VkImageView imageView;
39 // Create the VkImageView
40 VkImageViewCreateInfo viewInfo = {
42 pNext, // pNext
43 0, // flags
44 image, // image
45 VK_IMAGE_VIEW_TYPE_2D, // viewType
46 format, // format
50 VK_COMPONENT_SWIZZLE_IDENTITY }, // components
51 { VK_IMAGE_ASPECT_COLOR_BIT, 0, miplevels, 0, 1 }, // subresourceRange
52 };
53 if (kStencil_Type == viewType) {
55 }
56
57 VkResult err;
58 GR_VK_CALL_RESULT(gpu, err, CreateImageView(gpu->device(), &viewInfo, nullptr, &imageView));
59 if (err) {
60 return nullptr;
61 }
62
63 return sk_sp<const GrVkImageView>(new GrVkImageView(gpu, imageView, ycbcrConversion));
64}
#define GR_VK_CALL_RESULT(GPU, RESULT, X)
Definition: GrVkUtil.h:35
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool supportsYcbcrConversion() const
Definition: GrVkCaps.h:153
const GrVkCaps & vkCaps() const
Definition: GrVkGpu.h:61
VkDevice device() const
Definition: GrVkGpu.h:71
GrVkResourceProvider & resourceProvider()
Definition: GrVkGpu.h:83
VkImageView imageView() const
Definition: GrVkImageView.h:33
GrVkSamplerYcbcrConversion * findOrCreateCompatibleSamplerYcbcrConversion(const skgpu::VulkanYcbcrConversionInfo &ycbcrInfo)
VkSamplerYcbcrConversion ycbcrConversion() const
uint32_t uint32_t * format
sk_sp< const SkImage > image
Definition: SkRecords.h:269
VkImageAspectFlags aspectMask
Definition: vulkan_core.h:2928
VkImageSubresourceRange subresourceRange
Definition: vulkan_core.h:3474
VkSamplerYcbcrConversion conversion
Definition: vulkan_core.h:5438
@ 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_COMPONENT_SWIZZLE_IDENTITY
Definition: vulkan_core.h:1819
VkResult
Definition: vulkan_core.h:140
@ VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO
Definition: vulkan_core.h:293
@ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
Definition: vulkan_core.h:217

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