Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private 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 GrVkYcbcrConversionInfo &ycbcrInfo)
 

Private Member Functions

void freeGPUData () const override
 

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

◆ freeGPUData()

void GrVkImageView::freeGPUData ( ) const
overrideprivatevirtual

Must be implemented by any subclasses. Deletes any GPU data associated with this resource

Implements GrManagedResource.

Definition at line 66 of file GrVkImageView.cpp.

66 {
67 GR_VK_CALL(fGpu->vkInterface(), DestroyImageView(fGpu->device(), fImageView, nullptr));
68
69 if (fYcbcrConversion) {
70 fYcbcrConversion->unref();
71 }
72}
#define GR_VK_CALL(IFACE, X)
Definition GrVkUtil.h:24
const skgpu::VulkanInterface * vkInterface() const
Definition GrVkGpu.h:60
VkDevice device() const
Definition GrVkGpu.h:71

◆ imageView()

VkImageView GrVkImageView::imageView ( ) const
inline

Definition at line 30 of file GrVkImageView.h.

30{ return fImageView; }

◆ Make()

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

Definition at line 13 of file GrVkImageView.cpp.

17 {
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
GrVkResourceProvider & resourceProvider()
Definition GrVkGpu.h:83
VkImageView imageView() const
GrVkSamplerYcbcrConversion * findOrCreateCompatibleSamplerYcbcrConversion(const GrVkYcbcrConversionInfo &ycbcrInfo)
VkSamplerYcbcrConversion ycbcrConversion() const
sk_sp< SkImage > image
Definition examples.cpp:29
uint32_t uint32_t * format
VkImageAspectFlags aspectMask
VkImageSubresourceRange subresourceRange
VkSamplerYcbcrConversion conversion
@ VK_IMAGE_VIEW_TYPE_2D
@ VK_IMAGE_ASPECT_COLOR_BIT
@ VK_IMAGE_ASPECT_STENCIL_BIT
@ VK_COMPONENT_SWIZZLE_IDENTITY
VkResult
@ VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO
@ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO

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