Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
GrCaps Class Referenceabstract

#include <GrCaps.h>

Inheritance diagram for GrCaps:
SkCapabilities SkRefCnt SkRefCntBase GrD3DCaps GrGLCaps GrMockCaps GrMtlCaps GrVkCaps

Classes

struct  DstCopyRestrictions
 
struct  SupportedRead
 
struct  SupportedWrite
 

Public Types

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 }
 

Public Member Functions

 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
 
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
 

Protected Member Functions

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

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
 

Private Member Functions

virtual void onApplyOptionsOverrides (const GrContextOptions &)
 
virtual void onDumpJSON (SkJSONWriter *) const
 
virtual bool onSurfaceSupportsWritePixels (const GrSurface *) const =0
 
virtual bool onCanCopySurface (const GrSurfaceProxy *dst, const SkIRect &dstRect, const GrSurfaceProxy *src, const SkIRect &srcRect) const =0
 
virtual GrBackendFormat onGetDefaultBackendFormat (GrColorType) const =0
 
virtual bool onIsWindowRectanglesSupportedForRT (const GrBackendRenderTarget &) const
 
virtual bool onAreColorTypeAndFormatCompatible (GrColorType, const GrBackendFormat &) const =0
 
virtual SupportedRead onSupportedReadPixelsColorType (GrColorType srcColorType, const GrBackendFormat &srcFormat, GrColorType dstColorType) const =0
 
virtual skgpu::Swizzle onGetReadSwizzle (const GrBackendFormat &, GrColorType) const =0
 
virtual GrDstSampleFlags onGetDstSampleFlagsForProxy (const GrRenderTargetProxy *) const
 

Additional Inherited Members

- Static Public Member Functions inherited from SkCapabilities
static sk_sp< const SkCapabilitiesRasterBackend ()
 

Detailed Description

Represents the capabilities of a GrContext.

Definition at line 57 of file GrCaps.h.

Member Enumeration Documentation

◆ BlendEquationSupport

Indicates the capabilities of the fixed function blend unit.

Enumerator
kBasic_BlendEquationSupport 
kAdvanced_BlendEquationSupport 
kAdvancedCoherent_BlendEquationSupport 
kLast_BlendEquationSupport 

Definition at line 149 of file GrCaps.h.

149 {
150 kBasic_BlendEquationSupport, //<! Support to select the operator that
151 // combines src and dst terms.
152 kAdvanced_BlendEquationSupport, //<! Additional fixed function support for specific
153 // SVG/PDF blend modes. Requires blend barriers.
154 kAdvancedCoherent_BlendEquationSupport, //<! Advanced blend equation support that does not
155 // require blend barriers, and permits overlap.
156
158 };
@ kAdvancedCoherent_BlendEquationSupport
Definition GrCaps.h:154
@ kLast_BlendEquationSupport
Definition GrCaps.h:157
@ kAdvanced_BlendEquationSupport
Definition GrCaps.h:152
@ kBasic_BlendEquationSupport
Definition GrCaps.h:150

◆ MapFlags

Indicates whether GPU->CPU memory mapping for GPU resources such as vertex buffers and textures allows partial mappings or full mappings.

Enumerator
kNone_MapFlags 
kCanMap_MapFlag 
kSubset_MapFlag 
kAsyncRead_MapFlag 

Definition at line 196 of file GrCaps.h.

196 {
197 kNone_MapFlags = 0x0, //<! Cannot map the resource.
198
199 kCanMap_MapFlag = 0x1, //<! The resource can be mapped. Must be set for any of
200 // the other flags to have meaning.
201 kSubset_MapFlag = 0x2, //<! The resource can be partially mapped.
202 kAsyncRead_MapFlag = 0x4, //<! Are maps for reading asynchronous WRT GrOpsRenderPass
203 // submitted to GrGpu.
204 };
@ kCanMap_MapFlag
Definition GrCaps.h:199
@ kSubset_MapFlag
Definition GrCaps.h:201
@ kNone_MapFlags
Definition GrCaps.h:197
@ kAsyncRead_MapFlag
Definition GrCaps.h:202

◆ ProgramDescOverrideFlags

Enumerator
kNone 
kVulkanHasResolveLoadSubpass 

Definition at line 511 of file GrCaps.h.

511 {
512 kNone = 0,
513 // If using discardable msaa surfaces in vulkan, when we break up a render pass for an
514 // inline upload, we must do a load msaa subpass for the second render pass. However, if the
515 // original render pass did not have this load subpass (e.g. clear or discard load op), then
516 // all the GrProgramInfos for draws that end up in the second render pass will have been
517 // recorded thinking they will be in a render pass with only 1 subpass. Thus we add an
518 // override flag to the makeDesc call to force the actually VkPipeline that gets created to
519 // be created using a render pass with 2 subpasses. We do miss on the pre-compile with this
520 // approach, but inline uploads are very rare and already slow.
522 };

◆ SurfaceReadPixelsSupport

Indicates whether surface supports GrGpu::readPixels, must be copied, or cannot be read.

Enumerator
kSupported 

GrGpu::readPixels is supported by the surface.

kCopyToTexture2D 

GrGpu::readPixels is not supported by this surface but this surface can be drawn or copied to a Ganesh-created GrTextureType::kTexture2D and then that surface will be readable.

kUnsupported 

Not supported

Definition at line 296 of file GrCaps.h.

296 {
297 /** GrGpu::readPixels is supported by the surface. */
299 /**
300 * GrGpu::readPixels is not supported by this surface but this surface can be drawn
301 * or copied to a Ganesh-created GrTextureType::kTexture2D and then that surface will be
302 * readable.
303 */
305 /**
306 * Not supported
307 */
309 };

Constructor & Destructor Documentation

◆ GrCaps()

GrCaps::GrCaps ( const GrContextOptions options)

Definition at line 26 of file GrCaps.cpp.

