8#ifndef GrVkCaps_DEFINED
9#define GrVkCaps_DEFINED
20class VulkanExtensions;
21struct VulkanInterface;
37 uint32_t instanceVersion,
38 uint32_t physicalDeviceVersion,
51 int sampleCount = 1)
const override;
68 return SkToBool(FormatInfo::kTexturable_Flag & this->getFormatInfo(
format).fLinearFlags);
72 const FormatInfo&
info = this->getFormatInfo(
format);
73 const uint16_t&
flags = linearTiled ?
info.fLinearFlags :
info.fOptimalFlags;
78 const FormatInfo&
info = this->getFormatInfo(
format);
79 const uint16_t&
flags = linearTiled ?
info.fLinearFlags :
info.fOptimalFlags;
95 return fShouldAlwaysUseDedicatedImageMemory;
174 return fPreferPrimaryOverSecondaryCommandBuffers;
178 return fMaxPerPoolCachedSecondaryCommandBuffers;
186 return fMustInvalidatePrimaryCmdBufferStateAfterClearAttachments;
199 return fShouldPersistentlyMapCpuToGpuBuffers;
215 bool srcHasYcbcr)
const;
224 bool srcHasYcbcr)
const;
231 bool srcHasYcbcr)
const;
237 return fColorTypeToFormatTable[idx];
260 return fMustLoadFullImageWithDiscardableMSAA;
270#if defined(GR_TEST_UTILS)
271 std::vector<GrTest::TestFormatColorTypeCombination> getTestingCombinations()
const override;
276 kAMD_VkVendor = 4098,
277 kARM_VkVendor = 5045,
278 kGoogle_VkVendor = 0x1AE0,
279 kImagination_VkVendor = 4112,
280 kIntel_VkVendor = 32902,
281 kNvidia_VkVendor = 4318,
282 kQualcomm_VkVendor = 20803,
285 enum class IntelGPUType {
301 kSwiftshader_DeviceID = 0xC0DE,
305 static IntelGPUType GetIntelGPUType(uint32_t deviceID);
306 static int GetIntelGen(IntelGPUType
type) {
308 case IntelGPUType::kSkyLake:
310 case IntelGPUType::kIceLake:
312 case IntelGPUType::kRocketLake:
313 case IntelGPUType::kTigerLake:
314 case IntelGPUType::kAlderLake:
316 case IntelGPUType::kOther:
330 uint32_t physicalDeviceVersion,
334 VkPhysicalDevice physDev,
351 bool onSurfaceSupportsWritePixels(
const GrSurface*)
const override;
368 struct ColorTypeInfo {
372 kUploadData_Flag = 0x1,
375 kRenderable_Flag = 0x2,
378 kWrappedOnly_Flag = 0x4,
388 for (
int i = 0;
i < fColorTypeInfoCount; ++
i) {
390 return fColorTypeInfos[
i].fFlags;
409 kTexturable_Flag = 0x1,
410 kRenderable_Flag = 0x2,
415 uint16_t fOptimalFlags = 0;
416 uint16_t fLinearFlags = 0;
420 std::unique_ptr<ColorTypeInfo[]> fColorTypeInfos;
421 int fColorTypeInfoCount = 0;
423 static const size_t kNumVkFormats = 25;
424 FormatInfo fFormatTable[kNumVkFormats];
426 FormatInfo& getFormatInfo(
VkFormat);
427 const FormatInfo& getFormatInfo(
VkFormat)
const;
430 void setColorType(
GrColorType, std::initializer_list<VkFormat> formats);
436 bool fMustSyncCommandBuffersWithQueue =
false;
437 bool fShouldAlwaysUseDedicatedImageMemory =
false;
439 bool fAvoidUpdateBuffers =
false;
441 bool fSupportsSwapchain =
false;
443 bool fSupportsPhysicalDeviceProperties2 =
false;
444 bool fSupportsMemoryRequirements2 =
false;
445 bool fSupportsBindMemory2 =
false;
446 bool fSupportsMaintenance1 =
false;
447 bool fSupportsMaintenance2 =
false;
448 bool fSupportsMaintenance3 =
false;
450 bool fSupportsDedicatedAllocation =
false;
451 bool fSupportsExternalMemory =
false;
452 bool fSupportsAndroidHWBExternalMemory =
false;
454 bool fSupportsYcbcrConversion =
false;
456 bool fSupportsDRMFormatModifiers =
false;
458 bool fSupportsDeviceFaultInfo =
false;
460 bool fPreferPrimaryOverSecondaryCommandBuffers =
true;
461 bool fMustInvalidatePrimaryCmdBufferStateAfterClearAttachments =
false;
463 bool fGpuOnlyBuffersMorePerformant =
false;
464 bool fShouldPersistentlyMapCpuToGpuBuffers =
true;
469 int fMaxPerPoolCachedSecondaryCommandBuffers = 100;
471 uint32_t fMaxInputAttachmentDescriptors = 0;
473 float fMaxSamplerAnisotropy = 1.f;
475 bool fMustLoadFullImageWithDiscardableMSAA =
false;
476 bool fSupportsDiscardableMSAAForDMSAA =
true;
477 bool fSupportsMemorylessAttachments =
false;
479 uint32_t fMaxDrawIndirectDrawCount = 0;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static const int kGrColorTypeCnt
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr bool SkToBool(const T &x)
GrCaps(const GrContextOptions &)
bool mustSyncCommandBuffersWithQueue() const
bool canCopyAsResolve(VkFormat dstConfig, int dstSampleCnt, bool dstHasYcbcr, VkFormat srcConfig, int srcSamplecnt, bool srcHasYcbcr) const
bool supportsMaintenance3() const
bool isVkFormatTexturable(VkFormat) const
bool programInfoWillUseDiscardableMSAA(const GrProgramInfo &) const
bool canCopyAsBlit(VkFormat dstConfig, int dstSampleCnt, bool dstIsLinear, bool dstHasYcbcr, VkFormat srcConfig, int srcSampleCnt, bool srcIsLinear, bool srcHasYcbcr) const
int maxPerPoolCachedSecondaryCommandBuffers() const
bool formatCanBeDstofBlit(VkFormat format, bool linearTiled) const
uint64_t computeFormatKey(const GrBackendFormat &) const override
bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const override
SurfaceReadPixelsSupport surfaceSupportsReadPixels(const GrSurface *) const override
bool supportsBindMemory2() const
int maxRenderTargetSampleCount(const GrBackendFormat &) const override
VkShaderStageFlags getPushConstantStageFlags() const
bool isFormatCopyable(const GrBackendFormat &) const override
bool renderTargetSupportsDiscardableMSAA(const GrVkRenderTarget *) const
bool isFormatTexturable(const GrBackendFormat &, GrTextureType) const override
bool mustLoadFullImageWithDiscardableMSAA() const
uint32_t ycbcrCombinedImageSamplerDescriptorCount() const
GrProgramDesc makeDesc(GrRenderTarget *, const GrProgramInfo &, ProgramDescOverrideFlags) const override
bool supportsYcbcrConversion() const
bool supportsMemoryRequirements2() const
bool shouldPersistentlyMapCpuToGpuBuffers() const
void addExtraSamplerKey(skgpu::KeyBuilder *, GrSamplerState, const GrBackendFormat &) const override
bool supportsExternalMemory() const
bool supportsMaintenance1() const
int getFragmentUniformSet() const
bool isFormatSRGB(const GrBackendFormat &) const override
VkFormat getFormatFromColorType(GrColorType colorType) const
GrColorType transferColorType(VkFormat, GrColorType surfaceColorType) const
bool shouldAlwaysUseDedicatedImageMemory() const
bool isFormatAsColorTypeRenderable(GrColorType ct, const GrBackendFormat &format, int sampleCount=1) const override
bool avoidUpdateBuffers() const
uint32_t maxInputAttachmentDescriptors() const
bool supportsDiscardableMSAAForDMSAA() const
GrBackendFormat getBackendFormatFromCompressionType(SkTextureCompressionType) const override
int getRenderTargetSampleCount(int requestedCount, const GrBackendFormat &) const override
bool supportsDeviceFaultInfo() const
bool supportsSwapchain() const
bool supportsPhysicalDeviceProperties2() const
GrInternalSurfaceFlags getExtraSurfaceFlagsForDeferredRT() const override
bool formatCanBeSrcofBlit(VkFormat format, bool linearTiled) const
bool supportsMaintenance2() const
bool supportsDedicatedAllocation() const
bool dmsaaResolveCanBeUsedAsTextureInSameRenderPass() const override
SupportedWrite supportedWritePixelsColorType(GrColorType surfaceColorType, const GrBackendFormat &surfaceFormat, GrColorType srcColorType) const override
bool supportsMemorylessAttachments() const
bool preferPrimaryOverSecondaryCommandBuffers() const
bool canCopyImage(VkFormat dstFormat, int dstSampleCnt, bool dstHasYcbcr, VkFormat srcFormat, int srcSamplecnt, bool srcHasYcbcr) const
skgpu::Swizzle getWriteSwizzle(const GrBackendFormat &, GrColorType) const override
bool mustInvalidatePrimaryCmdBufferStateAfterClearAttachments() const
uint32_t maxDrawIndirectDrawCount() const
int getFragmentUniformBinding() const
bool supportsAndroidHWBExternalMemory() const
bool supportsDRMFormatModifiers() const
VkFormat preferredStencilFormat() const
bool gpuOnlyBuffersMorePerformant() const
GrVkCaps(const GrContextOptions &, const skgpu::VulkanInterface *, VkPhysicalDevice, const VkPhysicalDeviceFeatures2 &, uint32_t instanceVersion, uint32_t physicalDeviceVersion, const skgpu::VulkanExtensions &, skgpu::Protected)
float maxSamplerAnisotropy() const
static int GetStencilFormatTotalBitCount(VkFormat format)
bool isVkFormatTexturableLinearly(VkFormat format) const
FlutterSemanticsFlag flags
uint32_t uint32_t * format
VkFlags VkFormatFeatureFlags
VkFlags VkShaderStageFlags
@ VK_FORMAT_D24_UNORM_S8_UINT
@ VK_FORMAT_D32_SFLOAT_S8_UINT