Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
skgpu::graphite::VulkanTexture Class Reference

#include <VulkanTexture.h>

Inheritance diagram for skgpu::graphite::VulkanTexture:
skgpu::graphite::Texture skgpu::graphite::Resource

Classes

struct  CreatedImageInfo
 

Public Member Functions

 ~VulkanTexture () override
 
VkImage vkImage () const
 
void setImageLayout (VulkanCommandBuffer *buffer, VkImageLayout newLayout, VkAccessFlags dstAccessMask, VkPipelineStageFlags dstStageMask, bool byRegion) const
 
void setImageLayoutAndQueueIndex (VulkanCommandBuffer *, VkImageLayout newLayout, VkAccessFlags dstAccessMask, VkPipelineStageFlags dstStageMask, bool byRegion, uint32_t newQueueFamilyIndex) const
 
void updateImageLayout (VkImageLayout)
 
VkImageLayout currentLayout () const
 
uint32_t currentQueueFamilyIndex () const
 
const VulkanImageViewgetImageView (VulkanImageView::Usage) const
 
bool supportsInputAttachmentUsage () const
 
- Public Member Functions inherited from skgpu::graphite::Texture
 ~Texture () override
 
int numSamples () const
 
Mipmapped mipmapped () const
 
SkISize dimensions () const
 
const TextureInfotextureInfo () const
 
void setReleaseCallback (sk_sp< RefCntedCallback >)
 
const char * getResourceType () const override
 
- Public Member Functions inherited from skgpu::graphite::Resource
 Resource (const Resource &)=delete
 
 Resource (Resource &&)=delete
 
Resourceoperator= (const Resource &)=delete
 
Resourceoperator= (Resource &&)=delete
 
void ref () const
 
void unref () const
 
void refCommandBuffer () const
 
void unrefCommandBuffer () const
 
Ownership ownership () const
 
skgpu::Budgeted budgeted () const
 
size_t gpuMemorySize () const
 
UniqueID uniqueID () const
 
std::string getLabel () const
 
void setLabel (std::string_view label)
 
bool wasDestroyed () const
 
const GraphiteResourceKeykey () const
 
void setKey (const GraphiteResourceKey &key)
 
void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const
 
virtual void prepareForReturnToCache (const std::function< void()> &takeRef)
 

Static Public Member Functions

static bool MakeVkImage (const VulkanSharedContext *, SkISize dimensions, const TextureInfo &, CreatedImageInfo *outInfo)
 
static sk_sp< TextureMake (const VulkanSharedContext *, const VulkanResourceProvider *, SkISize dimensions, const TextureInfo &, skgpu::Budgeted)
 
static sk_sp< TextureMakeWrapped (const VulkanSharedContext *, const VulkanResourceProvider *, SkISize dimensions, const TextureInfo &, sk_sp< MutableTextureState >, VkImage, const VulkanAlloc &)
 
static VkPipelineStageFlags LayoutToPipelineSrcStageFlags (const VkImageLayout layout)
 
static VkAccessFlags LayoutToSrcAccessMask (const VkImageLayout layout)
 

Private Member Functions

void freeGpuData () override
 

Additional Inherited Members

- Protected Member Functions inherited from skgpu::graphite::Texture
 Texture (const SharedContext *, SkISize dimensions, const TextureInfo &info, sk_sp< MutableTextureState > mutableState, Ownership, skgpu::Budgeted)
 
MutableTextureStatemutableState () const
 
void invokeReleaseProc () override
 
void onDumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump, const char *dumpName) const override
 
- Protected Member Functions inherited from skgpu::graphite::Resource
 Resource (const SharedContext *, Ownership, skgpu::Budgeted, size_t gpuMemorySize, std::string_view label, bool commandBufferRefsAsUsageRefs=false)
 
virtual ~Resource ()
 
const SharedContextsharedContext () const
 
void setDeleteASAP ()
 

Detailed Description

Definition at line 27 of file VulkanTexture.h.

Constructor & Destructor Documentation

◆ ~VulkanTexture()

skgpu::graphite::VulkanTexture::~VulkanTexture ( )
inlineoverride

Definition at line 54 of file VulkanTexture.h.

54{}

Member Function Documentation

◆ currentLayout()

VkImageLayout skgpu::graphite::VulkanTexture::currentLayout ( ) const

Definition at line 338 of file VulkanTexture.cpp.

