27 {
30
32 SKGPU_LOG_E(
"Tried to create VkImage with empty dimensions.");
33 return false;
34 }
37 SKGPU_LOG_E(
"Tried to create VkImage with too large a size.");
38 return false;
39 }
40
42 SKGPU_LOG_E(
"Tried to create %s VkImage in %s Context.",
44 caps.protectedSupport() ? "protected" : "unprotected");
45 return false;
46 }
47
48 const VulkanTextureSpec& spec =
info.vulkanTextureSpec();
49
53
54
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
63
67 }
68
69 uint32_t numMipLevels = 1;
72 }
73
76
79 nullptr,
80 createflags,
82 spec.fFormat,
84 numMipLevels,
85 1,
86 vkSamples,
87 spec.fImageTiling,
88 spec.fImageUsageFlags,
89 spec.fSharingMode,
90 0,
91 nullptr,
92 initialLayout
93 };
94
96
103 return false;
104 }
105
107 bool forceDedicatedMemory = caps.shouldAlwaysUseDedicatedImageMemory();
108 bool useLazyAllocation =
110
113 };
117 forceDedicatedMemory,
118 useLazyAllocation,
119 checkResult,
120 &outInfo->fMemoryAlloc)) {
122 return false;
123 }
124
125 if (useLazyAllocation &&
127 SKGPU_LOG_E(
"Failed allocate lazy vulkan memory when requested");
129 return false;
130 }
131
135 BindImageMemory(
136 device,
image, outInfo->fMemoryAlloc.fMemory, outInfo->fMemoryAlloc.fOffset));
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,...)
static constexpr bool SkToBool(const T &x)
#define VULKAN_CALL(IFACE, X)
#define VULKAN_CALL_RESULT(SHARED_CONTEXT, RESULT, X)
sk_sp< const SkImage > image
SK_API MutableTextureState MakeVulkan(VkImageLayout layout, uint32_t queueFamilyIndex)
void FreeImageMemory(VulkanMemoryAllocator *, const VulkanAlloc &alloc)
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)
constexpr int32_t width() const
constexpr int32_t height() const
@ VK_IMAGE_CREATE_PROTECTED_BIT
@ VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
VkFlags VkImageCreateFlags
#define VK_QUEUE_FAMILY_IGNORED
@ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO