26#ifdef SK_BUILD_FOR_ANDROID
27#include <sys/system_properties.h>
34 VkPhysicalDevice physDev,
35 uint32_t physicalDeviceVersion,
40 this->init(contextOptions, vkInterface, physDev, physicalDeviceVersion, features, extensions,
48 VkPhysicalDevice physDev,
49 uint32_t physicalDeviceVersion,
54 VULKAN_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &physDevProperties));
56#if defined(GRAPHITE_TEST_UTILS)
57 this->setDeviceName(physDevProperties.
deviceName);
61 if (isProtected == Protected::kYes) {
63 fShouldAlwaysUseDedicatedImageMemory =
true;
67 fPhysicalDeviceMemoryProperties2.
pNext =
nullptr;
69 GetPhysicalDeviceMemoryProperties2(physDev, &fPhysicalDeviceMemoryProperties2));
87 VULKAN_CALL(vkInterface, GetPhysicalDeviceMemoryProperties(physDev, &deviceMemoryProperties));
88 fSupportsMemorylessAttachments =
false;
98 fSupportsMemorylessAttachments =
true;
102#ifdef SK_BUILD_FOR_UNIX
103 if (kNvidia_VkVendor == physDevProperties.
vendorID) {
105 fShouldAlwaysUseDedicatedImageMemory =
true;
109 if (physDevProperties.
vendorID == kNvidia_VkVendor ||
110 physDevProperties.
vendorID == kAMD_VkVendor) {
113 fGpuOnlyBuffersMorePerformant =
true;
120 fShouldPersistentlyMapCpuToGpuBuffers =
false;
123 this->initFormatTable(vkInterface, physDev, physDevProperties);
124 this->initDepthStencilFormatTable(vkInterface, physDev, physDevProperties);
127 this->applyDriverCorrectnessWorkarounds(physDevProperties);
130 if (physDevProperties.
vendorID == kAMD_VkVendor) {
132 fMaxVertexAttributes = 32;
138#ifdef SK_BUILD_FOR_ANDROID
148 skgpu::GetExtensionFeatureStruct<VkPhysicalDeviceSamplerYcbcrConversionFeatures>(
151 if (ycbcrFeatures && ycbcrFeatures->samplerYcbcrConversion) {
152 fSupportsYcbcrConversion =
true;
157 fSupportsDeviceFaultInfo =
true;
166 int androidAPIVersion = 0;
167#if defined(SK_BUILD_FOR_ANDROID)
168 char androidAPIVersionStr[PROP_VALUE_MAX];
169 int strLength = __system_property_get(
"ro.build.version.sdk", androidAPIVersionStr);
172 androidAPIVersion = (strLength == 0) ? 0 : atoi(androidAPIVersionStr);
176 if (kARM_VkVendor == properties.
vendorID && androidAPIVersion <= 28) {
177 fShouldAlwaysUseDedicatedImageMemory =
true;
219 const FormatInfo& formatInfo = this->getFormatInfo(
format);
220 static constexpr int defaultSampleCount = 1;
230 info.fMipmapped = mipmapped;
239 info.fImageUsageFlags =
info.fImageUsageFlags |
252 if (!textureInfo.getVulkanTextureInfo(&
info)) {
257 info.fMipmapped = mipmapped;
269 switch (compression) {
286 const FormatInfo& formatInfo = this->getFormatInfo(
format);
287 static constexpr int defaultSampleCount = 1;
295 info.fMipmapped = mipmapped;
314 const VkFormat singleSpecFormat = singleSampledInfo.vulkanTextureSpec().fFormat;
315 const FormatInfo& formatInfo = this->getFormatInfo(singleSpecFormat);
316 if ((singleSampledInfo.
isProtected() == Protected::kYes && !this->protectedSupport()) ||
323 info.fMipmapped = Mipmapped::kNo;
326 info.fFormat = singleSpecFormat;
347 uint32_t sampleCount,
350 const DepthStencilFormatInfo& formatInfo = this->getDepthStencilFormatInfo(
format);
352 !formatInfo.isDepthStencilSupported(formatInfo.fFormatProperties.optimalTilingFeatures) ||
353 !formatInfo.fSupportedSampleCounts.isSampleCountSupported(sampleCount)) {
359 info.fMipmapped = Mipmapped::kNo;
373 const FormatInfo& formatInfo = this->getFormatInfo(
format);
381 info.fMipmapped = Mipmapped::kNo;
400 VkPhysicalDevice physDev,
402 static_assert(std::size(
kVkFormats) == VulkanCaps::kNumVkFormats,
403 "Size of VkFormats array must match static value in header");
412 info.init(interface, physDev, properties,
format);
414 info.fColorTypeInfoCount = 2;
415 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
420 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
421 ctInfo.fColorType = ct;
422 ctInfo.fTransferColorType = ct;
423 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
428 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
429 ctInfo.fColorType = ct;
430 ctInfo.fTransferColorType = ct;
431 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag;
441 info.init(interface, physDev, properties,
format);
443 info.fColorTypeInfoCount = 3;
444 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
449 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
450 ctInfo.fColorType = ct;
451 ctInfo.fTransferColorType = ct;
452 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
457 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
458 ctInfo.fColorType = ct;
459 ctInfo.fTransferColorType = ct;
460 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
467 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
468 ctInfo.fColorType = ct;
469 ctInfo.fTransferColorType = ct;
470 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag;
480 info.init(interface, physDev, properties,
format);
482 info.fColorTypeInfoCount = 1;
483 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
488 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
489 ctInfo.fColorType = ct;
490 ctInfo.fTransferColorType = ct;
491 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
499 info.init(interface, physDev, properties,
format);
501 info.fColorTypeInfoCount = 1;
502 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
507 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
508 ctInfo.fColorType = ct;
509 ctInfo.fTransferColorType = ct;
510 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
518 info.init(interface, physDev, properties,
format);
520 info.fColorTypeInfoCount = 2;
521 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
526 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
527 ctInfo.fColorType = ct;
528 ctInfo.fTransferColorType = ct;
529 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
537 info.init(interface, physDev, properties,
format);
539 info.fColorTypeInfoCount = 1;
540 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
545 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
546 ctInfo.fColorType = ct;
547 ctInfo.fTransferColorType = ct;
548 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
558 info.init(interface, physDev, properties,
format);
560 info.fColorTypeInfoCount = 1;
561 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
566 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
567 ctInfo.fColorType = ct;
573 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
581 info.init(interface, physDev, properties,
format);
583 info.fColorTypeInfoCount = 1;
584 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
589 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
590 ctInfo.fColorType = ct;
591 ctInfo.fTransferColorType = ct;
592 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
600 info.init(interface, physDev, properties,
format);
602 info.fColorTypeInfoCount = 1;
603 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
608 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
609 ctInfo.fColorType = ct;
610 ctInfo.fTransferColorType = ct;
611 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
619 info.init(interface, physDev, properties,
format);
621 info.fColorTypeInfoCount = 1;
622 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
627 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
628 ctInfo.fColorType = ct;
629 ctInfo.fTransferColorType = ct;
630 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
638 info.init(interface, physDev, properties,
format);
640 info.fColorTypeInfoCount = 1;
641 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
646 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
647 ctInfo.fColorType = ct;
648 ctInfo.fTransferColorType = ct;
649 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
660 info.init(interface, physDev, properties,
format);
662 info.fColorTypeInfoCount = 1;
663 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
668 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
669 ctInfo.fColorType = ct;
670 ctInfo.fTransferColorType = ct;
671 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
679 info.init(interface, physDev, properties,
format);
681 info.fColorTypeInfoCount = 1;
682 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
687 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
688 ctInfo.fColorType = ct;
689 ctInfo.fTransferColorType = ct;
690 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
698 info.init(interface, physDev, properties,
format);
700 info.fColorTypeInfoCount = 1;
701 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
706 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
707 ctInfo.fColorType = ct;
708 ctInfo.fTransferColorType = ct;
709 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
719 info.init(interface, physDev, properties,
format);
721 info.fColorTypeInfoCount = 1;
722 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
727 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
728 ctInfo.fColorType = ct;
729 ctInfo.fTransferColorType = ct;
730 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
738 info.init(interface, physDev, properties,
format);
740 info.fColorTypeInfoCount = 1;
741 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
746 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
747 ctInfo.fColorType = ct;
748 ctInfo.fTransferColorType = ct;
749 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
757 info.init(interface, physDev, properties,
format);
759 info.fColorTypeInfoCount = 1;
760 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
765 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
766 ctInfo.fColorType = ct;
767 ctInfo.fTransferColorType = ct;
768 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
776 if (fSupportsYcbcrConversion) {
777 info.init(interface, physDev, properties,
format);
780 info.fColorTypeInfoCount = 1;
781 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
786 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
787 ctInfo.fColorType = ct;
788 ctInfo.fTransferColorType = ct;
789 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag;
798 if (fSupportsYcbcrConversion) {
799 info.init(interface, physDev, properties,
format);
802 info.fColorTypeInfoCount = 1;
803 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
808 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
809 ctInfo.fColorType = ct;
810 ctInfo.fTransferColorType = ct;
811 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag;
820 info.init(interface, physDev, properties,
format);
822 info.fColorTypeInfoCount = 1;
823 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
828 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
829 ctInfo.fColorType = ct;
830 ctInfo.fTransferColorType = ct;
831 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag;
840 info.init(interface, physDev, properties,
format);
842 info.fColorTypeInfoCount = 1;
843 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
848 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
849 ctInfo.fColorType = ct;
850 ctInfo.fTransferColorType = ct;
851 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag;
860 info.init(interface, physDev, properties,
format);
862 info.fColorTypeInfoCount = 1;
863 info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info.fColorTypeInfoCount);
868 auto& ctInfo =
info.fColorTypeInfos[ctIdx++];
869 ctInfo.fColorType = ct;
870 ctInfo.fTransferColorType = ct;
871 ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag;
912 VkPhysicalDevice physDev,
915 "Size of DepthStencilVkFormats array must match static value in header");
926 auto&
info = this->getDepthStencilFormatInfo(
format);
927 info.init(interface, physDev, properties,
format);
928 if (
info.fFormatProperties.optimalTilingFeatures &
930 set_ds_flags_to_format(fDepthStencilFlagsToFormatTable[stencilFlags.value()],
format);
936 auto&
info = this->getDepthStencilFormatInfo(
format);
937 info.init(interface, physDev, properties,
format);
938 if (
info.fFormatProperties.optimalTilingFeatures &
940 set_ds_flags_to_format(fDepthStencilFlagsToFormatTable[stencilFlags.value()],
format);
941 set_ds_flags_to_format(fDepthStencilFlagsToFormatTable[depthFlags.value()],
format);
942 set_ds_flags_to_format(fDepthStencilFlagsToFormatTable[dsFlags.value()],
format);
948 auto&
info = this->getDepthStencilFormatInfo(
format);
949 info.init(interface, physDev, properties,
format);
950 if (
info.fFormatProperties.optimalTilingFeatures &
952 set_ds_flags_to_format(fDepthStencilFlagsToFormatTable[stencilFlags.value()],
format);
953 set_ds_flags_to_format(fDepthStencilFlagsToFormatTable[depthFlags.value()],
format);
954 set_ds_flags_to_format(fDepthStencilFlagsToFormatTable[dsFlags.value()],
format);
960 VkPhysicalDevice physDev,
972 GetPhysicalDeviceImageFormatProperties(physDev,
980 SKGPU_LOG_W(
"Vulkan call GetPhysicalDeviceImageFormatProperties failed: %d",
result);
986 fSampleCounts.push_back(1);
988 if (kImagination_VkVendor == physProps.
vendorID) {
992 if (kIntel_VkVendor == physProps.
vendorID) {
997 fSampleCounts.push_back(2);
1000 fSampleCounts.push_back(4);
1003 fSampleCounts.push_back(8);
1006 fSampleCounts.push_back(16);
1012bool VulkanCaps::SupportedSampleCounts::isSampleCountSupported(
int requestedCount)
const {
1013 requestedCount = std::max(1, requestedCount);
1014 for (
int i = 0; i < fSampleCounts.size(); i++) {
1015 if (fSampleCounts[i] == requestedCount) {
1017 }
else if (requestedCount < fSampleCounts[i]) {
1049 VkPhysicalDevice physDev,
1053 VULKAN_CALL(interface, GetPhysicalDeviceFormatProperties(physDev,
format, &fFormatProperties));
1055 if (is_renderable(fFormatProperties.optimalTilingFeatures)) {
1062 this->fSupportedSampleCounts.initSampleCounts(interface, physDev, properties,
format,
1067bool VulkanCaps::FormatInfo::isTexturable(
VkImageTiling imageTiling)
const {
1068 switch (imageTiling) {
1070 return is_texturable(fFormatProperties.optimalTilingFeatures);
1072 return is_texturable(fFormatProperties.linearTilingFeatures);
1079bool VulkanCaps::FormatInfo::isRenderable(
VkImageTiling imageTiling,
1080 uint32_t sampleCount)
const {
1081 if (!fSupportedSampleCounts.isSampleCountSupported(sampleCount)) {
1084 switch (imageTiling) {
1086 return is_renderable(fFormatProperties.optimalTilingFeatures);
1088 return is_renderable(fFormatProperties.linearTilingFeatures);
1095bool VulkanCaps::FormatInfo::isStorage(
VkImageTiling imageTiling)
const {
1096 switch (imageTiling) {
1098 return is_storage(fFormatProperties.optimalTilingFeatures);
1100 return is_storage(fFormatProperties.linearTilingFeatures);
1107bool VulkanCaps::FormatInfo::isTransferSrc(
VkImageTiling imageTiling)
const {
1108 switch (imageTiling) {
1110 return is_transfer_src(fFormatProperties.optimalTilingFeatures);
1112 return is_transfer_src(fFormatProperties.linearTilingFeatures);
1119bool VulkanCaps::FormatInfo::isTransferDst(
VkImageTiling imageTiling)
const {
1120 switch (imageTiling) {
1122 return is_transfer_dst(fFormatProperties.optimalTilingFeatures);
1124 return is_transfer_dst(fFormatProperties.linearTilingFeatures);
1133 for (
auto it = formats.begin(); it != formats.end(); ++it) {
1134 const auto&
info = this->getFormatInfo(*it);
1135 for (
int i = 0; i <
info.fColorTypeInfoCount; ++i) {
1137 fColorTypeToFormatTable[idx] = *it;
1146 return fColorTypeToFormatTable[idx];
1149VulkanCaps::FormatInfo& VulkanCaps::getFormatInfo(
VkFormat format) {
1150 static_assert(std::size(
kVkFormats) == VulkanCaps::kNumVkFormats,
1151 "Size of VkFormats array must match static value in header");
1152 for (
size_t i = 0; i < std::size(
kVkFormats); ++i) {
1154 return fFormatTable[i];
1157 static FormatInfo kInvalidFormat;
1158 return kInvalidFormat;
1161const VulkanCaps::FormatInfo& VulkanCaps::getFormatInfo(
VkFormat format)
const {
1163 return nonConstThis->getFormatInfo(
format);
1167 VkPhysicalDevice physDev,
1171 VULKAN_CALL(interface, GetPhysicalDeviceFormatProperties(physDev,
format, &fFormatProperties));
1173 if (this->isDepthStencilSupported(fFormatProperties.optimalTilingFeatures)) {
1175 fSupportedSampleCounts.initSampleCounts(interface, physDev, properties,
format, usageFlags);
1185 return fDepthStencilFlagsToFormatTable[
flags.value()];
1188VulkanCaps::DepthStencilFormatInfo& VulkanCaps::getDepthStencilFormatInfo(
VkFormat format) {
1190 "Size of VkFormats array must match static value in header");
1193 return fDepthStencilFormatTable[i];
1196 static DepthStencilFormatInfo kInvalidFormat;
1197 return kInvalidFormat;
1200const VulkanCaps::DepthStencilFormatInfo& VulkanCaps::getDepthStencilFormatInfo(
VkFormat format)
1203 return nonConstThis->getDepthStencilFormatInfo(
format);
1208 VkFormat vkFormat = textureInfo.vulkanTextureSpec().fFormat;
1213 const FormatInfo&
info = this->getFormatInfo(vkFormat);
1214 for (
int i = 0; i <
info.fColorTypeInfoCount; ++i) {
1226 if (!texInfo.getVulkanTextureInfo(&vkInfo)) {
1234 const FormatInfo&
info = this->getFormatInfo(vkInfo.
fFormat);
1241 if (!texInfo.getVulkanTextureInfo(&vkInfo)) {
1245 const FormatInfo&
info = this->getFormatInfo(vkInfo.
fFormat);
1251 if (!texInfo.getVulkanTextureInfo(&vkInfo)) {
1255 const FormatInfo&
info = this->getFormatInfo(vkInfo.
fFormat);
1260 const FormatInfo&
info = this->getFormatInfo(vkInfo.
fFormat);
1265 const FormatInfo&
info = this->getFormatInfo(vkInfo.
fFormat);
1271 if (!texInfo.getVulkanTextureInfo(&vkInfo)) {
1297 if (!texInfo.getVulkanTextureInfo(&vkInfo)) {
1326 if (!dstTextureInfo.getVulkanTextureInfo(&vkInfo)) {
1336 const FormatInfo&
info = this->getFormatInfo(vkInfo.
fFormat);
1337 for (
int i = 0; i <
info.fColorTypeInfoCount; ++i) {
1338 const auto& ctInfo =
info.fColorTypeInfos[i];
1339 if (ctInfo.fColorType == dstColorType) {
1352 if (!srcTextureInfo.getVulkanTextureInfo(&vkInfo)) {
1368 const FormatInfo&
info = this->getFormatInfo(vkInfo.
fFormat);
1369 for (
int i = 0; i <
info.fColorTypeInfoCount; ++i) {
1370 const auto& ctInfo =
info.fColorTypeInfos[i];
1371 if (ctInfo.fColorType == srcColorType) {
1389 static constexpr int kUint32sNeededForPipelineInfo = 3;
1394 kUint32sNeededForPipelineInfo + rpMetaData.fUint32DataCnt,
1395 "GraphicsPipeline");
1419 builder[0] = samplerDesc.
desc();
1436 uint32_t formatKey =
static_cast<uint32_t
>(vkSpec.
fFormat);
1441 bool isMipped =
info.mipmapped() == Mipmapped::kYes;
1448 SkASSERT(
static_cast<uint32_t
>(isMipped) < (1u << 1));
1449 SkASSERT(
static_cast<uint32_t
>(isProtected) < (1u << 1));
1456 static int kNum32DataCnt = 2 + 1 + 2;
1460 builder[0] = dimensions.
width();
1461 builder[1] = dimensions.
height();
1462 builder[2] = formatKey;
1463 builder[3] = (
static_cast<uint32_t
>(vkSpec.
fFlags));
1464 builder[4] = (samplesKey << 0) |
1465 (
static_cast<uint32_t
>(isMipped) << 3) |
1466 (
static_cast<uint32_t
>(isProtected) << 4) |
1469 (
static_cast<uint32_t
>(vkSpec.
fAspectMask) << 7) |
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SKGPU_LOG_W(fmt,...)
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kSRGBA_8888_SkColorType
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
@ kBGRA_1010102_SkColorType
10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
@ kA16_float_SkColorType
pixel with a half float for alpha
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
@ kUnknown_SkColorType
uninitialized
@ kR16G16_float_SkColorType
pixel with a half float for red and green
static constexpr int kSkColorTypeCnt
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr bool SkToBool(const T &x)
#define VULKAN_CALL(IFACE, X)
#define VULKAN_CALL_RESULT_NOCHECK(IFACE, RESULT, X)
constexpr uint16_t asKey() const
static constexpr Swizzle BGRA()
static constexpr Swizzle RGB1()
static Domain GenerateDomain()
size_t fRequiredStorageBufferAlignment
bool fSupportsAHardwareBufferImages
size_t fRequiredUniformBufferAlignment
bool isTexturable(const TextureInfo &) const
bool protectedSupport() const
static uint32_t SamplesToKey(uint32_t numSamples)
void finishInitialization(const ContextOptions &)
size_t fRequiredTransferBufferAlignment
ResourceBindingRequirements fResourceBindingReqs
UniquePaintParamsID paintParamsID() const
uint32_t renderStepID() const
static ResourceType GenerateResourceType()
uint32_t numSamples() const
Protected isProtected() const
TextureInfo getDefaultDepthStencilTextureInfo(SkEnumBitMask< DepthStencilFlags >, uint32_t sampleCount, Protected) const override
const ColorTypeInfo * getColorTypeInfo(SkColorType, const TextureInfo &) const override
std::pair< SkColorType, bool > supportedWritePixelsColorType(SkColorType dstColorType, const TextureInfo &dstTextureInfo, SkColorType srcColorType) const override
void buildKeyForTexture(SkISize dimensions, const TextureInfo &, ResourceType, Shareable, GraphiteResourceKey *) const override
TextureInfo getTextureInfoForSampledCopy(const TextureInfo &textureInfo, Mipmapped mipmapped) const override
UniqueKey makeGraphicsPipelineKey(const GraphicsPipelineDesc &, const RenderPassDesc &) const override
GraphiteResourceKey makeSamplerKey(const SamplerDesc &) const override
bool isStorage(const TextureInfo &) const override
bool supportsWritePixels(const TextureInfo &) const override
bool isRenderable(const TextureInfo &) const override
TextureInfo getDefaultSampledTextureInfo(SkColorType, Mipmapped mipmapped, Protected, Renderable) const override
bool isTransferSrc(const VulkanTextureInfo &) const
bool supportsReadPixels(const TextureInfo &) const override
bool isTransferDst(const VulkanTextureInfo &) const
TextureInfo getDefaultCompressedTextureInfo(SkTextureCompressionType, Mipmapped mipmapped, Protected) const override
TextureInfo getDefaultMSAATextureInfo(const TextureInfo &singleSampledInfo, Discardable discardable) const override
bool onIsTexturable(const TextureInfo &) const override
uint32_t channelMask(const TextureInfo &) const override
std::pair< SkColorType, bool > supportedReadPixelsColorType(SkColorType srcColorType, const TextureInfo &srcTextureInfo, SkColorType dstColorType) const override
TextureInfo getDefaultStorageTextureInfo(SkColorType) const override
VulkanCaps(const ContextOptions &, const skgpu::VulkanInterface *, VkPhysicalDevice, uint32_t physicalDeviceVersion, const VkPhysicalDeviceFeatures2 *, const skgpu::VulkanExtensions *, Protected)
static void AddRenderPassInfoToKey(VulkanRenderPassMetaData &rpMetaData, ResourceKey::Builder &builder, int &builderIdx, bool compatibleOnly)
FlutterSemanticsFlag flags
uint32_t uint32_t * format
static constexpr VkFormat kDepthStencilVkFormats[]
static constexpr VkFormat kVkFormats[]
static const skgpu::UniqueKey::Domain kGraphicsPipelineDomain
static constexpr uint32_t VkFormatChannels(VkFormat vkFormat)
static constexpr bool VkFormatNeedsYcbcrSampler(VkFormat format)
static constexpr bool VkFormatIsCompressed(VkFormat vkFormat)
static void usage(char *argv0)
constexpr int32_t width() const
constexpr int32_t height() const
VkMemoryPropertyFlags propertyFlags
uint32_t maxUniformBufferRange
VkDeviceSize minStorageBufferOffsetAlignment
VkDeviceSize minUniformBufferOffsetAlignment
uint32_t maxImageDimension2D
uint32_t maxVertexInputAttributes
VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]
char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]
VkPhysicalDeviceLimits limits
bool fDisableDriverCorrectnessWorkarounds
Layout fUniformBufferLayout
bool fDistinctIndexRanges
Layout fStorageBufferLayout
bool fSeparateTextureAndSamplerBinding
VkImageUsageFlags fImageUsageFlags
VkImageTiling fImageTiling
VkSharingMode fSharingMode
VkImageCreateFlags fFlags
VkImageAspectFlags fAspectMask
VkImageUsageFlags fImageUsageFlags
VkImageTiling fImageTiling
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME
VkFlags VkMemoryPropertyFlags
VkFlags VkSampleCountFlags
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
@ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT
@ VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
@ VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
@ VK_FORMAT_FEATURE_TRANSFER_DST_BIT
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
@ VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
@ VK_SHARING_MODE_EXCLUSIVE
@ VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT
@ VK_MEMORY_PROPERTY_PROTECTED_BIT
VkFlags VkImageUsageFlags
@ VK_IMAGE_CREATE_PROTECTED_BIT
@ VK_IMAGE_TILING_OPTIMAL
@ VK_IMAGE_ASPECT_COLOR_BIT
@ VK_IMAGE_USAGE_TRANSFER_DST_BIT
@ VK_IMAGE_USAGE_SAMPLED_BIT
@ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
@ VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
@ VK_IMAGE_USAGE_TRANSFER_SRC_BIT
@ VK_IMAGE_USAGE_STORAGE_BIT
@ VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
VkFlags VkFormatFeatureFlags
#define VK_EXT_DEVICE_FAULT_EXTENSION_NAME
@ VK_FORMAT_R16G16B16A16_UNORM
@ VK_FORMAT_R8G8B8A8_SRGB
@ VK_FORMAT_D24_UNORM_S8_UINT
@ VK_FORMAT_B8G8R8A8_UNORM
@ VK_FORMAT_R16G16_SFLOAT
@ VK_FORMAT_B4G4R4A4_UNORM_PACK16
@ VK_FORMAT_R5G6B5_UNORM_PACK16
@ VK_FORMAT_R4G4B4A4_UNORM_PACK16
@ VK_FORMAT_A2B10G10R10_UNORM_PACK32
@ VK_FORMAT_R8G8B8A8_UNORM
@ VK_FORMAT_BC1_RGB_UNORM_BLOCK
@ VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM
@ VK_FORMAT_R16G16B16A16_SFLOAT
@ VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK
@ VK_FORMAT_A2R10G10B10_UNORM_PACK32
@ VK_FORMAT_BC1_RGBA_UNORM_BLOCK
@ VK_FORMAT_G8_B8R8_2PLANE_420_UNORM
@ VK_FORMAT_D32_SFLOAT_S8_UINT
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2