Flutter Engine
The Flutter Engine
VulkanTexture.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef skgpu_graphite_VulkanTexture_DEFINED
9#define skgpu_graphite_VulkanTexture_DEFINED
10
16
17#include <utility>
18
19namespace skgpu { class MutableTextureState; }
20
21namespace skgpu::graphite {
22
23class VulkanSharedContext;
24class VulkanCommandBuffer;
25class VulkanResourceProvider;
26
27class VulkanTexture : public Texture {
28public:
33 };
34
35 static bool MakeVkImage(const VulkanSharedContext*,
37 const TextureInfo&,
38 CreatedImageInfo* outInfo);
39
42 const TextureInfo&,
45
48 const TextureInfo&,
50 VkImage,
51 const VulkanAlloc&,
53
54 ~VulkanTexture() override {}
55
56 VkImage vkImage() const { return fImage; }
57
59 VkImageLayout newLayout,
60 VkAccessFlags dstAccessMask,
61 VkPipelineStageFlags dstStageMask,
62 bool byRegion) const {
63 this->setImageLayoutAndQueueIndex(buffer, newLayout, dstAccessMask, dstStageMask, byRegion,
65 }
66
68 VkImageLayout newLayout,
69 VkAccessFlags dstAccessMask,
70 VkPipelineStageFlags dstStageMask,
71 bool byRegion,
72 uint32_t newQueueFamilyIndex) const;
73
74 // This simply updates our internal tracking of the image layout and does not actually perform
75 // any gpu work.
77
79 uint32_t currentQueueFamilyIndex() const;
80
82
83 // Helpers to use for setting the layout of the VkImage
86
88 return (this->textureInfo().vulkanTextureSpec().fImageUsageFlags &
90 }
91
92private:
95 const TextureInfo& info,
97 VkImage,
98 const VulkanAlloc&,
102
103 void freeGpuData() override;
104
105 VkImage fImage;
106 VulkanAlloc fMemoryAlloc;
107 sk_sp<VulkanYcbcrConversion> fYcbcrConversion;
108
110};
111
112} // namespace skgpu::graphite
113
114#endif // skgpu_graphite_VulkanTexture_DEFINED
115
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
const SharedContext * sharedContext() const
Definition: Resource.h:189
SkISize dimensions() const
Definition: Texture.h:31
const TextureInfo & textureInfo() const
Definition: Texture.h:32
void updateImageLayout(VkImageLayout)
uint32_t currentQueueFamilyIndex() const
void setImageLayout(VulkanCommandBuffer *buffer, VkImageLayout newLayout, VkAccessFlags dstAccessMask, VkPipelineStageFlags dstStageMask, bool byRegion) const
Definition: VulkanTexture.h:58
void setImageLayoutAndQueueIndex(VulkanCommandBuffer *, VkImageLayout newLayout, VkAccessFlags dstAccessMask, VkPipelineStageFlags dstStageMask, bool byRegion, uint32_t newQueueFamilyIndex) const
static VkAccessFlags LayoutToSrcAccessMask(const VkImageLayout layout)
bool supportsInputAttachmentUsage() const
Definition: VulkanTexture.h:87
static bool MakeVkImage(const VulkanSharedContext *, SkISize dimensions, const TextureInfo &, CreatedImageInfo *outInfo)
static VkPipelineStageFlags LayoutToPipelineSrcStageFlags(const VkImageLayout layout)
static sk_sp< Texture > Make(const VulkanSharedContext *, SkISize dimensions, const TextureInfo &, skgpu::Budgeted, sk_sp< VulkanYcbcrConversion >)
VkImageLayout currentLayout() const
const VulkanImageView * getImageView(VulkanImageView::Usage) const
static sk_sp< Texture > MakeWrapped(const VulkanSharedContext *, SkISize dimensions, const TextureInfo &, sk_sp< MutableTextureState >, VkImage, const VulkanAlloc &, sk_sp< VulkanYcbcrConversion >)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
Definition: GpuTools.h:21
Budgeted
Definition: GpuTypes.h:35
Definition: SkSize.h:16
sk_sp< MutableTextureState > fMutableState
Definition: VulkanTexture.h:32
VkFlags VkPipelineStageFlags
Definition: vulkan_core.h:2470
VkImageLayout
Definition: vulkan_core.h:1330
VkFlags VkAccessFlags
Definition: vulkan_core.h:2235
@ VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
Definition: vulkan_core.h:2359
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46
#define VK_QUEUE_FAMILY_IGNORED
Definition: vulkan_core.h:127