Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | List of all members
GrVkCaps Class Reference

#include <GrVkCaps.h>

Inheritance diagram for GrVkCaps:
GrCaps SkCapabilities SkRefCnt SkRefCntBase

Public Member Functions

 GrVkCaps (const GrContextOptions &, const skgpu::VulkanInterface *, VkPhysicalDevice, const VkPhysicalDeviceFeatures2 &, uint32_t instanceVersion, uint32_t physicalDeviceVersion, const skgpu::VulkanExtensions &, skgpu::Protected)
 
bool isFormatSRGB (const GrBackendFormat &) const override
 
bool isFormatTexturable (const GrBackendFormat &, GrTextureType) const override
 
bool isVkFormatTexturable (VkFormat) const
 
bool isFormatCopyable (const GrBackendFormat &) const override
 
bool isFormatAsColorTypeRenderable (GrColorType ct, const GrBackendFormat &format, int sampleCount=1) const override
 
bool isFormatRenderable (const GrBackendFormat &format, int sampleCount) const override
 
bool isFormatRenderable (VkFormat, int sampleCount) const
 
int getRenderTargetSampleCount (int requestedCount, const GrBackendFormat &) const override
 
int getRenderTargetSampleCount (int requestedCount, VkFormat) const
 
int maxRenderTargetSampleCount (const GrBackendFormat &) const override
 
int maxRenderTargetSampleCount (VkFormat format) const
 
SupportedWrite supportedWritePixelsColorType (GrColorType surfaceColorType, const GrBackendFormat &surfaceFormat, GrColorType srcColorType) const override
 
SurfaceReadPixelsSupport surfaceSupportsReadPixels (const GrSurface *) const override
 
bool isVkFormatTexturableLinearly (VkFormat format) const
 
bool formatCanBeDstofBlit (VkFormat format, bool linearTiled) const
 
bool formatCanBeSrcofBlit (VkFormat format, bool linearTiled) const
 
GrColorType transferColorType (VkFormat, GrColorType surfaceColorType) const
 
bool mustSyncCommandBuffersWithQueue () const
 
bool shouldAlwaysUseDedicatedImageMemory () const
 
bool avoidUpdateBuffers () const
 
VkFormat preferredStencilFormat () const
 
bool supportsSwapchain () const
 
bool supportsPhysicalDeviceProperties2 () const
 
bool supportsMemoryRequirements2 () const
 
bool supportsBindMemory2 () const
 
bool supportsMaintenance1 () const
 
bool supportsMaintenance2 () const
 
bool supportsMaintenance3 () const
 
bool supportsDedicatedAllocation () const
 
bool supportsExternalMemory () const
 
bool supportsAndroidHWBExternalMemory () const
 
bool supportsYcbcrConversion () const
 
uint32_t ycbcrCombinedImageSamplerDescriptorCount () const
 
bool supportsDRMFormatModifiers () const
 
bool supportsDeviceFaultInfo () const
 
bool preferPrimaryOverSecondaryCommandBuffers () const
 
int maxPerPoolCachedSecondaryCommandBuffers () const
 
uint32_t maxInputAttachmentDescriptors () const
 
float maxSamplerAnisotropy () const
 
bool mustInvalidatePrimaryCmdBufferStateAfterClearAttachments () const
 
bool gpuOnlyBuffersMorePerformant () const
 
bool shouldPersistentlyMapCpuToGpuBuffers () const
 
uint32_t maxDrawIndirectDrawCount () const
 
bool canCopyImage (VkFormat dstFormat, int dstSampleCnt, bool dstHasYcbcr, VkFormat srcFormat, int srcSamplecnt, bool srcHasYcbcr) const
 
bool canCopyAsBlit (VkFormat dstConfig, int dstSampleCnt, bool dstIsLinear, bool dstHasYcbcr, VkFormat srcConfig, int srcSampleCnt, bool srcIsLinear, bool srcHasYcbcr) const
 
bool canCopyAsResolve (VkFormat dstConfig, int dstSampleCnt, bool dstHasYcbcr, VkFormat srcConfig, int srcSamplecnt, bool srcHasYcbcr) const
 
GrBackendFormat getBackendFormatFromCompressionType (SkTextureCompressionType) const override
 
VkFormat getFormatFromColorType (GrColorType colorType) const
 
skgpu::Swizzle getWriteSwizzle (const GrBackendFormat &, GrColorType) const override
 
uint64_t computeFormatKey (const GrBackendFormat &) const override
 
int getFragmentUniformBinding () const
 
int getFragmentUniformSet () const
 
void addExtraSamplerKey (skgpu::KeyBuilder *, GrSamplerState, const GrBackendFormat &) const override
 
GrProgramDesc makeDesc (GrRenderTarget *, const GrProgramInfo &, ProgramDescOverrideFlags) const override
 
GrInternalSurfaceFlags getExtraSurfaceFlagsForDeferredRT () const override
 
VkShaderStageFlags getPushConstantStageFlags () const
 
bool mustLoadFullImageWithDiscardableMSAA () const
 
bool supportsDiscardableMSAAForDMSAA () const
 
bool renderTargetSupportsDiscardableMSAA (const GrVkRenderTarget *) const
 
bool programInfoWillUseDiscardableMSAA (const GrProgramInfo &) const
 
bool dmsaaResolveCanBeUsedAsTextureInSameRenderPass () const override
 
bool supportsMemorylessAttachments () const
 
- Public Member Functions inherited from GrCaps
 GrCaps (const GrContextOptions &)
 
void dumpJSON (SkJSONWriter *) const
 
const GrShaderCapsshaderCaps () const
 
bool npotTextureTileSupport () const
 
bool mipmapSupport () const
 
bool anisoSupport () const
 
bool gpuTracingSupport () const
 
bool oversizedStencilSupport () const
 
bool textureBarrierSupport () const
 
bool sampleLocationsSupport () const
 
bool drawInstancedSupport () const
 
bool nativeDrawIndirectSupport () const
 
bool useClientSideIndirectBuffers () const
 
bool conservativeRasterSupport () const
 
bool wireframeSupport () const
 
bool msaaResolvesAutomatically () const
 
bool preferDiscardableMSAAAttachment () const
 
bool halfFloatVertexAttributeSupport () const
 
bool usePrimitiveRestart () const
 
bool preferClientSideDynamicBuffers () const
 
bool preferFullscreenClears () const
 
bool discardStencilValuesAfterRenderPass () const
 
bool twoSidedStencilRefsAndMasksMustMatch () const
 
bool preferVRAMUseOverFlushes () const
 
bool avoidStencilBuffers () const
 
bool avoidWritePixelsFastPath () const
 
bool nativeDrawIndexedIndirectIsBroken () const
 
BlendEquationSupport blendEquationSupport () const
 
bool advancedBlendEquationSupport () const
 
bool advancedCoherentBlendEquationSupport () const
 
bool isAdvancedBlendEquationDisabled (skgpu::BlendEquation equation) const
 
bool shouldCollapseSrcOverToSrcWhenAble () const
 
bool mustSyncGpuDuringAbandon () const
 
bool reducedShaderMode () const
 
uint32_t mapBufferFlags () const
 
bool reuseScratchTextures () const
 