338 {
340}
MutableTextureState * mutableState() const
Definition Texture.cpp:49
SK_API VkImageLayout GetVkImageLayout(const MutableTextureState &state)

◆ currentQueueFamilyIndex()

uint32_t skgpu::graphite::VulkanTexture::currentQueueFamilyIndex ( ) const

Definition at line 342 of file VulkanTexture.cpp.

342 {
344}
SK_API uint32_t GetVkQueueFamilyIndex(const MutableTextureState &state)

◆ freeGpuData()

void skgpu::graphite::VulkanTexture::freeGpuData ( )
overrideprivatevirtual

Implements skgpu::graphite::Resource.

Definition at line 321 of file VulkanTexture.cpp.

321 {
322 // Need to delete any ImageViews first
323 fImageViews.clear();
324
325 // If the texture is wrapped we don't own this data
326 if (this->ownership() != Ownership::kWrapped) {
327 auto sharedContext = static_cast<const VulkanSharedContext*>(this->sharedContext());
328 VULKAN_CALL(sharedContext->interface(),
329 DestroyImage(sharedContext->device(), fImage, nullptr));
330 skgpu::VulkanMemory::FreeImageMemory(sharedContext->memoryAllocator(), fMemoryAlloc);
331 }
332}
#define VULKAN_CALL(IFACE, X)
const SharedContext * sharedContext() const
Definition Resource.h:187
Ownership ownership() const
Definition Resource.h:98
void FreeImageMemory(VulkanMemoryAllocator *, const VulkanAlloc &alloc)

◆ getImageView()

const VulkanImageView * skgpu::graphite::VulkanTexture::getImageView ( VulkanImageView::Usage  usage) const

Definition at line 401 of file VulkanTexture.cpp.

401 {
402 for (int i = 0; i < fImageViews.size(); ++i) {
403 if (fImageViews[i]->usage() == usage) {
404 return fImageViews[i].get();
405 }
406 }
407
408 auto sharedContext = static_cast<const VulkanSharedContext*>(this->sharedContext());
409 VulkanTextureInfo vkTexInfo;
410 this->textureInfo().getVulkanTextureInfo(&vkTexInfo);
411 int miplevels = this->textureInfo().mipmapped() == Mipmapped::kYes
413 this->dimensions().height()) + 1
414 : 1;
415 auto imageView = VulkanImageView::Make(sharedContext,
416 fImage,
417 vkTexInfo.fFormat,
418 usage,
419 miplevels,
420 fSamplerYcbcrConversion);
421 return fImageViews.push_back(std::move(imageView)).get();
422}
static int ComputeLevelCount(int baseWidth, int baseHeight)
Definition SkMipmap.cpp:134
Mipmapped mipmapped() const
Definition TextureInfo.h:79
SkISize dimensions() const
Definition Texture.h:31
const TextureInfo & textureInfo() const
Definition Texture.h:32
static std::unique_ptr< const VulkanImageView > Make(const VulkanSharedContext *sharedContext, VkImage image, VkFormat format, Usage usage, uint32_t miplevels, sk_sp< VulkanSamplerYcbcrConversion >)
int32_t height
int32_t width
static void usage(char *argv0)

◆ LayoutToPipelineSrcStageFlags()

VkPipelineStageFlags skgpu::graphite::VulkanTexture::LayoutToPipelineSrcStageFlags ( const VkImageLayout  layout)
static

Definition at line 346 of file VulkanTexture.cpp.

346 {
347 if (VK_IMAGE_LAYOUT_GENERAL == layout) {
349 } else if (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL == layout ||
352 } else if (VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL == layout) {
357 } else if (VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL == layout) {
359 } else if (VK_IMAGE_LAYOUT_PREINITIALIZED == layout) {
361 } else if (VK_IMAGE_LAYOUT_PRESENT_SRC_KHR == layout) {
363 }
364
367}
#define SkASSERT(cond)
Definition SkAssert.h:116
@ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
@ VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
@ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
@ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
@ VK_IMAGE_LAYOUT_PREINITIALIZED
@ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
@ VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL
@ VK_IMAGE_LAYOUT_UNDEFINED
@ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL
@ VK_IMAGE_LAYOUT_GENERAL
@ VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT
@ VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT
@ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
@ VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT
@ VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
@ VK_PIPELINE_STAGE_HOST_BIT
@ VK_PIPELINE_STAGE_TRANSFER_BIT

◆ LayoutToSrcAccessMask()

