Flutter Engine
The Flutter Engine
Macros | Functions
GrVkImage.cpp File Reference
#include "src/gpu/ganesh/vk/GrVkImage.h"
#include "include/gpu/vk/VulkanMutableTextureState.h"
#include "src/gpu/ganesh/vk/GrVkGpu.h"
#include "src/gpu/ganesh/vk/GrVkImageView.h"
#include "src/gpu/ganesh/vk/GrVkTexture.h"
#include "src/gpu/ganesh/vk/GrVkUtil.h"
#include "src/gpu/vk/VulkanMemory.h"
#include "src/gpu/vk/VulkanMutableTextureStatePriv.h"
#include "src/gpu/vk/VulkanUtilsPriv.h"

Go to the source code of this file.

Macros

#define VK_CALL(GPU, X)   GR_VK_CALL(GPU->vkInterface(), X)
 

Functions

static bool make_views (GrVkGpu *gpu, const GrVkImageInfo &info, GrAttachment::UsageFlags attachmentUsages, sk_sp< const GrVkImageView > *framebufferView, sk_sp< const GrVkImageView > *textureView)
 
VkImageAspectFlags vk_format_to_aspect_flags (VkFormat format)
 
static void write_input_desc_set (GrVkGpu *gpu, VkImageView view, VkImageLayout layout, VkDescriptorSet descSet)
 

Macro Definition Documentation

◆ VK_CALL

#define VK_CALL (   GPU,
  X 
)    GR_VK_CALL(GPU->vkInterface(), X)

Definition at line 19 of file GrVkImage.cpp.

Function Documentation

◆ make_views()

static bool make_views ( GrVkGpu gpu,
const GrVkImageInfo info,
GrAttachment::UsageFlags  attachmentUsages,
sk_sp< const GrVkImageView > *  framebufferView,
sk_sp< const GrVkImageView > *  textureView 
)
static

Definition at line 95 of file GrVkImage.cpp.

99 {
100 GrVkImageView::Type viewType;
101 if (attachmentUsages & GrAttachment::UsageFlags::kStencilAttachment) {
102 // If we have stencil usage then we shouldn't have any other usages
105 } else {
107 }
108
111 // Attachments can only have a mip level of 1
112 *framebufferView = GrVkImageView::Make(
113 gpu, info.fImage, info.fFormat, viewType, 1, info.fYcbcrConversionInfo);
114 if (!*framebufferView) {
115 return false;
116 }
117 }
118
119 if (attachmentUsages & GrAttachment::UsageFlags::kTexture) {
120 *textureView = GrVkImageView::Make(gpu,
121 info.fImage,
122 info.fFormat,
123 viewType,
124 info.fLevelCount,
125 info.fYcbcrConversionInfo);
126 if (!*textureView) {
127 return false;
128 }
129 }
130 return true;
131}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT(cond)
Definition: SkAssert.h:116
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
static sk_sp< const GrVkImageView > Make(GrVkGpu *gpu, VkImage image, VkFormat format, Type viewType, uint32_t miplevels, const skgpu::VulkanYcbcrConversionInfo &ycbcrInfo)

◆ vk_format_to_aspect_flags()

VkImageAspectFlags vk_format_to_aspect_flags ( VkFormat  format)

Definition at line 367 of file GrVkImage.cpp.

367 {
368 switch (format) {
371 case VK_FORMAT_D24_UNORM_S8_UINT: // fallthrough
374 default:
376 }
377}
uint32_t uint32_t * format
@ 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_FORMAT_D24_UNORM_S8_UINT
Definition: vulkan_core.h:1588
@ VK_FORMAT_S8_UINT
Definition: vulkan_core.h:1586
@ VK_FORMAT_D32_SFLOAT_S8_UINT
Definition: vulkan_core.h:1589

◆ write_input_desc_set()

static void write_input_desc_set ( GrVkGpu gpu,
VkImageView  view,
VkImageLayout  layout,
VkDescriptorSet  descSet 
)
static

Definition at line 644 of file GrVkImage.cpp.

647 {
648 VkDescriptorImageInfo imageInfo;
649 memset(&imageInfo, 0, sizeof(VkDescriptorImageInfo));
650 imageInfo.sampler = VK_NULL_HANDLE;
651 imageInfo.imageView = view;
652 imageInfo.imageLayout = layout;
653
654 VkWriteDescriptorSet writeInfo;
655 memset(&writeInfo, 0, sizeof(VkWriteDescriptorSet));
657 writeInfo.pNext = nullptr;
658 writeInfo.dstSet = descSet;
660 writeInfo.dstArrayElement = 0;
661 writeInfo.descriptorCount = 1;
663 writeInfo.pImageInfo = &imageInfo;
664 writeInfo.pBufferInfo = nullptr;
665 writeInfo.pTexelBufferView = nullptr;
666
667 GR_VK_CALL(gpu->vkInterface(), UpdateDescriptorSets(gpu->device(), 1, &writeInfo, 0, nullptr));
668}
#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
VkImageLayout imageLayout
Definition: vulkan_core.h:3746
const VkBufferView * pTexelBufferView
Definition: vulkan_core.h:3797
VkStructureType sType
Definition: vulkan_core.h:3788
const VkDescriptorImageInfo * pImageInfo
Definition: vulkan_core.h:3795
const VkDescriptorBufferInfo * pBufferInfo
Definition: vulkan_core.h:3796
VkDescriptorSet dstSet
Definition: vulkan_core.h:3790
const void * pNext
Definition: vulkan_core.h:3789
VkDescriptorType descriptorType
Definition: vulkan_core.h:3794
@ VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
Definition: vulkan_core.h:2135
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46
@ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
Definition: vulkan_core.h:237