26 {
28 fMipmapSupport = false;
29 fAnisoSupport = false;
32 fGpuTracingSupport = false;
40 fWireframeSupport = false;
51 fSemaphoreSupport = false;
71
74
76
83
84 fSuppressPrints = options.fSuppressPrints;
85#if defined(GR_TEST_UTILS)
86 fWireframeMode = options.fWireframeMode;
87#else
88 fWireframeMode = false;
89#endif
90 fBufferMapThreshold = options.fBufferMapThreshold;
95 fAvoidDithering = false;
96 fAvoidLineDraws = false;
98
100
101 // Default to true, allow older versions of OpenGL to disable explicitly
103
104 fDriverBugWorkarounds = options.fDriverBugWorkarounds;
105}
const char * options
bool fSupportsProtectedContent
Definition GrCaps.h:648
bool fDynamicStateArrayGeometryProcessorTextureSupport
Definition GrCaps.h:646
int fMaxPreferredRenderTargetSize
Definition GrCaps.h:658
int fMaxVertexAttributes
Definition GrCaps.h:659
bool fFinishedProcAsyncCallbackSupport
Definition GrCaps.h:640
bool fAvoidStencilBuffers
Definition GrCaps.h:627
int fMaxRenderTargetSize
Definition GrCaps.h:657
bool fReadPixelsRowBytesSupport
Definition GrCaps.h:621
bool fNativeDrawIndexedIndirectIsBroken
Definition GrCaps.h:629
bool fPreferClientSideDynamicBuffers
Definition GrCaps.h:603
bool fMSAAResolvesAutomatically
Definition GrCaps.h:600
bool fReuseScratchTextures
Definition GrCaps.h:589
GrDriverBugWorkarounds fDriverBugWorkarounds
Definition GrCaps.h:668
bool fNativeDrawIndirectSupport
Definition GrCaps.h:596
bool fPreferVRAMUseOverFlushes
Definition GrCaps.h:636
bool fAnisoSupport
Definition GrCaps.h:588
bool fAvoidLineDraws
Definition GrCaps.h:633
bool fTransferFromBufferToBufferSupport
Definition GrCaps.h:618
bool fTransferFromBufferToTextureSupport
Definition GrCaps.h:616
bool fTextureBarrierSupport
Definition GrCaps.h:593
bool fAvoidLargeIndexBufferDraws
Definition GrCaps.h:614
uint32_t fAdvBlendEqDisableFlags
Definition GrCaps.h:651
bool fBuffersAreInitiallyZero
Definition GrCaps.h:607
bool fTransferPixelsToRowBytesSupport
Definition GrCaps.h:620
int fBufferMapThreshold
Definition GrCaps.h:655
bool fMustSyncGpuDuringAbandon
Definition GrCaps.h:623
bool fBackendSemaphoreSupport
Definition GrCaps.h:639
bool fHalfFloatVertexAttributeSupport
Definition GrCaps.h:610
bool fClampToBorderSupport
Definition GrCaps.h:611
bool fSampleLocationsSupport
Definition GrCaps.h:594
bool fGpuTracingSupport
Definition GrCaps.h:591
bool fOversizedStencilSupport
Definition GrCaps.h:592
bool fSemaphoreSupport
Definition GrCaps.h:638
int fMaxWindowRectangles
Definition GrCaps.h:661
bool fTwoSidedStencilRefsAndMasksMustMatch
Definition GrCaps.h:605
bool fUsePrimitiveRestart
Definition GrCaps.h:602
bool fMipmapSupport
Definition GrCaps.h:587
bool fWireframeSupport
Definition GrCaps.h:599
int fInternalMultisampleCount
Definition GrCaps.h:662
uint32_t fMapBufferFlags
Definition GrCaps.h:654
bool fPerformPartialClearsAsDraws
Definition GrCaps.h:612
bool fReuseScratchBuffers
Definition GrCaps.h:590
bool fWritePixelsRowBytesSupport
Definition GrCaps.h:619
bool fShouldCollapseSrcOverToSrcWhenAble
Definition GrCaps.h:622
bool fPerformColorClearsAsDraws
Definition GrCaps.h:613
bool fAvoidReorderingRenderTasks
Definition GrCaps.h:630
bool fNPOTTextureTileSupport
Definition GrCaps.h:586
bool fSupportsAHardwareBufferImages
Definition GrCaps.h:609
bool fTransferFromSurfaceToBufferSupport
Definition GrCaps.h:617
bool fMustClearUploadedBufferData
Definition GrCaps.h:606
bool fShouldInitializeTextures
Definition GrCaps.h:608
bool fAvoidWritePixelsFastPath
Definition GrCaps.h:628
BlendEquationSupport fBlendEquationSupport
Definition GrCaps.h:650
bool fPreferDiscardableMSAAAttachment
Definition GrCaps.h:601
bool fConservativeRasterSupport
Definition GrCaps.h:598
bool fDisableTessellationPathRenderer
Definition GrCaps.h:626
bool fUseClientSideIndirectBuffers
Definition GrCaps.h:597
bool fPerformStencilClearsAsDraws
Definition GrCaps.h:615
bool fDrawInstancedSupport
Definition GrCaps.h:595
int fMaxTextureSize
Definition GrCaps.h:660
bool fDisablePerspectiveSDFText
Definition GrCaps.h:632
bool fCrossContextTextureSupport
Definition GrCaps.h:643
bool fPreferFullscreenClears
Definition GrCaps.h:604
bool fAvoidDithering
Definition GrCaps.h:631

Member Function Documentation

◆ addExtraSamplerKey()

virtual void GrCaps::addExtraSamplerKey ( skgpu::KeyBuilder ,
GrSamplerState  ,
const GrBackendFormat  
) const
inlinevirtual

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 in GrD3DCaps, and GrVkCaps.

Definition at line 507 of file GrCaps.h.

509 {}

◆ advancedBlendEquationSupport()

bool GrCaps::advancedBlendEquationSupport ( ) const
inline

Definition at line 162 of file GrCaps.h.

◆ advancedCoherentBlendEquationSupport()

bool GrCaps::advancedCoherentBlendEquationSupport ( ) const
inline

Definition at line 166 of file GrCaps.h.

◆ anisoSupport()

bool GrCaps::anisoSupport ( ) const
inline

Is anisotropic filtering supported.

Definition at line 74 of file GrCaps.h.

74{ return fAnisoSupport; }

◆ areColorTypeAndFormatCompatible()

bool GrCaps::areColorTypeAndFormatCompatible ( GrColorType  grCT,
const GrBackendFormat format 
) const

Definition at line 428 of file GrCaps.cpp.

429 {
430 if (GrColorType::kUnknown == grCT) {
431 return false;
432 }
433
435 if (compression != SkTextureCompressionType::kNone) {
436 return grCT == (SkTextureCompressionTypeIsOpaque(compression) ? GrColorType::kRGB_888x
438 }
439
440 return this->onAreColorTypeAndFormatCompatible(grCT, format);
441}
SkTextureCompressionType GrBackendFormatToCompressionType(const GrBackendFormat &format)
static constexpr bool SkTextureCompressionTypeIsOpaque(SkTextureCompressionType compression)
virtual bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat &) const =0
uint32_t uint32_t * format

◆ avoidDithering()

bool GrCaps::avoidDithering ( ) const
inline

Definition at line 546 of file GrCaps.h.

546 {
547 return fAvoidDithering;
548 }

◆ avoidLargeIndexBufferDraws()

bool GrCaps::avoidLargeIndexBufferDraws ( ) const
inline

Definition at line 433 of file GrCaps.h.

◆ avoidLineDraws()

bool GrCaps::avoidLineDraws ( ) const
inline

Definition at line 555 of file GrCaps.h.

555{ return fAvoidLineDraws; }

◆ avoidReorderingRenderTasks()

bool GrCaps::avoidReorderingRenderTasks ( ) const
inline

Definition at line 542 of file GrCaps.h.

542 {
544 }

◆ avoidStencilBuffers()

bool GrCaps::avoidStencilBuffers ( ) const
inline

Definition at line 139 of file GrCaps.h.

139{ return fAvoidStencilBuffers; }

◆ avoidWritePixelsFastPath()

bool GrCaps::avoidWritePixelsFastPath ( ) const
inline

Definition at line 141 of file GrCaps.h.

◆ backendSemaphoreSupport()

bool GrCaps::backendSemaphoreSupport ( ) const
inline

Supports using GrBackendSemaphore as "signal" semaphores or for waiting. See also GrFlushInfo and GrDirectContext.

Definition at line 406 of file GrCaps.h.

406{ return fBackendSemaphoreSupport; }

◆ blendEquationSupport()

BlendEquationSupport GrCaps::blendEquationSupport ( ) const
inline

Definition at line 160 of file GrCaps.h.

160{ return fBlendEquationSupport; }

◆ bufferMapThreshold()

size_t GrCaps::bufferMapThreshold ( ) const
inline

Definition at line 373 of file GrCaps.h.

373 {
375 return static_cast<size_t>(fBufferMapThreshold);
376 }
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ buffersAreInitiallyZero()

bool GrCaps::buffersAreInitiallyZero ( ) const
inline

When a new GrGpuBuffer is created is it known to contain all zero bytes?

Definition at line 391 of file GrCaps.h.