bool reuseScratchBuffers () const
 
int maxVertexAttributes () const
 maximum number of attribute values per vertex More...
 
int maxRenderTargetSize () const
 
int maxPreferredRenderTargetSize () const
 
int maxTextureSize () const
 
int maxWindowRectangles () const
 
bool isWindowRectanglesSupportedForRT (const GrBackendRenderTarget &rt) const
 
uint32_t maxPushConstantsSize () const
 
size_t transferBufferRowBytesAlignment () const
 
size_t transferFromBufferToBufferAlignment () const
 
size_t bufferUpdateDataPreserveAlignment () const
 
virtual bool isFormatSRGB (const GrBackendFormat &) const =0
 
bool isFormatCompressed (const GrBackendFormat &format) const
 
virtual bool isFormatTexturable (const GrBackendFormat &, GrTextureType) const =0
 
virtual bool isFormatCopyable (const GrBackendFormat &) const =0
 
virtual int maxRenderTargetSampleCount (const GrBackendFormat &) const =0
 
int internalMultisampleCount (const GrBackendFormat &format) const
 
virtual bool isFormatAsColorTypeRenderable (GrColorType ct, const GrBackendFormat &format, int sampleCount=1) const =0
 
virtual bool isFormatRenderable (const GrBackendFormat &format, int sampleCount) const =0
 
virtual int getRenderTargetSampleCount (int requestedCount, const GrBackendFormat &) const =0
 
bool surfaceSupportsWritePixels (const GrSurface *) const
 
virtual SurfaceReadPixelsSupport surfaceSupportsReadPixels (const GrSurface *) const =0
 
virtual SupportedWrite supportedWritePixelsColorType (GrColorType surfaceColorType, const GrBackendFormat &surfaceFormat, GrColorType srcColorType) const =0
 
SupportedRead supportedReadPixelsColorType (GrColorType srcColorType, const GrBackendFormat &srcFormat, GrColorType dstColorType) const
 
bool writePixelsRowBytesSupport () const
 
bool transferPixelsToRowBytesSupport () const
 
bool readPixelsRowBytesSupport () const
 
bool transferFromSurfaceToBufferSupport () const
 
bool transferFromBufferToTextureSupport () const
 
bool transferFromBufferToBufferSupport () const
 
bool suppressPrints () const
 
size_t bufferMapThreshold () const
 
bool mustClearUploadedBufferData () const
 
bool shouldInitializeTextures () const
 
bool buffersAreInitiallyZero () const
 
bool supportsAHardwareBufferImages () const
 
bool wireframeMode () const
 
bool semaphoreSupport () const
 
bool backendSemaphoreSupport () const
 
bool finishedProcAsyncCallbackSupport () const
 
bool crossContextTextureSupport () const
 
bool canCopySurface (const GrSurfaceProxy *dst, const SkIRect &dstRect, const GrSurfaceProxy *src, const SkIRect &srcRect) const
 
bool dynamicStateArrayGeometryProcessorTextureSupport () const
 
bool supportsProtectedContent () const
 
bool performPartialClearsAsDraws () const
 
bool performColorClearsAsDraws () const
 
bool avoidLargeIndexBufferDraws () const
 
bool performStencilClearsAsDraws () const
 
bool disableTessellationPathRenderer () const
 
GrDstSampleFlags getDstSampleFlagsForProxy (const GrRenderTargetProxy *, bool drawUsesMSAA) const
 
virtual DstCopyRestrictions getDstCopyRestrictions (const GrRenderTargetProxy *src, GrColorType ct) const
 
bool validateSurfaceParams (const SkISize &, const GrBackendFormat &, GrRenderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped, GrTextureType) const
 
bool areColorTypeAndFormatCompatible (GrColorType grCT, const GrBackendFormat &format) const
 
GrBackendFormat getDefaultBackendFormat (GrColorType, GrRenderable) const
 
virtual GrBackendFormat getBackendFormatFromCompressionType (SkTextureCompressionType) const =0
 
bool clampToBorderSupport () const
 
skgpu::Swizzle getReadSwizzle (const GrBackendFormat &format, GrColorType colorType) const
 
virtual skgpu::Swizzle getWriteSwizzle (const GrBackendFormat &, GrColorType) const =0
 
virtual uint64_t computeFormatKey (const GrBackendFormat &) const =0
 
const GrDriverBugWorkaroundsworkarounds () const
 
virtual void addExtraSamplerKey (skgpu::KeyBuilder *, GrSamplerState, const GrBackendFormat &) const
 
 GR_DECL_BITFIELD_CLASS_OPS_FRIENDS (ProgramDescOverrideFlags)
 
virtual GrProgramDesc makeDesc (GrRenderTarget *, const GrProgramInfo &, ProgramDescOverrideFlags overrideFlags=ProgramDescOverrideFlags::kNone) const =0
 
virtual GrInternalSurfaceFlags getExtraSurfaceFlagsForDeferredRT () const
 
bool supportsDynamicMSAA (const GrRenderTargetProxy *) const
 
virtual bool dmsaaResolveCanBeUsedAsTextureInSameRenderPass () const
 
bool avoidReorderingRenderTasks () const
 
bool avoidDithering () const
 
bool disablePerspectiveSDFText () const
 
bool avoidLineDraws () const
 
std::tuple< GrColorType, GrBackendFormatgetFallbackColorTypeAndFormat (GrColorType, int sampleCount) const
 
- Public Member Functions inherited from SkCapabilities
SkSL::Version skslVersion () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static int GetStencilFormatTotalBitCount (VkFormat format)
 
- Static Public Member Functions inherited from SkCapabilities
static sk_sp< const SkCapabilitiesRasterBackend ()
 

Additional Inherited Members

- Public Types inherited from GrCaps
enum  BlendEquationSupport { kBasic_BlendEquationSupport , kAdvanced_BlendEquationSupport , kAdvancedCoherent_BlendEquationSupport , kLast_BlendEquationSupport = kAdvancedCoherent_BlendEquationSupport }
 
enum  MapFlags { kNone_MapFlags = 0x0 , kCanMap_MapFlag = 0x1 , kSubset_MapFlag = 0x2 , kAsyncRead_MapFlag = 0x4 }
 
enum class  SurfaceReadPixelsSupport { kSupported , kCopyToTexture2D , kUnsupported }
 
enum class  ProgramDescOverrideFlags { kNone = 0 , kVulkanHasResolveLoadSubpass = 0x1 }
 
- Protected Member Functions inherited from GrCaps
void finishInitialization (const GrContextOptions &options)
 
virtual bool onSupportsDynamicMSAA (const GrRenderTargetProxy *) const
 
- Protected Member Functions inherited from SkCapabilities
 SkCapabilities ()=default
 
void initSkCaps (const SkSL::ShaderCaps *)
 
- Protected Attributes inherited from GrCaps
std::unique_ptr< GrShaderCapsfShaderCaps
 
bool fNPOTTextureTileSupport: 1
 
bool fMipmapSupport: 1
 
bool fAnisoSupport: 1
 
bool fReuseScratchTextures: 1
 
bool fReuseScratchBuffers: 1
 
bool fGpuTracingSupport: 1
 
bool fOversizedStencilSupport: 1
 