VkAccessFlags skgpu::graphite::VulkanTexture::LayoutToSrcAccessMask ( const VkImageLayout  layout)
static

Definition at line 369 of file VulkanTexture.cpp.

369 {
370 // Currently we assume we will never being doing any explict shader writes (this doesn't include
371 // color attachment or depth/stencil writes). So we will ignore the
372 // VK_MEMORY_OUTPUT_SHADER_WRITE_BIT.
373
374 // We can only directly access the host memory if we are in preinitialized or general layout,
375 // and the image is linear.
376 // TODO: Add check for linear here so we are not always adding host to general, and we should
377 // only be in preinitialized if we are linear
379 if (VK_IMAGE_LAYOUT_GENERAL == layout) {
384 } else if (VK_IMAGE_LAYOUT_PREINITIALIZED == layout) {
386 } else if (VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL == layout) {
390 } else if (VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL == layout) {
392 } else if (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL == layout ||
395 // There are no writes that need to be made available
396 flags = 0;
397 }
398 return flags;
399}
FlutterSemanticsFlag flags
VkFlags VkAccessFlags
@ VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT
@ VK_ACCESS_TRANSFER_WRITE_BIT
@ VK_ACCESS_HOST_WRITE_BIT
@ VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT

◆ Make()

sk_sp< Texture > skgpu::graphite::VulkanTexture::Make ( const VulkanSharedContext sharedContext,
const VulkanResourceProvider resourceProvider,
SkISize  dimensions,
const TextureInfo info,
skgpu::Budgeted  budgeted 
)
static

Definition at line 149 of file VulkanTexture.cpp.

153 {
154 CreatedImageInfo imageInfo;
155 if (!MakeVkImage(sharedContext, dimensions, info, &imageInfo)) {
156 return nullptr;
157 }
158 auto ycbcrConversion = resourceProvider->findOrCreateCompatibleSamplerYcbcrConversion(
159 info.vulkanTextureSpec().fYcbcrConversionInfo);
160
161 return sk_sp<Texture>(new VulkanTexture(sharedContext,
163 info,
164 std::move(imageInfo.fMutableState),
165 imageInfo.fImage,
166 imageInfo.fMemoryAlloc,
168 budgeted,
169 std::move(ycbcrConversion)));
170}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
skgpu::Budgeted budgeted() const
Definition Resource.h:100
static bool MakeVkImage(const VulkanSharedContext *, SkISize dimensions, const TextureInfo &, CreatedImageInfo *outInfo)

◆ MakeVkImage()

bool skgpu::graphite::VulkanTexture::MakeVkImage ( const VulkanSharedContext sharedContext,
SkISize  dimensions,
const TextureInfo info,
CreatedImageInfo outInfo 
)
static

Definition at line 24 of file VulkanTexture.cpp.

27 {
28 SkASSERT(outInfo);
29 const VulkanCaps& caps = sharedContext->vulkanCaps();
30
31 if (dimensions.isEmpty()) {
32 SKGPU_LOG_E("Tried to create VkImage with empty dimensions.");
33 return false;
34 }
35 if (dimensions.width() > caps.maxTextureSize() ||
36 dimensions.height() > caps.maxTextureSize()) {
37 SKGPU_LOG_E("Tried to create VkImage with too large a size.");
38 return false;
39 }
40
41 if ((info.isProtected() == Protected::kYes) != caps.protectedSupport()) {
42 SKGPU_LOG_E("Tried to create %s VkImage in %s Context.",
43 info.isProtected() == Protected::kYes ? "protected" : "unprotected",
44 caps.protectedSupport() ? "protected" : "unprotected");
45 return false;
46 }
47
48 const VulkanTextureSpec& spec = info.vulkanTextureSpec();
49
50 bool isLinear = spec.fImageTiling == VK_IMAGE_TILING_LINEAR;
51 VkImageLayout initialLayout = isLinear ? VK_IMAGE_LAYOUT_PREINITIALIZED
53
54 // Create Image
55 VkSampleCountFlagBits vkSamples;
56 if (!SampleCountToVkSampleCount(info.numSamples(), &vkSamples)) {
57 SKGPU_LOG_E("Failed creating VkImage because we could not covert the number of samples: "
58 "%u to a VkSampleCountFlagBits.", info.numSamples());
59 return false;
60 }
61
62 SkASSERT(!isLinear || vkSamples == VK_SAMPLE_COUNT_1_BIT);
63
64 VkImageCreateFlags createflags = 0;
65 if (info.isProtected() == Protected::kYes && caps.protectedSupport()) {
66 createflags |= VK_IMAGE_CREATE_PROTECTED_BIT;
67 }
68
69 uint32_t numMipLevels = 1;
70 if (info.mipmapped() == Mipmapped::kYes) {
72 }
73
74 uint32_t width = static_cast<uint32_t>(dimensions.fWidth);
75 uint32_t height = static_cast<uint32_t>(dimensions.fHeight);
76
77 const VkImageCreateInfo imageCreateInfo = {
79 nullptr, // pNext
80 createflags, // VkImageCreateFlags
81 VK_IMAGE_TYPE_2D, // VkImageType
82 spec.fFormat, // VkFormat
83 { width, height, 1 }, // VkExtent3D
84 numMipLevels, // mipLevels
85 1, // arrayLayers
86 vkSamples, // samples
87 spec.fImageTiling, // VkImageTiling
88 spec.fImageUsageFlags, // VkImageUsageFlags
89 spec.fSharingMode, // VkSharingMode
90 0, // queueFamilyCount
91 nullptr, // pQueueFamilyIndices
92 initialLayout // initialLayout
93 };
94
95 auto device = sharedContext->device();
96
97 VkImage image = VK_NULL_HANDLE;
100 sharedContext, result, CreateImage(device, &imageCreateInfo, nullptr, &image));
101 if (result != VK_SUCCESS) {
102 SKGPU_LOG_E("Failed call to vkCreateImage with error: %d", result);
103 return false;
104 }
105
106 auto allocator = sharedContext->memoryAllocator();
107 bool forceDedicatedMemory = caps.shouldAlwaysUseDedicatedImageMemory();
108 bool useLazyAllocation =
109 SkToBool(spec.fImageUsageFlags & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT);
110
111 auto checkResult = [sharedContext](VkResult result) {
112 return sharedContext->checkVkResult(result);
113 };
115 image,
116 info.isProtected(),
117 forceDedicatedMemory,
118 useLazyAllocation,
119 checkResult,
120 &outInfo->fMemoryAlloc)) {
121 VULKAN_CALL(sharedContext->interface(), DestroyImage(device, image, nullptr));
122 return false;
123 }
124
125 if (useLazyAllocation &&
126 !SkToBool(outInfo->fMemoryAlloc.fFlags & skgpu::VulkanAlloc::kLazilyAllocated_Flag)) {
127 SKGPU_LOG_E("Failed allocate lazy vulkan memory when requested");
128 skgpu::VulkanMemory::FreeImageMemory(allocator, outInfo->fMemoryAlloc);
129 return false;
130 }
131
134 result,
135 BindImageMemory(
136 device, image, outInfo->fMemoryAlloc.fMemory, outInfo->fMemoryAlloc.fOffset));
137 if (result != VK_SUCCESS) {
138 skgpu::VulkanMemory::FreeImageMemory(allocator, outInfo->fMemoryAlloc);
139 VULKAN_CALL(sharedContext->interface(), DestroyImage(device, image, nullptr));
140 return false;
141 }
142
143 outInfo->fImage = image;
144 outInfo->fMutableState = sk_make_sp<MutableTextureState>(
146 return true;
147}
#define SKGPU_LOG_E(fmt,...)
Definition Log.h:38
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35
#define VULKAN_CALL_RESULT(SHARED_CONTEXT, RESULT, X)
VkDevice device
Definition main.cc:53
sk_sp< SkImage > image
Definition examples.cpp:29
GAsyncResult * result
SK_API MutableTextureState MakeVulkan(VkImageLayout layout, uint32_t queueFamilyIndex)
bool AllocImageMemory(VulkanMemoryAllocator *, VkImage image, skgpu::Protected isProtected, bool forceDedicatedMemory, bool useLazyAllocation, const std::function< CheckResult > &, VulkanAlloc *alloc)
static constexpr bool SampleCountToVkSampleCount(uint32_t samples, VkSampleCountFlagBits *vkSamples)
bool isEmpty() const
Definition SkSize.h:31
int32_t fHeight
Definition SkSize.h:18
int32_t fWidth
Definition SkSize.h:17
constexpr int32_t width() const
Definition SkSize.h:36
constexpr int32_t height() const
Definition SkSize.h:37
VkImageLayout
@ VK_IMAGE_CREATE_PROTECTED_BIT
@ VK_IMAGE_TILING_LINEAR
@ VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
VkSampleCountFlagBits
@ VK_SAMPLE_COUNT_1_BIT
@ VK_IMAGE_TYPE_2D
VkFlags VkImageCreateFlags
VkResult
@ VK_SUCCESS
#define VK_NULL_HANDLE
Definition vulkan_core.h:46
#define VK_QUEUE_FAMILY_IGNORED
@ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO

◆ MakeWrapped()

sk_sp< Texture > skgpu::graphite::VulkanTexture::MakeWrapped ( const VulkanSharedContext sharedContext,
const VulkanResourceProvider resourceProvider,
SkISize  dimensions,
const TextureInfo info,
sk_sp< MutableTextureState mutableState,
VkImage  image,
const VulkanAlloc alloc 
)
static

Definition at line 172 of file VulkanTexture.cpp.

178 {
179 auto ycbcrConversion = resourceProvider->findOrCreateCompatibleSamplerYcbcrConversion(
180 info.vulkanTextureSpec().fYcbcrConversionInfo);
181
182 return sk_sp<Texture>(new VulkanTexture(sharedContext,
184 info,
185 std::move(mutableState),
186 image,
187 alloc,
190 std::move(ycbcrConversion)));
191}

◆ setImageLayout()

void skgpu::graphite::VulkanTexture::setImageLayout ( VulkanCommandBuffer buffer,
VkImageLayout  newLayout,
VkAccessFlags  dstAccessMask,
VkPipelineStageFlags  dstStageMask,
bool  byRegion 
) const
inline

Definition at line 58 of file VulkanTexture.h.

62 {
63 this->setImageLayoutAndQueueIndex(buffer, newLayout, dstAccessMask, dstStageMask, byRegion,
65 }
void setImageLayoutAndQueueIndex(VulkanCommandBuffer *, VkImageLayout newLayout, VkAccessFlags dstAccessMask, VkPipelineStageFlags dstStageMask, bool byRegion, uint32_t newQueueFamilyIndex) const
static const uint8_t buffer[]

◆ setImageLayoutAndQueueIndex()

void skgpu::graphite::VulkanTexture::setImageLayoutAndQueueIndex ( VulkanCommandBuffer cmdBuffer,
VkImageLayout  newLayout,
VkAccessFlags  dstAccessMask,
VkPipelineStageFlags  dstStageMask,
bool  byRegion,
uint32_t  newQueueFamilyIndex 
) const

Definition at line 206 of file VulkanTexture.cpp.

211 {
212
213 SkASSERT(newLayout == this->currentLayout() ||
214 (VK_IMAGE_LAYOUT_UNDEFINED != newLayout &&
215 VK_IMAGE_LAYOUT_PREINITIALIZED != newLayout));
217 uint32_t currentQueueIndex = this->currentQueueFamilyIndex();
218
219 VulkanTextureInfo textureInfo;
220 this->textureInfo().getVulkanTextureInfo(&textureInfo);
221 auto sharedContext = static_cast<const VulkanSharedContext*>(this->sharedContext());
222
223 // Enable the following block on new devices to test that their lazy images stay at 0 memory use
224#if 0
225 auto device = sharedContext->device();
226 if (fAlloc.fFlags & skgpu::VulkanAlloc::kLazilyAllocated_Flag) {
228 VULKAN_CALL(sharedContext->interface(), GetDeviceMemoryCommitment(device, fAlloc.fMemory, &size));
229
230 SkDebugf("Lazy Image. This: %p, image: %d, size: %d\n", this, fImage, size);
231 }
232#endif
233#ifdef SK_DEBUG
234 if (textureInfo.fSharingMode == VK_SHARING_MODE_CONCURRENT) {
235 if (newQueueFamilyIndex == VK_QUEUE_FAMILY_IGNORED) {
236 SkASSERT(currentQueueIndex == VK_QUEUE_FAMILY_IGNORED ||
237 currentQueueIndex == VK_QUEUE_FAMILY_EXTERNAL ||
238 currentQueueIndex == VK_QUEUE_FAMILY_FOREIGN_EXT);
239 } else {
240 SkASSERT(newQueueFamilyIndex == VK_QUEUE_FAMILY_EXTERNAL ||
241 newQueueFamilyIndex == VK_QUEUE_FAMILY_FOREIGN_EXT);
242 SkASSERT(currentQueueIndex == VK_QUEUE_FAMILY_IGNORED);
243 }
244 } else {
246 if (newQueueFamilyIndex == VK_QUEUE_FAMILY_IGNORED ||
247 currentQueueIndex == sharedContext->queueIndex()) {
248 SkASSERT(currentQueueIndex == VK_QUEUE_FAMILY_IGNORED ||
249 currentQueueIndex == VK_QUEUE_FAMILY_EXTERNAL ||
250 currentQueueIndex == VK_QUEUE_FAMILY_FOREIGN_EXT ||
251 currentQueueIndex == sharedContext->queueIndex());
252 } else if (newQueueFamilyIndex == VK_QUEUE_FAMILY_EXTERNAL ||
253 newQueueFamilyIndex == VK_QUEUE_FAMILY_FOREIGN_EXT) {
254 SkASSERT(currentQueueIndex == VK_QUEUE_FAMILY_IGNORED ||
255 currentQueueIndex == sharedContext->queueIndex());
256 }
257 }
258#endif
259
260 if (textureInfo.fSharingMode == VK_SHARING_MODE_EXCLUSIVE) {
261 if (newQueueFamilyIndex == VK_QUEUE_FAMILY_IGNORED) {
262 newQueueFamilyIndex = sharedContext->queueIndex();
263 }
264 if (currentQueueIndex == VK_QUEUE_FAMILY_IGNORED) {
265 currentQueueIndex = sharedContext->queueIndex();
266 }
267 }
268
269 // If the old and new layout are the same and the layout is a read only layout, there is no need
270 // to put in a barrier unless we also need to switch queues.
271 if (newLayout == currentLayout && currentQueueIndex == newQueueFamilyIndex &&
275 return;
276 }
277
280
282 uint32_t numMipLevels = 1;
283 SkISize dimensions = this->dimensions();
284 if (this->mipmapped() == Mipmapped::kYes) {
286 }
287 VkImageMemoryBarrier imageMemoryBarrier = {
289 nullptr, // pNext
290 srcAccessMask, // srcAccessMask
291 dstAccessMask, // dstAccessMask
292 currentLayout, // oldLayout
293 newLayout, // newLayout
294 currentQueueIndex, // srcQueueFamilyIndex
295 newQueueFamilyIndex, // dstQueueFamilyIndex
296 fImage, // image
297 { aspectFlags, 0, numMipLevels, 0, 1 } // subresourceRange
298 };
299 SkASSERT(srcAccessMask == imageMemoryBarrier.srcAccessMask);
300 cmdBuffer->addImageMemoryBarrier(this, srcStageMask, dstStageMask, byRegion,
301 &imageMemoryBarrier);
302
305}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
Mipmapped mipmapped() const
Definition Texture.h:29
uint32_t currentQueueFamilyIndex() const
static VkAccessFlags LayoutToSrcAccessMask(const VkImageLayout layout)
static VkPipelineStageFlags LayoutToPipelineSrcStageFlags(const VkImageLayout layout)
VkImageLayout currentLayout() const
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259
void SetVkImageLayout(MutableTextureState *state, VkImageLayout layout)
void SetVkQueueFamilyIndex(MutableTextureState *state, uint32_t queueFamilyIndex)
VkImageAspectFlags vk_format_to_aspect_flags(VkFormat format)
VkAccessFlags srcAccessMask
VkFlags VkPipelineStageFlags
@ VK_SHARING_MODE_CONCURRENT
@ VK_SHARING_MODE_EXCLUSIVE
VkFlags VkImageAspectFlags
uint64_t VkDeviceSize
Definition vulkan_core.h:96
#define VK_QUEUE_FAMILY_FOREIGN_EXT
#define VK_QUEUE_FAMILY_EXTERNAL
@ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER

◆ supportsInputAttachmentUsage()

bool skgpu::graphite::VulkanTexture::supportsInputAttachmentUsage ( ) const
inline

Definition at line 87 of file VulkanTexture.h.

87 {
88 return (this->textureInfo().vulkanTextureSpec().fImageUsageFlags &
90 }
@ VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT

◆ updateImageLayout()

void skgpu::graphite::VulkanTexture::updateImageLayout ( VkImageLayout  newLayout)

Definition at line 334 of file VulkanTexture.cpp.

334 {
336}

◆ vkImage()

VkImage skgpu::graphite::VulkanTexture::vkImage ( ) const
inline

Definition at line 56 of file VulkanTexture.h.

56{ return fImage; }

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