391{ return fBuffersAreInitiallyZero; }

◆ bufferUpdateDataPreserveAlignment()

size_t GrCaps::bufferUpdateDataPreserveAlignment ( ) const
inline

Definition at line 250 of file GrCaps.h.

250 {
252 }
size_t fBufferUpdateDataPreserveAlignment
Definition GrCaps.h:666

◆ canCopySurface()

bool GrCaps::canCopySurface ( const GrSurfaceProxy dst,
const SkIRect dstRect,
const GrSurfaceProxy src,
const SkIRect srcRect 
) const

Returns whether or not we will be able to do a copy given the passed in params

Definition at line 309 of file GrCaps.cpp.

310 {
311 if (dst->readOnly()) {
312 return false;
313 }
314
315 if (dst->backendFormat() != src->backendFormat()) {
316 return false;
317 }
318 // For simplicity, all GrGpu::copySurface() calls can assume that srcRect and dstRect
319 // are already contained within their respective surfaces.
320 if (!SkIRect::MakeSize(dst->dimensions()).contains(dstRect) ||
321 !SkIRect::MakeSize(src->dimensions()).contains(srcRect)) {
322 return false;
323 }
324 return this->onCanCopySurface(dst, dstRect, src, srcRect);
325}
virtual bool onCanCopySurface(const GrSurfaceProxy *dst, const SkIRect &dstRect, const GrSurfaceProxy *src, const SkIRect &srcRect) const =0
dst
Definition cp.py:12
static constexpr SkIRect MakeSize(const SkISize &size)
Definition SkRect.h:66
bool contains(int32_t x, int32_t y) const
Definition SkRect.h:463

◆ clampToBorderSupport()

bool GrCaps::clampToBorderSupport ( ) const
inline

The CLAMP_TO_BORDER wrap mode for texture coordinates was added to desktop GL in 1.3, and GLES 3.2, but is also available in extensions. Vulkan and Metal always have support.

Definition at line 484 of file GrCaps.h.

484{ return fClampToBorderSupport; }

◆ computeFormatKey()

virtual uint64_t GrCaps::computeFormatKey ( const GrBackendFormat ) const
pure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMockCaps, GrMtlCaps, and GrVkCaps.

◆ conservativeRasterSupport()

bool GrCaps::conservativeRasterSupport ( ) const
inline

Definition at line 95 of file GrCaps.h.

◆ crossContextTextureSupport()

bool GrCaps::crossContextTextureSupport ( ) const
inline

Definition at line 411 of file GrCaps.h.

◆ disablePerspectiveSDFText()

bool GrCaps::disablePerspectiveSDFText ( ) const
inline

Definition at line 550 of file GrCaps.h.

550 {
552 }

◆ disableTessellationPathRenderer()

bool GrCaps::disableTessellationPathRenderer ( ) const
inline

Definition at line 441 of file GrCaps.h.

◆ discardStencilValuesAfterRenderPass()

bool GrCaps::discardStencilValuesAfterRenderPass ( ) const
inline

Definition at line 122 of file GrCaps.h.

122 {
123 // b/160958008
124 return false;
125#if 0
126 // This method is actually just a duplicate of preferFullscreenClears(), with a descriptive
127 // name for the sake of readability.
128 return this->preferFullscreenClears();
129#endif
130 }
bool preferFullscreenClears() const
Definition GrCaps.h:118

◆ dmsaaResolveCanBeUsedAsTextureInSameRenderPass()

virtual bool GrCaps::dmsaaResolveCanBeUsedAsTextureInSameRenderPass ( ) const
inlinevirtual

Reimplemented in GrVkCaps.

Definition at line 539 of file GrCaps.h.

539{ return true; }

◆ drawInstancedSupport()

bool GrCaps::drawInstancedSupport ( ) const
inline

Definition at line 80 of file GrCaps.h.

80{ return fDrawInstancedSupport; }

◆ dumpJSON()

void GrCaps::dumpJSON ( SkJSONWriter writer) const

Definition at line 302 of file GrCaps.cpp.

302{ }

◆ dynamicStateArrayGeometryProcessorTextureSupport()

bool GrCaps::dynamicStateArrayGeometryProcessorTextureSupport ( ) const
inline

Definition at line 418 of file GrCaps.h.

◆ finishedProcAsyncCallbackSupport()

bool GrCaps::finishedProcAsyncCallbackSupport ( ) const
inline

Supports async callback for finishedProcs

Definition at line 409 of file GrCaps.h.

◆ finishInitialization()

void GrCaps::finishInitialization ( const GrContextOptions options)
protected

Definition at line 107 of file GrCaps.cpp.

107 {
109 // We will implement indirect draws with a polyfill, so the commands need to reside in CPU
110 // memory.
112 }
113
114 this->applyOptionsOverrides(options);
115
116 // Our render targets are always created with textures as the color attachment, hence this min:
119
120 this->initSkCaps(this->shaderCaps());
121}
const GrShaderCaps * shaderCaps() const
Definition GrCaps.h:63
void initSkCaps(const SkSL::ShaderCaps *)

◆ getBackendFormatFromCompressionType()

virtual GrBackendFormat GrCaps::getBackendFormatFromCompressionType ( SkTextureCompressionType  ) const
pure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMockCaps, GrMtlCaps, and GrVkCaps.

◆ getDefaultBackendFormat()

GrBackendFormat GrCaps::getDefaultBackendFormat ( GrColorType  colorType,
GrRenderable  renderable 
) const

These are used when creating a new texture internally.

Definition at line 400 of file GrCaps.cpp.

401 {
402 // Unknown color types are always an invalid format, so early out before calling virtual.
404 return {};
405 }
406
409 return {};
410 }
412 return {};
413 }
414 // Currently we require that it be possible to write pixels into the "default" format. Perhaps,
415 // that could be a separate requirement from the caller. It seems less necessary if
416 // renderability was requested.
419 return {};
420 }
421 if (renderable == GrRenderable::kYes &&
423 return {};
424 }
425 return format;
426}
SkColorType fColorType
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
virtual bool isFormatTexturable(const GrBackendFormat &, GrTextureType) const =0
virtual SupportedWrite supportedWritePixelsColorType(GrColorType surfaceColorType, const GrBackendFormat &surfaceFormat, GrColorType srcColorType) const =0
bool areColorTypeAndFormatCompatible(GrColorType grCT, const GrBackendFormat &format) const
Definition GrCaps.cpp:428
virtual bool isFormatAsColorTypeRenderable(GrColorType ct, const GrBackendFormat &format, int sampleCount=1) const =0
virtual GrBackendFormat onGetDefaultBackendFormat(GrColorType) const =0

◆ getDstCopyRestrictions()

virtual DstCopyRestrictions GrCaps::getDstCopyRestrictions ( const GrRenderTargetProxy src,
GrColorType  ct 
) const
inlinevirtual

Reimplemented in GrMtlCaps, and GrGLCaps.

Definition at line 461 of file GrCaps.h.

462 {
463 return {};
464 }

◆ getDstSampleFlagsForProxy()

GrDstSampleFlags GrCaps::getDstSampleFlagsForProxy ( const GrRenderTargetProxy rt,
bool  drawUsesMSAA 
) const

Definition at line 461 of file GrCaps.cpp.

462 {
463 SkASSERT(rt);
464 if (this->textureBarrierSupport() && (!drawUsesMSAA || this->msaaResolvesAutomatically())) {
465 return this->onGetDstSampleFlagsForProxy(rt);
466 }
468}
virtual GrDstSampleFlags onGetDstSampleFlagsForProxy(const GrRenderTargetProxy *) const
Definition GrCaps.h:698
bool textureBarrierSupport() const
Definition GrCaps.h:78
bool msaaResolvesAutomatically() const
Definition GrCaps.h:100