bool fTextureBarrierSupport: 1
 
bool fSampleLocationsSupport: 1
 
bool fDrawInstancedSupport: 1
 
bool fNativeDrawIndirectSupport: 1
 
bool fUseClientSideIndirectBuffers: 1
 
bool fConservativeRasterSupport: 1
 
bool fWireframeSupport: 1
 
bool fMSAAResolvesAutomatically: 1
 
bool fPreferDiscardableMSAAAttachment: 1
 
bool fUsePrimitiveRestart: 1
 
bool fPreferClientSideDynamicBuffers: 1
 
bool fPreferFullscreenClears: 1
 
bool fTwoSidedStencilRefsAndMasksMustMatch: 1
 
bool fMustClearUploadedBufferData: 1
 
bool fBuffersAreInitiallyZero: 1
 
bool fShouldInitializeTextures: 1
 
bool fSupportsAHardwareBufferImages: 1
 
bool fHalfFloatVertexAttributeSupport: 1
 
bool fClampToBorderSupport: 1
 
bool fPerformPartialClearsAsDraws: 1
 
bool fPerformColorClearsAsDraws: 1
 
bool fAvoidLargeIndexBufferDraws: 1
 
bool fPerformStencilClearsAsDraws: 1
 
bool fTransferFromBufferToTextureSupport: 1
 
bool fTransferFromSurfaceToBufferSupport: 1
 
bool fTransferFromBufferToBufferSupport: 1
 
bool fWritePixelsRowBytesSupport: 1
 
bool fTransferPixelsToRowBytesSupport: 1
 
bool fReadPixelsRowBytesSupport: 1
 
bool fShouldCollapseSrcOverToSrcWhenAble: 1
 
bool fMustSyncGpuDuringAbandon: 1
 
bool fDisableTessellationPathRenderer: 1
 
bool fAvoidStencilBuffers: 1
 
bool fAvoidWritePixelsFastPath: 1
 
bool fNativeDrawIndexedIndirectIsBroken: 1
 
bool fAvoidReorderingRenderTasks: 1
 
bool fAvoidDithering: 1
 
bool fDisablePerspectiveSDFText: 1
 
bool fAvoidLineDraws: 1
 
bool fPreferVRAMUseOverFlushes: 1
 
bool fSemaphoreSupport: 1
 
bool fBackendSemaphoreSupport: 1
 
bool fFinishedProcAsyncCallbackSupport: 1
 
bool fCrossContextTextureSupport: 1
 
bool fDynamicStateArrayGeometryProcessorTextureSupport: 1
 
bool fSupportsProtectedContent: 1
 
BlendEquationSupport fBlendEquationSupport
 
uint32_t fAdvBlendEqDisableFlags
 
uint32_t fMapBufferFlags
 
int fBufferMapThreshold
 
int fMaxRenderTargetSize
 
int fMaxPreferredRenderTargetSize
 
int fMaxVertexAttributes
 
int fMaxTextureSize
 
int fMaxWindowRectangles
 
int fInternalMultisampleCount
 
uint32_t fMaxPushConstantsSize = 0
 
size_t fTransferBufferRowBytesAlignment = 1
 
size_t fTransferFromBufferToBufferAlignment = 1
 
size_t fBufferUpdateDataPreserveAlignment = 1
 
GrDriverBugWorkarounds fDriverBugWorkarounds
 
- Protected Attributes inherited from SkCapabilities
SkSL::Version fSkSLVersion = SkSL::Version::k100
 

Detailed Description

Stores some capabilities of a Vk backend.

Definition at line 27 of file GrVkCaps.h.

Constructor & Destructor Documentation

◆ GrVkCaps()

GrVkCaps::GrVkCaps ( const GrContextOptions contextOptions,
const skgpu::VulkanInterface vkInterface,
VkPhysicalDevice  physDev,
const VkPhysicalDeviceFeatures2 features,
uint32_t  instanceVersion,
uint32_t  physicalDeviceVersion,
const skgpu::VulkanExtensions extensions,
skgpu::Protected  isProtected 
)

Creates a GrVkCaps that is set such that nothing is supported. The init function should be called to fill out the caps.

Definition at line 43 of file GrVkCaps.cpp.

51 : INHERITED(contextOptions) {
52 /**************************************************************************
53 * GrCaps fields
54 **************************************************************************/
55 fMipmapSupport = true; // always available in Vulkan
56 fAnisoSupport = true; // always available in Vulkan
57 fNPOTTextureTileSupport = true; // always available in Vulkan
58 fReuseScratchTextures = true; //TODO: figure this out
59 fGpuTracingSupport = false; //TODO: figure this out
60 fOversizedStencilSupport = false; //TODO: figure this out
62
63 fSemaphoreSupport = true; // always available in Vulkan
68
69 // We always copy in/out of a transfer buffer so it's trivial to support row bytes.
72
76
77 fMaxRenderTargetSize = 4096; // minimum required by spec
78 fMaxTextureSize = 4096; // minimum required by spec
79
81
83
84 fShaderCaps = std::make_unique<GrShaderCaps>();
85
86 this->init(contextOptions, vkInterface, physDev, features, physicalDeviceVersion, extensions,
87 isProtected);
88}
bool fDynamicStateArrayGeometryProcessorTextureSupport
Definition: GrCaps.h:646
bool fFinishedProcAsyncCallbackSupport
Definition: GrCaps.h:640
int fMaxRenderTargetSize
Definition: GrCaps.h:657
bool fReadPixelsRowBytesSupport
Definition: GrCaps.h:621
std::unique_ptr< GrShaderCaps > fShaderCaps
Definition: GrCaps.h:584
bool fReuseScratchTextures
Definition: GrCaps.h:589
bool fAnisoSupport
Definition: GrCaps.h:588
bool fTransferFromBufferToBufferSupport
Definition: GrCaps.h:618
bool fTransferFromBufferToTextureSupport
Definition: GrCaps.h:616
bool fTextureBarrierSupport
Definition: GrCaps.h:593
bool fBackendSemaphoreSupport
Definition: GrCaps.h:639
bool fHalfFloatVertexAttributeSupport
Definition: GrCaps.h:610
bool fGpuTracingSupport
Definition: GrCaps.h:591
bool fOversizedStencilSupport
Definition: GrCaps.h:592
bool fSemaphoreSupport
Definition: GrCaps.h:638
bool fMipmapSupport
Definition: GrCaps.h:587
bool fWritePixelsRowBytesSupport
Definition: GrCaps.h:619
bool fNPOTTextureTileSupport
Definition: GrCaps.h:586
bool fTransferFromSurfaceToBufferSupport
Definition: GrCaps.h:617
bool fDrawInstancedSupport
Definition: GrCaps.h:595
int fMaxTextureSize
Definition: GrCaps.h:660
bool fCrossContextTextureSupport
Definition: GrCaps.h:643

Member Function Documentation

◆ addExtraSamplerKey()

void GrVkCaps::addExtraSamplerKey ( skgpu::KeyBuilder ,
GrSamplerState  ,
const GrBackendFormat  
) const
overridevirtual

Adds fields to the key to represent the sampler that will be created for the passed in parameters. Currently this extra keying is only needed when building a vulkan pipeline with immutable samplers.

Reimplemented from GrCaps.

Definition at line 1935 of file GrVkCaps.cpp.

1937 {
1938 const skgpu::VulkanYcbcrConversionInfo* ycbcrInfo =
1940 if (!ycbcrInfo) {
1941 return;
1942 }
1943
1944 GrVkSampler::Key key = GrVkSampler::GenerateKey(samplerState, *ycbcrInfo);
1945
1946 constexpr size_t numInts = (sizeof(key) + 3) / 4;
1947 uint32_t tmp[numInts];
1948 memcpy(tmp, &key, sizeof(key));
1949
1950 for (size_t i = 0; i < numInts; ++i) {
1951 b->add32(tmp[i]);
1952 }
1953}
static SK_END_REQUIRE_DENSE Key GenerateKey(GrSamplerState, const skgpu::VulkanYcbcrConversionInfo &)
static bool b
uint32_t uint32_t * format
SK_API const skgpu::VulkanYcbcrConversionInfo * GetVkYcbcrConversionInfo(const GrBackendFormat &)

◆ avoidUpdateBuffers()

bool GrVkCaps::avoidUpdateBuffers ( ) const
inline

Definition at line 99 of file GrVkCaps.h.

99{ return fAvoidUpdateBuffers; }

◆ canCopyAsBlit()

bool GrVkCaps::canCopyAsBlit ( VkFormat  dstConfig,
int  dstSampleCnt,
bool  dstIsLinear,
bool  dstHasYcbcr,
VkFormat  srcConfig,
int  srcSampleCnt,
bool  srcIsLinear,
bool  srcHasYcbcr 
) const

Definition at line 170 of file GrVkCaps.cpp.

172 {
173 // We require that all vulkan GrSurfaces have been created with transfer_dst and transfer_src
174 // as image usage flags.
175 if (!this->formatCanBeDstofBlit(dstFormat, dstIsLinear) ||
176 !this->formatCanBeSrcofBlit(srcFormat, srcIsLinear)) {
177 return false;
178 }
179
180 // We cannot blit images that are multisampled. Will need to figure out if we can blit the
181 // resolved msaa though.
182 if (dstSampleCnt > 1 || srcSampleCnt > 1) {
183 return false;
184 }
185
186 if (dstHasYcbcr || srcHasYcbcr) {
187 return false;
188 }
189
190 return true;
191}
bool formatCanBeDstofBlit(VkFormat format, bool linearTiled) const
Definition: GrVkCaps.h:71
bool formatCanBeSrcofBlit(VkFormat format, bool linearTiled) const
Definition: GrVkCaps.h:77

◆ canCopyAsResolve()

bool GrVkCaps::canCopyAsResolve ( VkFormat  dstConfig,
int  dstSampleCnt,
bool  dstHasYcbcr,
VkFormat  srcConfig,
int  srcSamplecnt,
bool  srcHasYcbcr 
) const

Definition at line 193 of file GrVkCaps.cpp.

194 {
195 // The src surface must be multisampled.
196 if (srcSampleCnt <= 1) {
197 return false;
198 }
199
200 // The dst must not be multisampled.
201 if (dstSampleCnt > 1) {
202 return false;
203 }
204
205 // Surfaces must have the same format.
206 if (srcFormat != dstFormat) {
207 return false;
208 }
209
210 if (dstHasYcbcr || srcHasYcbcr) {
211 return false;
212 }
213
214 return true;
215}

◆ canCopyImage()

bool GrVkCaps::canCopyImage ( VkFormat  dstFormat,
int  dstSampleCnt,
bool  dstHasYcbcr,
VkFormat  srcFormat,
int  srcSamplecnt,
bool  srcHasYcbcr 
) const

Helpers used by canCopySurface. In all cases if the SampleCnt parameter is zero that means the surface is not a render target, otherwise it is the number of samples in the render target.

Definition at line 155 of file GrVkCaps.cpp.

156 {
157 if ((dstSampleCnt > 1 || srcSampleCnt > 1) && dstSampleCnt != srcSampleCnt) {
158 return false;
159 }
160
161 if (dstHasYcbcr || srcHasYcbcr) {
162 return false;
163 }
164
165 // We require that all Vulkan GrSurfaces have been created with transfer_dst and transfer_src
166 // as image usage flags.
167 return format_compatibility_class(srcFormat) == format_compatibility_class(dstFormat);
168}
static FormatCompatibilityClass format_compatibility_class(VkFormat format)
Definition: GrVkCaps.cpp:108

◆ computeFormatKey()

uint64_t GrVkCaps::computeFormatKey ( const GrBackendFormat format) const
overridevirtual

Implements GrCaps.

Definition at line 1880 of file GrVkCaps.cpp.

1880 {
1881 VkFormat vkFormat;
1883
1884#ifdef SK_DEBUG
1885 // We should never be trying to compute a key for an external format
1886 const skgpu::VulkanYcbcrConversionInfo* ycbcrInfo =
1888 SkASSERT(ycbcrInfo);
1889 SkASSERT(!ycbcrInfo->isValid() || ycbcrInfo->fExternalFormat == 0);
1890#endif
1891
1892 // A VkFormat has a size of 64 bits.
1893 return (uint64_t)vkFormat;
1894}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
#define SkASSERT(cond)
Definition: SkAssert.h:116
SK_API bool AsVkFormat(const GrBackendFormat &, VkFormat *)
VkFormat
Definition: vulkan_core.h:1458

◆ dmsaaResolveCanBeUsedAsTextureInSameRenderPass()

bool GrVkCaps::dmsaaResolveCanBeUsedAsTextureInSameRenderPass ( ) const
inlineoverridevirtual

Reimplemented from GrCaps.

Definition at line 266 of file GrVkCaps.h.

266{ return false; }

◆ formatCanBeDstofBlit()

bool GrVkCaps::formatCanBeDstofBlit ( VkFormat  format,
bool  linearTiled 
) const
inline

Definition at line 71 of file GrVkCaps.h.

71 {
72 const FormatInfo& info = this->getFormatInfo(format);
73 const uint16_t& flags = linearTiled ? info.fLinearFlags : info.fOptimalFlags;
74 return SkToBool(FormatInfo::kBlitDst_Flag & flags);
75 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
FlutterSemanticsFlag flags

◆ formatCanBeSrcofBlit()

bool GrVkCaps::formatCanBeSrcofBlit ( VkFormat  format,
bool  linearTiled 
) const
inline

Definition at line 77 of file GrVkCaps.h.

77 {
78 const FormatInfo& info = this->getFormatInfo(format);
79 const uint16_t& flags = linearTiled ? info.fLinearFlags : info.fOptimalFlags;
80 return SkToBool(FormatInfo::kBlitSrc_Flag & flags);
81 }

◆ getBackendFormatFromCompressionType()

GrBackendFormat GrVkCaps::getBackendFormatFromCompressionType ( SkTextureCompressionType  compressionType) const
overridevirtual

Implements GrCaps.

Definition at line 1803 of file GrVkCaps.cpp.

1804 {
1805 switch (compressionType) {
1807 return {};
1811 }
1812 return {};
1816 }
1817 return {};
1821 }
1822 return {};
1823 }
1824
1826}
#define SkUNREACHABLE
Definition: SkAssert.h:135
bool isVkFormatTexturable(VkFormat) const
Definition: GrVkCaps.cpp:1566
SK_API GrBackendFormat MakeVk(VkFormat format, bool willUseDRMFormatModifiers=false)
@ VK_FORMAT_BC1_RGB_UNORM_BLOCK
Definition: vulkan_core.h:1590
@ VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK
Definition: vulkan_core.h:1606
@ VK_FORMAT_BC1_RGBA_UNORM_BLOCK
Definition: vulkan_core.h:1592

◆ getExtraSurfaceFlagsForDeferredRT()

GrInternalSurfaceFlags GrVkCaps::getExtraSurfaceFlagsForDeferredRT ( ) const
overridevirtual

Reimplemented from GrCaps.

Definition at line 2055 of file GrVkCaps.cpp.

2055 {
2056 // We always create vulkan RT with the input attachment flag;
2058}

◆ getFormatFromColorType()

VkFormat GrVkCaps::getFormatFromColorType ( GrColorType  colorType) const
inline

Definition at line 235 of file GrVkCaps.h.

235 {
236 int idx = static_cast<int>(colorType);
237 return fColorTypeToFormatTable[idx];
238 }
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)

◆ getFragmentUniformBinding()

int GrVkCaps::getFragmentUniformBinding ( ) const

Definition at line 1927 of file GrVkCaps.cpp.

◆ getFragmentUniformSet()

int GrVkCaps::getFragmentUniformSet ( ) const

Definition at line 1931 of file GrVkCaps.cpp.

◆ getPushConstantStageFlags()

VkShaderStageFlags GrVkCaps::getPushConstantStageFlags ( ) const

Definition at line 2060 of file GrVkCaps.cpp.

2060 {
2062 return stageFlags;
2063}
@ VK_SHADER_STAGE_VERTEX_BIT
Definition: vulkan_core.h:2665
@ VK_SHADER_STAGE_FRAGMENT_BIT
Definition: vulkan_core.h:2669
VkFlags VkShaderStageFlags
Definition: vulkan_core.h:2731

◆ getRenderTargetSampleCount() [1/2]

int GrVkCaps::getRenderTargetSampleCount ( int  requestedCount,
const GrBackendFormat format 
) const
overridevirtual

Implements GrCaps.

Definition at line 1599 of file GrVkCaps.cpp.

1600 {
1601 VkFormat vkFormat;
1602 if (!GrBackendFormats::AsVkFormat(format, &vkFormat)) {
1603 return 0;
1604 }
1605
1606 return this->getRenderTargetSampleCount(requestedCount, vkFormat);
1607}
int getRenderTargetSampleCount(int requestedCount, const GrBackendFormat &) const override
Definition: GrVkCaps.cpp:1599

◆ getRenderTargetSampleCount() [2/2]

int GrVkCaps::getRenderTargetSampleCount ( int  requestedCount,
VkFormat  format 
) const

Definition at line 1609 of file GrVkCaps.cpp.

1609 {
1610 requestedCount = std::max(1, requestedCount);
1611
1612 const FormatInfo& info = this->getFormatInfo(format);
1613
1614 int count = info.fColorSampleCounts.size();
1615
1616 if (!count) {
1617 return 0;
1618 }
1619
1620 if (1 == requestedCount) {
1621 SkASSERT(!info.fColorSampleCounts.empty() && info.fColorSampleCounts[0] == 1);
1622 return 1;
1623 }
1624
1625 for (int i = 0; i < count; ++i) {
1626 if (info.fColorSampleCounts[i] >= requestedCount) {
1627 return info.fColorSampleCounts[i];
1628 }
1629 }
1630 return 0;
1631}
int count
Definition: FontMgrTest.cpp:50
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ GetStencilFormatTotalBitCount()

static int GrVkCaps::GetStencilFormatTotalBitCount ( VkFormat  format)
inlinestatic

Definition at line 107 of file GrVkCaps.h.

107 {
108 switch (format) {
110 return 8;
112 return 32;
114 // can optionally have 24 unused bits at the end so we assume the total bits is 64.
115 return 64;
116 default:
117 SkASSERT(false);
118 return 0;
119 }
120 }
@ VK_FORMAT_D24_UNORM_S8_UINT
Definition: vulkan_core.h:1588
@ VK_FORMAT_S8_UINT
Definition: vulkan_core.h:1586
@ VK_FORMAT_D32_SFLOAT_S8_UINT
Definition: vulkan_core.h:1589

◆ getWriteSwizzle()

skgpu::Swizzle GrVkCaps::getWriteSwizzle ( const GrBackendFormat ,
GrColorType   
) const
overridevirtual

Returns the skgpu::Swizzle to use when writing colors to a surface with the passed in GrBackendFormat and GrColorType.

Implements GrCaps.

Definition at line 1853 of file GrVkCaps.cpp.

1854 {
1855 VkFormat vkFormat;
1857 const auto& info = this->getFormatInfo(vkFormat);
1858 for (int i = 0; i < info.fColorTypeInfoCount; ++i) {
1859 const auto& ctInfo = info.fColorTypeInfos[i];
1860 if (ctInfo.fColorType == colorType) {
1861 return ctInfo.fWriteSwizzle;
1862 }
1863 }
1864 SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.",
1865 (int)colorType, (int)vkFormat);
1866 return {};
1867}
#define SkDEBUGFAILF(fmt,...)
Definition: SkAssert.h:119

◆ gpuOnlyBuffersMorePerformant()

bool GrVkCaps::gpuOnlyBuffersMorePerformant ( ) const
inline

Definition at line 193 of file GrVkCaps.h.

193{ return fGpuOnlyBuffersMorePerformant; }

◆ isFormatAsColorTypeRenderable()

bool GrVkCaps::isFormatAsColorTypeRenderable ( GrColorType  ct,
const GrBackendFormat format,
int  sampleCount = 1 
) const
overridevirtual

Implements GrCaps.

Definition at line 1571 of file GrVkCaps.cpp.

1572 {
1573 if (!this->isFormatRenderable(format, sampleCount)) {
1574 return false;
1575 }
1576 VkFormat vkFormat;
1577 if (!GrBackendFormats::AsVkFormat(format, &vkFormat)) {
1578 return false;
1579 }
1580 const auto& info = this->getFormatInfo(vkFormat);
1581 if (!SkToBool(info.colorTypeFlags(ct) & ColorTypeInfo::kRenderable_Flag)) {
1582 return false;
1583 }
1584 return true;
1585}
bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const override
Definition: GrVkCaps.cpp:1587

◆ isFormatCopyable()

bool GrVkCaps::isFormatCopyable ( const GrBackendFormat ) const
inlineoverridevirtual

Implements GrCaps.

Definition at line 47 of file GrVkCaps.h.

47{ return true; }

◆ isFormatRenderable() [1/2]

bool GrVkCaps::isFormatRenderable ( const GrBackendFormat format,
int  sampleCount 
) const
overridevirtual

Implements GrCaps.

Definition at line 1587 of file GrVkCaps.cpp.

1587 {
1588 VkFormat vkFormat;
1589 if (!GrBackendFormats::AsVkFormat(format, &vkFormat)) {
1590 return false;
1591 }
1592 return this->isFormatRenderable(vkFormat, sampleCount);
1593}

◆ isFormatRenderable() [2/2]

bool GrVkCaps::isFormatRenderable ( VkFormat  format,
int  sampleCount 
) const

Definition at line 1595 of file GrVkCaps.cpp.

1595 {
1596 return sampleCount <= this->maxRenderTargetSampleCount(format);
1597}
int maxRenderTargetSampleCount(const GrBackendFormat &) const override
Definition: GrVkCaps.cpp:1633

◆ isFormatSRGB()

bool GrVkCaps::isFormatSRGB ( const GrBackendFormat format) const
overridevirtual

Implements GrCaps.

Definition at line 1541 of file GrVkCaps.cpp.

1541 {
1542 VkFormat vkFormat;
1543 if (!GrBackendFormats::AsVkFormat(format, &vkFormat)) {
1544 return false;
1545 }
1547 return false;
1548 }
1549
1550 return format_is_srgb(vkFormat);
1551}
static bool format_is_srgb(VkFormat format)
Definition: GrVkCaps.cpp:776
static bool backend_format_is_external(const GrBackendFormat &format)
Definition: GrVkCaps.cpp:1524

◆ isFormatTexturable()

bool GrVkCaps::isFormatTexturable ( const GrBackendFormat format,
GrTextureType   
) const
overridevirtual

Implements GrCaps.

Definition at line 1553 of file GrVkCaps.cpp.

1553 {
1554 VkFormat vkFormat;
1555 if (!GrBackendFormats::AsVkFormat(format, &vkFormat)) {
1556 return false;
1557 }
1559 // We can always texture from an external format (assuming we have the ycbcr conversion
1560 // info which we require to be passed in).
1561 return true;
1562 }
1563 return this->isVkFormatTexturable(vkFormat);
1564}

◆ isVkFormatTexturable()

bool GrVkCaps::isVkFormatTexturable ( VkFormat  format) const

Definition at line 1566 of file GrVkCaps.cpp.

1566 {
1567 const FormatInfo& info = this->getFormatInfo(format);
1568 return SkToBool(FormatInfo::kTexturable_Flag & info.fOptimalFlags);
1569}

◆ isVkFormatTexturableLinearly()

bool GrVkCaps::isVkFormatTexturableLinearly ( VkFormat  format) const
inline

Definition at line 67 of file GrVkCaps.h.

67 {
68 return SkToBool(FormatInfo::kTexturable_Flag & this->getFormatInfo(format).fLinearFlags);
69 }

◆ makeDesc()

GrProgramDesc GrVkCaps::makeDesc ( GrRenderTarget rt,
const GrProgramInfo programInfo,
ProgramDescOverrideFlags  overrideFlags 
) const
overridevirtual

For Vulkan we want to cache the entire VkPipeline for reuse of draws. The Desc here holds all the information needed to differentiate one pipeline from another.

The GrProgramDesc contains all the information need to create the actual shaders for the pipeline.

For Vulkan we need to add to the GrProgramDesc to include the rest of the state on the pipline. This includes stencil settings, blending information, render pass format, draw face information, and primitive type. Note that some state is set dynamically on the pipeline for each draw and thus is not included in this descriptor. This includes the viewport, scissor, and blend constant.

Implements GrCaps.

Definition at line 1968 of file GrVkCaps.cpp.

1970 {
1972 GrProgramDesc::Build(&desc, programInfo, *this);
1973
1974 skgpu::KeyBuilder b(desc.key());
1975
1976 // This will become part of the sheared off key used to persistently cache
1977 // the SPIRV code. It needs to be added right after the base key so that,
1978 // when the base-key is sheared off, the shearing code can include it in the
1979 // reduced key (c.f. the +4s in the SkData::MakeWithCopy calls in
1980 // GrVkPipelineStateBuilder.cpp).
1982
1984 if (programInfo.renderPassBarriers() & GrXferBarrierFlags::kBlend) {
1986 }
1989 }
1990
1991 bool needsResolve = this->programInfoWillUseDiscardableMSAA(programInfo);
1992
1993 bool forceLoadFromResolve =
1995 SkASSERT(!forceLoadFromResolve || needsResolve);
1996
1998 if (needsResolve && (programInfo.colorLoadOp() == GrLoadOp::kLoad || forceLoadFromResolve)) {
2000 }
2001
2002 if (rt) {
2003 GrVkRenderTarget* vkRT = (GrVkRenderTarget*) rt;
2004
2005 SkASSERT(!needsResolve || (vkRT->resolveAttachment() &&
2007
2008 bool needsStencil = programInfo.needsStencil() || programInfo.isStencilEnabled();
2009 // TODO: support failure in getSimpleRenderPass
2010 auto rp = vkRT->getSimpleRenderPass(needsResolve, needsStencil, selfDepFlags,
2011 loadFromResolve);
2012 SkASSERT(rp);
2013 rp->genKey(&b);
2014
2015#ifdef SK_DEBUG
2016 if (!rp->isExternal()) {
2017 // This is to ensure ReconstructAttachmentsDescriptor keeps matching
2018 // getSimpleRenderPass' result
2019 GrVkRenderPass::AttachmentsDescriptor attachmentsDescriptor;
2020 GrVkRenderPass::AttachmentFlags attachmentFlags;
2022 &attachmentsDescriptor,
2023 &attachmentFlags);
2024 SkASSERT(rp->isCompatible(attachmentsDescriptor, attachmentFlags, selfDepFlags,
2025 loadFromResolve));
2026 }
2027#endif
2028 } else {
2029 GrVkRenderPass::AttachmentsDescriptor attachmentsDescriptor;
2030 GrVkRenderPass::AttachmentFlags attachmentFlags;
2032 &attachmentsDescriptor,
2033 &attachmentFlags);
2034
2035 // kExternal_AttachmentFlag is only set for wrapped secondary command buffers - which
2036 // will always go through the above 'rt' path (i.e., we can always pass 0 as the final
2037 // parameter to GenKey).
2038 GrVkRenderPass::GenKey(&b, attachmentFlags, attachmentsDescriptor, selfDepFlags,
2039 loadFromResolve, 0);
2040 }
2041
2042 GrStencilSettings stencil = programInfo.nonGLStencilSettings();
2043 stencil.genKey(&b, true);
2044
2045 programInfo.pipeline().genKey(&b, *this);
2046 b.add32(programInfo.numSamples());
2047
2048 // Vulkan requires the full primitive type as part of its key
2049 b.add32(programInfo.primitiveTypeKey());
2050
2051 b.flush();
2052 return desc;
2053}
void genKey(skgpu::KeyBuilder *, const GrCaps &) const
Definition: GrPipeline.cpp:79
static void Build(GrProgramDesc *, const GrProgramInfo &, const GrCaps &)
uint16_t primitiveTypeKey() const
Definition: GrProgramInfo.h:54
int numSamples() const
Definition: GrProgramInfo.h:29
const GrPipeline & pipeline() const
Definition: GrProgramInfo.h:39
bool isStencilEnabled() const
Definition: GrProgramInfo.h:31
GrLoadOp colorLoadOp() const
Definition: GrProgramInfo.h:52
int needsStencil() const
Definition: GrProgramInfo.h:30
GrStencilSettings nonGLStencilSettings() const
GrXferBarrierFlags renderPassBarriers() const
Definition: GrProgramInfo.h:50
void genKey(skgpu::KeyBuilder *b, bool includeRefsAndMasks) const
bool programInfoWillUseDiscardableMSAA(const GrProgramInfo &) const
Definition: GrVkCaps.cpp:1796
@ kShader_PersistentCacheKeyType
Definition: GrVkGpu.h:185
bool supportsInputAttachmentUsage() const
Definition: GrVkImage.h:102
static void GenKey(skgpu::KeyBuilder *, AttachmentFlags, const AttachmentsDescriptor &, SelfDependencyFlags selfDepFlags, LoadFromResolve, uint64_t externalRenderPass)
static void ReconstructAttachmentsDescriptor(const GrVkCaps &vkCaps, const GrProgramInfo &programInfo, GrVkRenderPass::AttachmentsDescriptor *desc, GrVkRenderPass::AttachmentFlags *flags)
GrVkImage * resolveAttachment() const
const GrVkRenderPass * getSimpleRenderPass(bool withResolve, bool withStencil, SelfDependencyFlags selfDepFlags, LoadFromResolve)

◆ maxDrawIndirectDrawCount()

uint32_t GrVkCaps::maxDrawIndirectDrawCount ( ) const
inline

Definition at line 203 of file GrVkCaps.h.

203{ return fMaxDrawIndirectDrawCount; }

◆ maxInputAttachmentDescriptors()

uint32_t GrVkCaps::maxInputAttachmentDescriptors ( ) const
inline

Definition at line 181 of file GrVkCaps.h.

181{ return fMaxInputAttachmentDescriptors; }

◆ maxPerPoolCachedSecondaryCommandBuffers()

int GrVkCaps::maxPerPoolCachedSecondaryCommandBuffers ( ) const
inline

Definition at line 177 of file GrVkCaps.h.

177 {
178 return fMaxPerPoolCachedSecondaryCommandBuffers;
179 }

◆ maxRenderTargetSampleCount() [1/2]

int GrVkCaps::maxRenderTargetSampleCount ( const GrBackendFormat format) const
overridevirtual

Implements GrCaps.

Definition at line 1633 of file GrVkCaps.cpp.

1633 {
1634 VkFormat vkFormat;
1635 if (!GrBackendFormats::AsVkFormat(format, &vkFormat)) {
1636 return 0;
1637 }
1638 return this->maxRenderTargetSampleCount(vkFormat);
1639}

◆ maxRenderTargetSampleCount() [2/2]

int GrVkCaps::maxRenderTargetSampleCount ( VkFormat  format) const

Definition at line 1641 of file GrVkCaps.cpp.

1641 {
1642 const FormatInfo& info = this->getFormatInfo(format);
1643
1644 const auto& table = info.fColorSampleCounts;
1645 if (table.empty()) {
1646 return 0;
1647 }
1648 return table[table.size() - 1];
1649}
SI F table(const skcms_Curve *curve, F v)

◆ maxSamplerAnisotropy()

float GrVkCaps::maxSamplerAnisotropy ( ) const
inline

Definition at line 183 of file GrVkCaps.h.

183{ return fMaxSamplerAnisotropy; }

◆ mustInvalidatePrimaryCmdBufferStateAfterClearAttachments()

bool GrVkCaps::mustInvalidatePrimaryCmdBufferStateAfterClearAttachments ( ) const
inline

Definition at line 185 of file GrVkCaps.h.

185 {
186 return fMustInvalidatePrimaryCmdBufferStateAfterClearAttachments;
187 }

◆ mustLoadFullImageWithDiscardableMSAA()

bool GrVkCaps::mustLoadFullImageWithDiscardableMSAA ( ) const
inline

Definition at line 259 of file GrVkCaps.h.

259 {
260 return fMustLoadFullImageWithDiscardableMSAA;
261 }

◆ mustSyncCommandBuffersWithQueue()

bool GrVkCaps::mustSyncCommandBuffersWithQueue ( ) const
inline

Definition at line 91 of file GrVkCaps.h.

91{ return fMustSyncCommandBuffersWithQueue; }

◆ preferPrimaryOverSecondaryCommandBuffers()

bool GrVkCaps::preferPrimaryOverSecondaryCommandBuffers ( ) const
inline

Definition at line 173 of file GrVkCaps.h.

173 {
174 return fPreferPrimaryOverSecondaryCommandBuffers;
175 }

◆ preferredStencilFormat()

VkFormat GrVkCaps::preferredStencilFormat ( ) const
inline

Returns both a supported and most preferred stencil format to use in draws.

Definition at line 104 of file GrVkCaps.h.

104{ return fPreferredStencilFormat; }

◆ programInfoWillUseDiscardableMSAA()

bool GrVkCaps::programInfoWillUseDiscardableMSAA ( const GrProgramInfo programInfo) const

Definition at line 1796 of file GrVkCaps.cpp.

1796 {
1797 return programInfo.targetHasVkResolveAttachmentWithInput() &&
1798 programInfo.numSamples() > 1 &&
1799 ((programInfo.targetsNumSamples() > 1 && this->preferDiscardableMSAAAttachment()) ||
1800 (programInfo.targetsNumSamples() == 1 && this->supportsDiscardableMSAAForDMSAA()));
1801}
bool preferDiscardableMSAAAttachment() const
Definition: GrCaps.h:107
int targetsNumSamples() const
Definition: GrProgramInfo.h:48
bool targetHasVkResolveAttachmentWithInput() const
Definition: GrProgramInfo.h:44
bool supportsDiscardableMSAAForDMSAA() const
Definition: GrVkCaps.h:262

◆ renderTargetSupportsDiscardableMSAA()

bool GrVkCaps::renderTargetSupportsDiscardableMSAA ( const GrVkRenderTarget rt) const

Definition at line 1789 of file GrVkCaps.cpp.

1789 {
1790 return rt->resolveAttachment() &&
1792 ((rt->numSamples() > 1 && this->preferDiscardableMSAAAttachment()) ||
1793 (rt->numSamples() == 1 && this->supportsDiscardableMSAAForDMSAA()));
1794}
int numSamples() const

◆ shouldAlwaysUseDedicatedImageMemory()

bool GrVkCaps::shouldAlwaysUseDedicatedImageMemory ( ) const
inline

Definition at line 94 of file GrVkCaps.h.

94 {
95 return fShouldAlwaysUseDedicatedImageMemory;
96 }

◆ shouldPersistentlyMapCpuToGpuBuffers()

bool GrVkCaps::shouldPersistentlyMapCpuToGpuBuffers ( ) const
inline

Definition at line 198 of file GrVkCaps.h.

198 {
199 return fShouldPersistentlyMapCpuToGpuBuffers;
200 }

◆ supportedWritePixelsColorType()

GrCaps::SupportedWrite GrVkCaps::supportedWritePixelsColorType ( GrColorType  surfaceColorType,
const GrBackendFormat surfaceFormat,
GrColorType  srcColorType 
) const
overridevirtual

Given a dst pixel config and a src color type what color type must the caller coax the the data into in order to use GrGpu::writePixels().

Implements GrCaps.

Definition at line 1662 of file GrVkCaps.cpp.

1664 {
1665 VkFormat vkFormat;
1666 if (!GrBackendFormats::AsVkFormat(surfaceFormat, &vkFormat)) {
1667 return {GrColorType::kUnknown, 0};
1668 }
1669
1670 // We don't support the ability to upload to external formats or formats that require a ycbcr
1671 // sampler. In general these types of formats are only used for sampling in a shader.
1672 if (backend_format_is_external(surfaceFormat) || skgpu::VkFormatNeedsYcbcrSampler(vkFormat)) {
1673 return {GrColorType::kUnknown, 0};
1674 }
1675
1676 // The VkBufferImageCopy bufferOffset field must be both a multiple of 4 and of a single texel.
1677 size_t offsetAlignment = align_to_4(skgpu::VkFormatBytesPerBlock(vkFormat));
1678
1679 const auto& info = this->getFormatInfo(vkFormat);
1680 for (int i = 0; i < info.fColorTypeInfoCount; ++i) {
1681 const auto& ctInfo = info.fColorTypeInfos[i];
1682 if (ctInfo.fColorType == surfaceColorType) {
1683 return {ctInfo.fTransferColorType, offsetAlignment};
1684 }
1685 }
1686 return {GrColorType::kUnknown, 0};
1687}
static size_t align_to_4(size_t v)
Definition: GrVkCaps.cpp:1651
static constexpr size_t VkFormatBytesPerBlock(VkFormat vkFormat)
static constexpr bool VkFormatNeedsYcbcrSampler(VkFormat format)

◆ supportsAndroidHWBExternalMemory()

bool GrVkCaps::supportsAndroidHWBExternalMemory ( ) const
inline

Definition at line 150 of file GrVkCaps.h.

150{ return fSupportsAndroidHWBExternalMemory; }

◆ supportsBindMemory2()

bool GrVkCaps::supportsBindMemory2 ( ) const
inline

Definition at line 134 of file GrVkCaps.h.

134{ return fSupportsBindMemory2; }

◆ supportsDedicatedAllocation()

bool GrVkCaps::supportsDedicatedAllocation ( ) const
inline

Definition at line 145 of file GrVkCaps.h.

145{ return fSupportsDedicatedAllocation; }

◆ supportsDeviceFaultInfo()

bool GrVkCaps::supportsDeviceFaultInfo ( ) const
inline

Definition at line 170 of file GrVkCaps.h.

170{ return fSupportsDeviceFaultInfo; }

◆ supportsDiscardableMSAAForDMSAA()

bool GrVkCaps::supportsDiscardableMSAAForDMSAA ( ) const
inline

Definition at line 262 of file GrVkCaps.h.

262{ return fSupportsDiscardableMSAAForDMSAA; }

◆ supportsDRMFormatModifiers()

bool GrVkCaps::supportsDRMFormatModifiers ( ) const
inline

Definition at line 168 of file GrVkCaps.h.

168{ return fSupportsDRMFormatModifiers; }

◆ supportsExternalMemory()

bool GrVkCaps::supportsExternalMemory ( ) const
inline

Definition at line 148 of file GrVkCaps.h.

148{ return fSupportsExternalMemory; }

◆ supportsMaintenance1()

bool GrVkCaps::supportsMaintenance1 ( ) const
inline

Definition at line 138 of file GrVkCaps.h.

138{ return fSupportsMaintenance1; }

◆ supportsMaintenance2()

bool GrVkCaps::supportsMaintenance2 ( ) const
inline

Definition at line 139 of file GrVkCaps.h.

139{ return fSupportsMaintenance2; }

◆ supportsMaintenance3()

bool GrVkCaps::supportsMaintenance3 ( ) const
inline

Definition at line 140 of file GrVkCaps.h.

140{ return fSupportsMaintenance3; }

◆ supportsMemorylessAttachments()

bool GrVkCaps::supportsMemorylessAttachments ( ) const
inline

Definition at line 268 of file GrVkCaps.h.

268{ return fSupportsMemorylessAttachments; }

◆ supportsMemoryRequirements2()

bool GrVkCaps::supportsMemoryRequirements2 ( ) const
inline

Definition at line 131 of file GrVkCaps.h.

131{ return fSupportsMemoryRequirements2; }

◆ supportsPhysicalDeviceProperties2()

bool GrVkCaps::supportsPhysicalDeviceProperties2 ( ) const
inline

Definition at line 129 of file GrVkCaps.h.

129{ return fSupportsPhysicalDeviceProperties2; }

◆ supportsSwapchain()

bool GrVkCaps::supportsSwapchain ( ) const
inline

Definition at line 126 of file GrVkCaps.h.

126{ return fSupportsSwapchain; }

◆ supportsYcbcrConversion()

bool GrVkCaps::supportsYcbcrConversion ( ) const
inline

Definition at line 153 of file GrVkCaps.h.

153{ return fSupportsYcbcrConversion; }

◆ surfaceSupportsReadPixels()

GrCaps::SurfaceReadPixelsSupport GrVkCaps::surfaceSupportsReadPixels ( const GrSurface ) const
overridevirtual

Backends may have restrictions on what types of surfaces support GrGpu::readPixels(). We may either be able to read directly from the surface, read from a copy of the surface, or not read at all.

Implements GrCaps.

Definition at line 1689 of file GrVkCaps.cpp.

1690 {
1691 if (surface->isProtected()) {
1693 }
1694 if (auto tex = static_cast<const GrVkTexture*>(surface->asTexture())) {
1695 auto texImage = tex->textureImage();
1696 if (!texImage) {
1698 }
1699 // We can't directly read from a VkImage that has a ycbcr sampler.
1700 if (texImage->ycbcrConversionInfo().isValid()) {
1702 }
1703 // We can't directly read from a compressed format
1704 if (skgpu::VkFormatIsCompressed(texImage->imageFormat())) {
1706 }
1708 } else if (auto rt = surface->asRenderTarget()) {
1709 if (rt->numSamples() > 1) {
1711 }
1713 }
1715}
VkSurfaceKHR surface
Definition: main.cc:49
static constexpr bool VkFormatIsCompressed(VkFormat vkFormat)

◆ transferColorType()

GrColorType GrVkCaps::transferColorType ( VkFormat  vkFormat,
GrColorType  surfaceColorType 
) const

Definition at line 1717 of file GrVkCaps.cpp.

1717 {
1718 const auto& info = this->getFormatInfo(vkFormat);
1719 for (int i = 0; i < info.fColorTypeInfoCount; ++i) {
1720 if (info.fColorTypeInfos[i].fColorType == surfaceColorType) {
1721 return info.fColorTypeInfos[i].fTransferColorType;
1722 }
1723 }
1724 return GrColorType::kUnknown;
1725}

◆ ycbcrCombinedImageSamplerDescriptorCount()

uint32_t GrVkCaps::ycbcrCombinedImageSamplerDescriptorCount ( ) const
inline

Definition at line 163 of file GrVkCaps.h.

163 {
164 return 3;
165 }

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