◆ getExtraSurfaceFlagsForDeferredRT()

virtual GrInternalSurfaceFlags GrCaps::getExtraSurfaceFlagsForDeferredRT ( ) const
inlinevirtual

Reimplemented in GrVkCaps.

Definition at line 533 of file GrCaps.h.

◆ getFallbackColorTypeAndFormat()

std::tuple< GrColorType, GrBackendFormat > GrCaps::getFallbackColorTypeAndFormat ( GrColorType  ct,
int  sampleCount 
) const

Checks whether the passed color type is renderable. If so, the same color type is passed back along with the default format used for the color type. If not, provides an alternative (perhaps lower bit depth and/or unorm instead of float) color type that is supported along with it's default format or kUnknown if there no renderable fallback format.

Definition at line 499 of file GrCaps.cpp.

501 {
502 do {
503 auto format = this->getDefaultBackendFormat(ct, GrRenderable::kYes);
504 // We continue to the fallback color type if there no default renderable format or we
505 // requested msaa and the format doesn't support msaa.
506 if (format.isValid() && this->isFormatRenderable(format, sampleCnt)) {
507 return {ct, format};
508 }
509 ct = color_type_fallback(ct);
510 } while (ct != GrColorType::kUnknown);
511 return {GrColorType::kUnknown, {}};
512}
static GrColorType color_type_fallback(GrColorType ct)
Definition GrCaps.cpp:476
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
Definition GrCaps.cpp:400

◆ getReadSwizzle()

skgpu::Swizzle GrCaps::getReadSwizzle ( const GrBackendFormat format,
GrColorType  colorType 
) const

Returns the skgpu::Swizzle to use when sampling or reading back from a texture with the passed in GrBackendFormat and GrColorType.

Definition at line 443 of file GrCaps.cpp.

443 {
445 if (compression != SkTextureCompressionType::kNone) {
447 return skgpu::Swizzle::RGBA();
448 }
449 SkDEBUGFAILF("Illegal color type (%d) and compressed format (%d) combination.",
450 (int)colorType, (int)compression);
451 return {};
452 }
453
454 return this->onGetReadSwizzle(format, colorType);
455}
#define SkDEBUGFAILF(fmt,...)
Definition SkAssert.h:119
virtual skgpu::Swizzle onGetReadSwizzle(const GrBackendFormat &, GrColorType) const =0
static constexpr Swizzle RGBA()
Definition Swizzle.h:66

◆ getRenderTargetSampleCount()

virtual int GrCaps::getRenderTargetSampleCount ( int  requestedCount,
const GrBackendFormat  
) const
pure virtual

Implemented in GrMockCaps, GrD3DCaps, GrMtlCaps, GrVkCaps, and GrGLCaps.

◆ getWriteSwizzle()

virtual skgpu::Swizzle GrCaps::getWriteSwizzle ( const GrBackendFormat ,
GrColorType   
) const
pure virtual

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

Implemented in GrD3DCaps, GrGLCaps, GrMtlCaps, GrVkCaps, and GrMockCaps.

◆ gpuTracingSupport()

bool GrCaps::gpuTracingSupport ( ) const
inline

Definition at line 76 of file GrCaps.h.

76{ return fGpuTracingSupport; }

◆ GR_DECL_BITFIELD_CLASS_OPS_FRIENDS()

GrCaps::GR_DECL_BITFIELD_CLASS_OPS_FRIENDS ( ProgramDescOverrideFlags  )

◆ halfFloatVertexAttributeSupport()

bool GrCaps::halfFloatVertexAttributeSupport ( ) const
inline

Definition at line 108 of file GrCaps.h.

◆ internalMultisampleCount()

int GrCaps::internalMultisampleCount ( const GrBackendFormat format) const
inline

Definition at line 271 of file GrCaps.h.

271 {
272 return std::min(fInternalMultisampleCount, this->maxRenderTargetSampleCount(format));
273 }
virtual int maxRenderTargetSampleCount(const GrBackendFormat &) const =0

◆ isAdvancedBlendEquationDisabled()

bool GrCaps::isAdvancedBlendEquationDisabled ( skgpu::BlendEquation  equation) const
inline

Definition at line 170 of file GrCaps.h.

170 {
173 return SkToBool(fAdvBlendEqDisableFlags & (1 << static_cast<int>(equation)));
174 }
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35
bool advancedBlendEquationSupport() const
Definition GrCaps.h:162
static constexpr bool BlendEquationIsAdvanced(BlendEquation equation)
Definition Blend.h:129

◆ isFormatAsColorTypeRenderable()

virtual bool GrCaps::isFormatAsColorTypeRenderable ( GrColorType  ct,
const GrBackendFormat format,
int  sampleCount = 1 
) const
pure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMockCaps, GrMtlCaps, and GrVkCaps.

◆ isFormatCompressed()

bool GrCaps::isFormatCompressed ( const GrBackendFormat format) const

Definition at line 457 of file GrCaps.cpp.

◆ isFormatCopyable()

virtual bool GrCaps::isFormatCopyable ( const GrBackendFormat ) const
pure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMtlCaps, GrVkCaps, and GrMockCaps.

◆ isFormatRenderable()

virtual bool GrCaps::isFormatRenderable ( const GrBackendFormat format,
int  sampleCount 
) const
pure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMockCaps, GrMtlCaps, and GrVkCaps.

◆ isFormatSRGB()

virtual bool GrCaps::isFormatSRGB ( const GrBackendFormat ) const
pure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMtlCaps, GrVkCaps, and GrMockCaps.

◆ isFormatTexturable()

virtual bool GrCaps::isFormatTexturable ( const GrBackendFormat ,
GrTextureType   
) const
pure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMtlCaps, GrVkCaps, and GrMockCaps.

◆ isWindowRectanglesSupportedForRT()

bool GrCaps::isWindowRectanglesSupportedForRT ( const GrBackendRenderTarget rt) const
inline

Definition at line 234 of file GrCaps.h.

234 {
235 return this->maxWindowRectangles() > 0 && this->onIsWindowRectanglesSupportedForRT(rt);
236 }
virtual bool onIsWindowRectanglesSupportedForRT(const GrBackendRenderTarget &) const
Definition GrCaps.h:686
int maxWindowRectangles() const
Definition GrCaps.h:231

◆ makeDesc()

virtual GrProgramDesc GrCaps::makeDesc ( GrRenderTarget ,
const GrProgramInfo ,
ProgramDescOverrideFlags  overrideFlags = ProgramDescOverrideFlags::kNone 
) const
pure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMockCaps, GrMtlCaps, and GrVkCaps.

◆ mapBufferFlags()

uint32_t GrCaps::mapBufferFlags ( ) const
inline

Definition at line 211 of file GrCaps.h.

211{ return fMapBufferFlags; }

◆ maxPreferredRenderTargetSize()

int GrCaps::maxPreferredRenderTargetSize ( ) const
inline

This is the largest render target size that can be used without incurring extra perfomance cost. It is usually the max RT size, unless larger render targets are known to be slower.

Definition at line 227 of file GrCaps.h.

◆ maxPushConstantsSize()

uint32_t GrCaps::maxPushConstantsSize ( ) const
inline

Definition at line 238 of file GrCaps.h.

238{ return fMaxPushConstantsSize; }
uint32_t fMaxPushConstantsSize
Definition GrCaps.h:663

◆ maxRenderTargetSampleCount()

virtual int GrCaps::maxRenderTargetSampleCount ( const GrBackendFormat ) const
pure virtual

Implemented in GrD3DCaps, GrMtlCaps, GrVkCaps, GrGLCaps, and GrMockCaps.

◆ maxRenderTargetSize()

int GrCaps::maxRenderTargetSize ( ) const
inline

Definition at line 223 of file GrCaps.h.

223{ return fMaxRenderTargetSize; }

◆ maxTextureSize()

int GrCaps::maxTextureSize ( ) const
inline

Definition at line 229 of file GrCaps.h.

229{ return fMaxTextureSize; }

◆ maxVertexAttributes()

int GrCaps::maxVertexAttributes ( ) const
inline

maximum number of attribute values per vertex

Definition at line 221 of file GrCaps.h.

221{ return fMaxVertexAttributes; }

◆ maxWindowRectangles()

int GrCaps::maxWindowRectangles ( ) const
inline

Definition at line 231 of file GrCaps.h.

231{ return fMaxWindowRectangles; }

◆ mipmapSupport()

bool GrCaps::mipmapSupport ( ) const
inline

To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g. only for POT textures)

Definition at line 72 of file GrCaps.h.

72{ return fMipmapSupport; }

◆ msaaResolvesAutomatically()

bool GrCaps::msaaResolvesAutomatically ( ) const
inline

Definition at line 100 of file GrCaps.h.

◆ mustClearUploadedBufferData()

bool GrCaps::mustClearUploadedBufferData ( ) const
inline

True in environments that will issue errors if memory uploaded to buffers is not initialized (even if not read by draw calls).

Definition at line 380 of file GrCaps.h.

◆ mustSyncGpuDuringAbandon()

bool GrCaps::mustSyncGpuDuringAbandon ( ) const
inline

Definition at line 185 of file GrCaps.h.

185 {
187 }

◆ nativeDrawIndexedIndirectIsBroken()

bool GrCaps::nativeDrawIndexedIndirectIsBroken ( ) const
inline

Definition at line 144 of file GrCaps.h.

◆ nativeDrawIndirectSupport()

bool GrCaps::nativeDrawIndirectSupport ( ) const
inline

Definition at line 84 of file GrCaps.h.

◆ npotTextureTileSupport()

bool GrCaps::npotTextureTileSupport ( ) const
inline

Definition at line 69 of file GrCaps.h.

◆ onApplyOptionsOverrides()

virtual void GrCaps::onApplyOptionsOverrides ( const GrContextOptions )
inlineprivatevirtual

Reimplemented in GrGLCaps.

Definition at line 677 of file GrCaps.h.

677{}

◆ onAreColorTypeAndFormatCompatible()

virtual bool GrCaps::onAreColorTypeAndFormatCompatible ( GrColorType  ,
const GrBackendFormat  
) const
privatepure virtual

Implemented in GrMockCaps, GrD3DCaps, GrGLCaps, GrMtlCaps, and GrVkCaps.

◆ onCanCopySurface()

virtual bool GrCaps::onCanCopySurface ( const GrSurfaceProxy dst,
const SkIRect dstRect,
const GrSurfaceProxy src,
const SkIRect srcRect 
) const
privatepure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMockCaps, GrMtlCaps, and GrVkCaps.

◆ onDumpJSON()

virtual void GrCaps::onDumpJSON ( SkJSONWriter ) const
inlineprivatevirtual

Reimplemented in GrGLCaps, and GrMtlCaps.

Definition at line 678 of file GrCaps.h.

678{}

◆ onGetDefaultBackendFormat()

virtual GrBackendFormat GrCaps::onGetDefaultBackendFormat ( GrColorType  ) const
privatepure virtual

Implemented in GrMockCaps, GrD3DCaps, GrGLCaps, GrMtlCaps, and GrVkCaps.

◆ onGetDstSampleFlagsForProxy()

virtual GrDstSampleFlags GrCaps::onGetDstSampleFlagsForProxy ( const GrRenderTargetProxy ) const
inlineprivatevirtual

Reimplemented in GrGLCaps, and GrVkCaps.

Definition at line 698 of file GrCaps.h.

698 {
700 }

◆ onGetReadSwizzle()

virtual skgpu::Swizzle GrCaps::onGetReadSwizzle ( const GrBackendFormat ,
GrColorType   
) const
privatepure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMtlCaps, GrVkCaps, and GrMockCaps.

◆ onIsWindowRectanglesSupportedForRT()

virtual bool GrCaps::onIsWindowRectanglesSupportedForRT ( const GrBackendRenderTarget ) const
inlineprivatevirtual

Reimplemented in GrGLCaps.

Definition at line 686 of file GrCaps.h.

686 {
687 return true;
688 }

◆ onSupportedReadPixelsColorType()

virtual SupportedRead GrCaps::onSupportedReadPixelsColorType ( GrColorType  srcColorType,
const GrBackendFormat srcFormat,
GrColorType  dstColorType 
) const
privatepure virtual

Implemented in GrMockCaps, GrD3DCaps, GrGLCaps, GrMtlCaps, and GrVkCaps.

◆ onSupportsDynamicMSAA()

virtual bool GrCaps::onSupportsDynamicMSAA ( const GrRenderTargetProxy ) const
inlineprotectedvirtual

Reimplemented in GrGLCaps, and GrVkCaps.

Definition at line 582 of file GrCaps.h.

582{ return false; }

◆ onSurfaceSupportsWritePixels()

virtual bool GrCaps::onSurfaceSupportsWritePixels ( const GrSurface ) const
privatepure virtual

Implemented in GrD3DCaps, GrGLCaps, GrMockCaps, GrMtlCaps, and GrVkCaps.

◆ oversizedStencilSupport()

bool GrCaps::oversizedStencilSupport ( ) const
inline

Definition at line 77 of file GrCaps.h.

◆ performColorClearsAsDraws()

bool GrCaps::performColorClearsAsDraws ( ) const
inline

Definition at line 431 of file GrCaps.h.

◆ performPartialClearsAsDraws()

bool GrCaps::performPartialClearsAsDraws ( ) const
inline

Definition at line 426 of file GrCaps.h.

◆ performStencilClearsAsDraws()

bool GrCaps::performStencilClearsAsDraws ( ) const
inline

Adreno 4xx devices experience an issue when there are a large number of stencil clip bit clears. The minimal repro steps are not precisely known but drawing a rect with a stencil op instead of using glClear seems to resolve the issue.

Definition at line 438 of file GrCaps.h.

◆ preferClientSideDynamicBuffers()

bool GrCaps::preferClientSideDynamicBuffers ( ) const
inline

Definition at line 114 of file GrCaps.h.

◆ preferDiscardableMSAAAttachment()

bool GrCaps::preferDiscardableMSAAAttachment ( ) const
inline

Definition at line 107 of file GrCaps.h.

◆ preferFullscreenClears()

bool GrCaps::preferFullscreenClears ( ) const
inline

Definition at line 118 of file GrCaps.h.

118{ return fPreferFullscreenClears; }

◆ preferVRAMUseOverFlushes()

bool GrCaps::preferVRAMUseOverFlushes ( ) const
inline

Definition at line 137 of file GrCaps.h.

◆ readPixelsRowBytesSupport()

bool GrCaps::readPixelsRowBytesSupport ( ) const
inline

Does GrGpu::readPixels() support a dst buffer where the row bytes is not equal to bpp * w?

Definition at line 365 of file GrCaps.h.

◆ reducedShaderMode()

bool GrCaps::reducedShaderMode ( ) const
inline

Definition at line 190 of file GrCaps.h.

190{ return this->shaderCaps()->fReducedShaderMode; }
bool fReducedShaderMode

◆ reuseScratchBuffers()

bool GrCaps::reuseScratchBuffers ( ) const
inline

Definition at line 218 of file GrCaps.h.

218{ return fReuseScratchBuffers; }

◆ reuseScratchTextures()

bool GrCaps::reuseScratchTextures ( ) const
inline

Definition at line 217 of file GrCaps.h.

217{ return fReuseScratchTextures; }

◆ sampleLocationsSupport()

bool GrCaps::sampleLocationsSupport ( ) const
inline

Definition at line 79 of file GrCaps.h.

◆ semaphoreSupport()

bool GrCaps::semaphoreSupport ( ) const
inline

Supports using GrSemaphores.

Definition at line 402 of file GrCaps.h.

402{ return fSemaphoreSupport; }

◆ shaderCaps()

const GrShaderCaps * GrCaps::shaderCaps ( ) const
inline

Definition at line 63 of file GrCaps.h.

63{ return fShaderCaps.get(); }
std::unique_ptr< GrShaderCaps > fShaderCaps
Definition GrCaps.h:584

◆ shouldCollapseSrcOverToSrcWhenAble()

bool GrCaps::shouldCollapseSrcOverToSrcWhenAble ( ) const
inline

Definition at line 179 of file GrCaps.h.

179 {
181 }

◆ shouldInitializeTextures()

bool GrCaps::shouldInitializeTextures ( ) const
inline

For some environments, there is a performance or safety concern to not initializing textures. For example, with WebGL and Firefox, there is a large performance hit to not doing it.

Definition at line 386 of file GrCaps.h.

◆ supportedReadPixelsColorType()

GrCaps::SupportedRead GrCaps::supportedReadPixelsColorType ( GrColorType  srcColorType,
const GrBackendFormat srcFormat,
GrColorType  dstColorType 
) const

Given a src surface's color type and its backend format as well as a color type the caller would like read into, this provides a legal color type that the caller may pass to GrGpu::readPixels(). The returned color type may differ from the passed dstColorType, in which case the caller must convert the read pixel data (see GrConvertPixels). When converting to dstColorType the swizzle in the returned struct should be applied. The caller must check the returned color type for kUnknown.

Definition at line 366 of file GrCaps.cpp.

368 {
369 SupportedRead read = this->onSupportedReadPixelsColorType(srcColorType, srcFormat,
370 dstColorType);
371
372 // There are known problems with 24 vs 32 bit BPP with this color type. Just fail for now if
373 // using a transfer buffer.
374 if (GrColorType::kRGB_888x == read.fColorType) {
375 read.fOffsetAlignmentForTransferBuffer = 0;
376 }
377 // It's very convenient to access 1 byte-per-channel 32 bit color types as uint32_t on the CPU.
378 // Make those aligned reads out of the buffer even if the underlying API doesn't require it.
379 auto channelFlags = GrColorTypeChannelFlags(read.fColorType);
380 if ((channelFlags == kRGBA_SkColorChannelFlags || channelFlags == kRGB_SkColorChannelFlags ||
381 channelFlags == kAlpha_SkColorChannelFlag || channelFlags == kGray_SkColorChannelFlag) &&
382 GrColorTypeBytesPerPixel(read.fColorType) == 4) {
383 switch (read.fOffsetAlignmentForTransferBuffer & 0b11) {
384 // offset alignment already a multiple of 4
385 case 0:
386 break;
387 // offset alignment is a multiple of 2 but not 4.
388 case 2:
389 read.fOffsetAlignmentForTransferBuffer *= 2;
390 break;
391 // offset alignment is not a multiple of 2.
392 default:
393 read.fOffsetAlignmentForTransferBuffer *= 4;
394 break;
395 }
396 }
397 return read;
398}
static constexpr uint32_t GrColorTypeChannelFlags(GrColorType ct)
static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct)
@ kRGB_SkColorChannelFlags
Definition SkColor.h:247
@ kRGBA_SkColorChannelFlags
Definition SkColor.h:248
@ kAlpha_SkColorChannelFlag
Definition SkColor.h:242
@ kGray_SkColorChannelFlag
Definition SkColor.h:243
static bool read(SkStream *stream, void *buffer, size_t amount)
virtual SupportedRead onSupportedReadPixelsColorType(GrColorType srcColorType, const GrBackendFormat &srcFormat, GrColorType dstColorType) const =0

◆ supportedWritePixelsColorType()

virtual SupportedWrite GrCaps::supportedWritePixelsColorType ( GrColorType  surfaceColorType,
const GrBackendFormat surfaceFormat,
GrColorType  srcColorType 
) const
pure virtual

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().

Implemented in GrD3DCaps, GrGLCaps, GrMockCaps, GrMtlCaps, and GrVkCaps.

◆ supportsAHardwareBufferImages()

bool GrCaps::supportsAHardwareBufferImages ( ) const
inline

Returns true if the given backend supports importing AHardwareBuffers via the GrAHardwarebufferImageGenerator. This will only ever be supported on Android devices with API level >= 26.

Definition at line 397 of file GrCaps.h.

◆ supportsDynamicMSAA()

bool GrCaps::supportsDynamicMSAA ( const GrRenderTargetProxy rtProxy) const

Definition at line 470 of file GrCaps.cpp.

470 {
471 return rtProxy->numSamples() == 1 &&
472 this->internalMultisampleCount(rtProxy->backendFormat()) > 1 &&
473 this->onSupportsDynamicMSAA(rtProxy);
474}
virtual bool onSupportsDynamicMSAA(const GrRenderTargetProxy *) const
Definition GrCaps.h:582
int internalMultisampleCount(const GrBackendFormat &format) const
Definition GrCaps.h:271
const GrBackendFormat & backendFormat() const

◆ supportsProtectedContent()

bool GrCaps::supportsProtectedContent ( ) const
inline

Definition at line 422 of file GrCaps.h.

◆ suppressPrints()

bool GrCaps::suppressPrints ( ) const
inline

Definition at line 371 of file GrCaps.h.

371{ return fSuppressPrints; }

◆ surfaceSupportsReadPixels()

virtual SurfaceReadPixelsSupport GrCaps::surfaceSupportsReadPixels ( const GrSurface ) const
pure virtual

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.

Implemented in GrD3DCaps, GrGLCaps, GrMtlCaps, GrVkCaps, and GrMockCaps.

◆ surfaceSupportsWritePixels()

bool GrCaps::surfaceSupportsWritePixels ( const GrSurface surface) const

Backends may have restrictions on what types of surfaces support GrGpu::writePixels(). If this returns false then the caller should implement a fallback where a temporary texture is created, pixels are written to it, and then that is copied or drawn into the the surface.

Definition at line 305 of file GrCaps.cpp.

305 {
306 return surface->readOnly() ? false : this->onSurfaceSupportsWritePixels(surface);
307}
virtual bool onSurfaceSupportsWritePixels(const GrSurface *) const =0
VkSurfaceKHR surface
Definition main.cc:49

◆ textureBarrierSupport()

bool GrCaps::textureBarrierSupport ( ) const
inline

Definition at line 78 of file GrCaps.h.

78{ return fTextureBarrierSupport; }

◆ transferBufferRowBytesAlignment()

size_t GrCaps::transferBufferRowBytesAlignment ( ) const
inline

Definition at line 241 of file GrCaps.h.

size_t fTransferBufferRowBytesAlignment
Definition GrCaps.h:664

◆ transferFromBufferToBufferAlignment()

size_t GrCaps::transferFromBufferToBufferAlignment ( ) const
inline

Definition at line 244 of file GrCaps.h.

244 {
246 }
size_t fTransferFromBufferToBufferAlignment
Definition GrCaps.h:665

◆ transferFromBufferToBufferSupport()

bool GrCaps::transferFromBufferToBufferSupport ( ) const
inline

Definition at line 369 of file GrCaps.h.

◆ transferFromBufferToTextureSupport()

bool GrCaps::transferFromBufferToTextureSupport ( ) const
inline

Definition at line 368 of file GrCaps.h.

◆ transferFromSurfaceToBufferSupport()

bool GrCaps::transferFromSurfaceToBufferSupport ( ) const
inline

Definition at line 367 of file GrCaps.h.

◆ transferPixelsToRowBytesSupport()

bool GrCaps::transferPixelsToRowBytesSupport ( ) const
inline

Does GrGpu::transferPixelsTo() support a src buffer where the row bytes is not equal to bpp * w?

Definition at line 360 of file GrCaps.h.

◆ twoSidedStencilRefsAndMasksMustMatch()

bool GrCaps::twoSidedStencilRefsAndMasksMustMatch ( ) const
inline

Definition at line 133 of file GrCaps.h.

133 {
135 }

◆ useClientSideIndirectBuffers()

bool GrCaps::useClientSideIndirectBuffers ( ) const
inline

Definition at line 85 of file GrCaps.h.

85 {
86#ifdef SK_DEBUG
88 // We might implement indirect draws with a polyfill, so the commands need to reside in
89 // CPU memory.
91 }
92#endif
94 }

◆ usePrimitiveRestart()

bool GrCaps::usePrimitiveRestart ( ) const
inline

Definition at line 112 of file GrCaps.h.

112{ return fUsePrimitiveRestart; }

◆ validateSurfaceParams()

bool GrCaps::validateSurfaceParams ( const SkISize dimensions,
const GrBackendFormat format,
GrRenderable  renderable,
int  renderTargetSampleCnt,
skgpu::Mipmapped  mipped,
GrTextureType  textureType 
) const

Definition at line 327 of file GrCaps.cpp.

329 {
330 if (textureType != GrTextureType::kNone) {
331 if (!this->isFormatTexturable(format, textureType)) {
332 return false;
333 }
334 }
335
336 if (skgpu::Mipmapped::kYes == mipped && !this->mipmapSupport()) {
337 return false;
338 }
339
340 if (dimensions.width() < 1 || dimensions.height() < 1) {
341 return false;
342 }
343
344 if (renderable == GrRenderable::kYes) {
345 if (!this->isFormatRenderable(format, renderTargetSampleCnt)) {
346 return false;
347 }
348 int maxRTSize = this->maxRenderTargetSize();
349 if (dimensions.width() > maxRTSize || dimensions.height() > maxRTSize) {
350 return false;
351 }
352 } else {
353 // We currently do not support multisampled textures
354 if (renderTargetSampleCnt != 1) {
355 return false;
356 }
357 int maxSize = this->maxTextureSize();
358 if (dimensions.width() > maxSize || dimensions.height() > maxSize) {
359 return false;
360 }
361 }
362
363 return true;
364}
bool mipmapSupport() const
Definition GrCaps.h:72
int maxTextureSize() const
Definition GrCaps.h:229
int maxRenderTargetSize() const
Definition GrCaps.h:223
virtual bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const =0
constexpr int32_t width() const
Definition SkSize.h:36
constexpr int32_t height() const
Definition SkSize.h:37

◆ wireframeMode()

bool GrCaps::wireframeMode ( ) const
inline

Definition at line 399 of file GrCaps.h.

399{ return fWireframeMode; }

◆ wireframeSupport()

bool GrCaps::wireframeSupport ( ) const
inline

Definition at line 96 of file GrCaps.h.

96{ return fWireframeSupport; }

◆ workarounds()

const GrDriverBugWorkarounds & GrCaps::workarounds ( ) const
inline

Definition at line 500 of file GrCaps.h.

500{ return fDriverBugWorkarounds; }

◆ writePixelsRowBytesSupport()

bool GrCaps::writePixelsRowBytesSupport ( ) const
inline

Does GrGpu::writePixels() support a src buffer where the row bytes is not equal to bpp * w?

Definition at line 354 of file GrCaps.h.

Member Data Documentation

◆ fAdvBlendEqDisableFlags

uint32_t GrCaps::fAdvBlendEqDisableFlags
protected

Definition at line 651 of file GrCaps.h.

◆ fAnisoSupport

bool GrCaps::fAnisoSupport
protected

Definition at line 588 of file GrCaps.h.

◆ fAvoidDithering

bool GrCaps::fAvoidDithering
protected

Definition at line 631 of file GrCaps.h.

◆ fAvoidLargeIndexBufferDraws

bool GrCaps::fAvoidLargeIndexBufferDraws
protected

Definition at line 614 of file GrCaps.h.

◆ fAvoidLineDraws

bool GrCaps::fAvoidLineDraws
protected

Definition at line 633 of file GrCaps.h.

◆ fAvoidReorderingRenderTasks

bool GrCaps::fAvoidReorderingRenderTasks
protected

Definition at line 630 of file GrCaps.h.

◆ fAvoidStencilBuffers

bool GrCaps::fAvoidStencilBuffers
protected

Definition at line 627 of file GrCaps.h.

◆ fAvoidWritePixelsFastPath

bool GrCaps::fAvoidWritePixelsFastPath
protected

Definition at line 628 of file GrCaps.h.

◆ fBackendSemaphoreSupport

bool GrCaps::fBackendSemaphoreSupport
protected

Definition at line 639 of file GrCaps.h.

◆ fBlendEquationSupport

BlendEquationSupport GrCaps::fBlendEquationSupport
protected

Definition at line 650 of file GrCaps.h.

◆ fBufferMapThreshold

int GrCaps::fBufferMapThreshold
protected

Definition at line 655 of file GrCaps.h.

◆ fBuffersAreInitiallyZero

bool GrCaps::fBuffersAreInitiallyZero
protected

Definition at line 607 of file GrCaps.h.

◆ fBufferUpdateDataPreserveAlignment

size_t GrCaps::fBufferUpdateDataPreserveAlignment = 1
protected

Definition at line 666 of file GrCaps.h.

◆ fClampToBorderSupport

bool GrCaps::fClampToBorderSupport
protected

Definition at line 611 of file GrCaps.h.

◆ fConservativeRasterSupport

bool GrCaps::fConservativeRasterSupport
protected

Definition at line 598 of file GrCaps.h.

◆ fCrossContextTextureSupport

bool GrCaps::fCrossContextTextureSupport
protected

Definition at line 643 of file GrCaps.h.

◆ fDisablePerspectiveSDFText

bool GrCaps::fDisablePerspectiveSDFText
protected

Definition at line 632 of file GrCaps.h.

◆ fDisableTessellationPathRenderer

bool GrCaps::fDisableTessellationPathRenderer
protected

Definition at line 626 of file GrCaps.h.

◆ fDrawInstancedSupport

bool GrCaps::fDrawInstancedSupport
protected

Definition at line 595 of file GrCaps.h.

◆ fDriverBugWorkarounds

GrDriverBugWorkarounds GrCaps::fDriverBugWorkarounds
protected

Definition at line 668 of file GrCaps.h.

◆ fDynamicStateArrayGeometryProcessorTextureSupport

bool GrCaps::fDynamicStateArrayGeometryProcessorTextureSupport
protected

Definition at line 646 of file GrCaps.h.

◆ fFinishedProcAsyncCallbackSupport

bool GrCaps::fFinishedProcAsyncCallbackSupport
protected

Definition at line 640 of file GrCaps.h.

◆ fGpuTracingSupport

bool GrCaps::fGpuTracingSupport
protected

Definition at line 591 of file GrCaps.h.

◆ fHalfFloatVertexAttributeSupport

bool GrCaps::fHalfFloatVertexAttributeSupport
protected

Definition at line 610 of file GrCaps.h.

◆ fInternalMultisampleCount

int GrCaps::fInternalMultisampleCount
protected

Definition at line 662 of file GrCaps.h.

◆ fMapBufferFlags

uint32_t GrCaps::fMapBufferFlags
protected

Definition at line 654 of file GrCaps.h.

◆ fMaxPreferredRenderTargetSize

int GrCaps::fMaxPreferredRenderTargetSize
protected

Definition at line 658 of file GrCaps.h.

◆ fMaxPushConstantsSize

uint32_t GrCaps::fMaxPushConstantsSize = 0
protected

Definition at line 663 of file GrCaps.h.

◆ fMaxRenderTargetSize

int GrCaps::fMaxRenderTargetSize
protected

Definition at line 657 of file GrCaps.h.

◆ fMaxTextureSize

int GrCaps::fMaxTextureSize
protected

Definition at line 660 of file GrCaps.h.

◆ fMaxVertexAttributes

int GrCaps::fMaxVertexAttributes
protected

Definition at line 659 of file GrCaps.h.

◆ fMaxWindowRectangles

int GrCaps::fMaxWindowRectangles
protected

Definition at line 661 of file GrCaps.h.

◆ fMipmapSupport

bool GrCaps::fMipmapSupport
protected

Definition at line 587 of file GrCaps.h.

◆ fMSAAResolvesAutomatically

bool GrCaps::fMSAAResolvesAutomatically
protected

Definition at line 600 of file GrCaps.h.

◆ fMustClearUploadedBufferData

bool GrCaps::fMustClearUploadedBufferData
protected

Definition at line 606 of file GrCaps.h.

◆ fMustSyncGpuDuringAbandon

bool GrCaps::fMustSyncGpuDuringAbandon
protected

Definition at line 623 of file GrCaps.h.

◆ fNativeDrawIndexedIndirectIsBroken

bool GrCaps::fNativeDrawIndexedIndirectIsBroken
protected

Definition at line 629 of file GrCaps.h.

◆ fNativeDrawIndirectSupport

bool GrCaps::fNativeDrawIndirectSupport
protected

Definition at line 596 of file GrCaps.h.

◆ fNPOTTextureTileSupport

bool GrCaps::fNPOTTextureTileSupport
protected

Definition at line 586 of file GrCaps.h.

◆ fOversizedStencilSupport

bool GrCaps::fOversizedStencilSupport
protected

Definition at line 592 of file GrCaps.h.

◆ fPerformColorClearsAsDraws

bool GrCaps::fPerformColorClearsAsDraws
protected

Definition at line 613 of file GrCaps.h.

◆ fPerformPartialClearsAsDraws

bool GrCaps::fPerformPartialClearsAsDraws
protected

Definition at line 612 of file GrCaps.h.

◆ fPerformStencilClearsAsDraws

bool GrCaps::fPerformStencilClearsAsDraws
protected

Definition at line 615 of file GrCaps.h.

◆ fPreferClientSideDynamicBuffers

bool GrCaps::fPreferClientSideDynamicBuffers
protected

Definition at line 603 of file GrCaps.h.

◆ fPreferDiscardableMSAAAttachment

bool GrCaps::fPreferDiscardableMSAAAttachment
protected

Definition at line 601 of file GrCaps.h.

◆ fPreferFullscreenClears

bool GrCaps::fPreferFullscreenClears
protected

Definition at line 604 of file GrCaps.h.

◆ fPreferVRAMUseOverFlushes

bool GrCaps::fPreferVRAMUseOverFlushes
protected

Definition at line 636 of file GrCaps.h.

◆ fReadPixelsRowBytesSupport

bool GrCaps::fReadPixelsRowBytesSupport
protected

Definition at line 621 of file GrCaps.h.

◆ fReuseScratchBuffers

bool GrCaps::fReuseScratchBuffers
protected

Definition at line 590 of file GrCaps.h.

◆ fReuseScratchTextures

bool GrCaps::fReuseScratchTextures
protected

Definition at line 589 of file GrCaps.h.

◆ fSampleLocationsSupport

bool GrCaps::fSampleLocationsSupport
protected

Definition at line 594 of file GrCaps.h.

◆ fSemaphoreSupport

bool GrCaps::fSemaphoreSupport
protected

Definition at line 638 of file GrCaps.h.

◆ fShaderCaps

std::unique_ptr<GrShaderCaps> GrCaps::fShaderCaps
protected

Definition at line 584 of file GrCaps.h.

◆ fShouldCollapseSrcOverToSrcWhenAble

bool GrCaps::fShouldCollapseSrcOverToSrcWhenAble
protected

Definition at line 622 of file GrCaps.h.

◆ fShouldInitializeTextures

bool GrCaps::fShouldInitializeTextures
protected

Definition at line 608 of file GrCaps.h.

◆ fSupportsAHardwareBufferImages

bool GrCaps::fSupportsAHardwareBufferImages
protected

Definition at line 609 of file GrCaps.h.

◆ fSupportsProtectedContent

bool GrCaps::fSupportsProtectedContent
protected

Definition at line 648 of file GrCaps.h.

◆ fTextureBarrierSupport

bool GrCaps::fTextureBarrierSupport
protected

Definition at line 593 of file GrCaps.h.

◆ fTransferBufferRowBytesAlignment

size_t GrCaps::fTransferBufferRowBytesAlignment = 1
protected

Definition at line 664 of file GrCaps.h.

◆ fTransferFromBufferToBufferAlignment

size_t GrCaps::fTransferFromBufferToBufferAlignment = 1
protected

Definition at line 665 of file GrCaps.h.

◆ fTransferFromBufferToBufferSupport

bool GrCaps::fTransferFromBufferToBufferSupport
protected

Definition at line 618 of file GrCaps.h.

◆ fTransferFromBufferToTextureSupport

bool GrCaps::fTransferFromBufferToTextureSupport
protected

Definition at line 616 of file GrCaps.h.

◆ fTransferFromSurfaceToBufferSupport

bool GrCaps::fTransferFromSurfaceToBufferSupport
protected

Definition at line 617 of file GrCaps.h.

◆ fTransferPixelsToRowBytesSupport

bool GrCaps::fTransferPixelsToRowBytesSupport
protected

Definition at line 620 of file GrCaps.h.

◆ fTwoSidedStencilRefsAndMasksMustMatch

bool GrCaps::fTwoSidedStencilRefsAndMasksMustMatch
protected

Definition at line 605 of file GrCaps.h.

◆ fUseClientSideIndirectBuffers

bool GrCaps::fUseClientSideIndirectBuffers
protected

Definition at line 597 of file GrCaps.h.

◆ fUsePrimitiveRestart

bool GrCaps::fUsePrimitiveRestart
protected

Definition at line 602 of file GrCaps.h.

◆ fWireframeSupport

bool GrCaps::fWireframeSupport
protected

Definition at line 599 of file GrCaps.h.

◆ fWritePixelsRowBytesSupport

bool GrCaps::fWritePixelsRowBytesSupport
protected

Definition at line 619 of file GrCaps.h.


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