Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | List of all members
GrGLCaps Class Reference

#include <GrGLCaps.h>

Inheritance diagram for GrGLCaps:
GrCaps SkCapabilities SkRefCnt SkRefCntBase

Public Types

enum  MSFBOType {
  kNone_MSFBOType = 0 , kStandard_MSFBOType , kES_Apple_MSFBOType , kES_IMG_MsToTexture_MSFBOType ,
  kES_EXT_MsToTexture_MSFBOType
}
 
enum  BlitFramebufferFlags {
  kNoSupport_BlitFramebufferFlag = 1 << 0 , kNoScalingOrMirroring_BlitFramebufferFlag = 1 << 1 , kResolveMustBeFull_BlitFrambufferFlag = 1 << 2 , kNoMSAADst_BlitFramebufferFlag = 1 << 3 ,
  kNoFormatConversion_BlitFramebufferFlag = 1 << 4 , kNoFormatConversionForMSAASrc_BlitFramebufferFlag = 1 << 5 , kRectsMustMatchForMSAASrc_BlitFramebufferFlag = 1 << 6
}
 
enum  InvalidateFBType { kNone_InvalidateFBType , kDiscard_InvalidateFBType , kInvalidate_InvalidateFBType }
 
enum class  InvalidateBufferType { kNone , kNullData , kInvalidate }
 
enum  MapBufferType { kNone_MapBufferType , kMapBuffer_MapBufferType , kMapBufferRange_MapBufferType , kChromium_MapBufferType }
 
enum class  TransferBufferType { kNone , kNV_PBO , kARB_PBO , kChromium }
 
enum class  FenceType { kNone , kSyncObject , kNVFence }
 
enum class  MultiDrawType { kNone , kMultiDrawIndirect , kANGLEOrWebGL }
 
enum class  RegenerateMipmapType { kBaseLevel , kBasePlusMaxLevel , kBasePlusSync }
 
- 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 }
 

Public Member Functions

 GrGLCaps (const GrContextOptions &contextOptions, const GrGLContextInfo &ctxInfo, const GrGLInterface *glInterface)
 
bool isFormatSRGB (const GrBackendFormat &) const override
 
bool isFormatTexturable (const GrBackendFormat &, GrTextureType) const override
 
bool isFormatTexturable (GrGLFormat) const
 
bool isFormatAsColorTypeRenderable (GrColorType ct, const GrBackendFormat &format, int sampleCount=1) const override
 
bool isFormatRenderable (const GrBackendFormat &format, int sampleCount) const override
 
bool isFormatRenderable (GrGLFormat format, int sampleCount) const
 
int getRenderTargetSampleCount (int requestedCount, const GrBackendFormat &format) const override
 
int getRenderTargetSampleCount (int requestedCount, GrGLFormat) const
 
int maxRenderTargetSampleCount (const GrBackendFormat &format) const override
 
int maxRenderTargetSampleCount (GrGLFormat) const
 
float maxTextureMaxAnisotropy () const
 
bool isFormatCopyable (const GrBackendFormat &) const override
 
bool canFormatBeFBOColorAttachment (GrGLFormat) const
 
GrGLFormat getFormatFromColorType (GrColorType colorType) const
 
GrGLenum getTexImageOrStorageInternalFormat (GrGLFormat format) const
 
void getTexImageExternalFormatAndType (GrGLFormat surfaceFormat, GrGLenum *externalFormat, GrGLenum *externalType) const
 
void getTexSubImageExternalFormatAndType (GrGLFormat surfaceFormat, GrColorType surfaceColorType, GrColorType memoryColorType, GrGLenum *externalFormat, GrGLenum *externalType) const
 
void getTexSubImageDefaultFormatTypeAndColorType (GrGLFormat format, GrGLenum *externalFormat, GrGLenum *externalType, GrColorType *colorType) const
 
void getReadPixelsFormat (GrGLFormat surfaceFormat, GrColorType surfaceColorType, GrColorType memoryColorType, GrGLenum *externalFormat, GrGLenum *externalType) const
 
const skia_private::TArray< GrGLFormat, true > & stencilFormats () const
 
bool formatSupportsTexStorage (GrGLFormat) const
 
bool shouldQueryImplementationReadSupport (GrGLFormat format) const
 
void didQueryImplementationReadSupport (GrGLFormat format, GrGLenum readFormat, GrGLenum readType) const
 
GrGLenum getRenderbufferInternalFormat (GrGLFormat format) const
 
GrGLenum getFormatDefaultExternalType (GrGLFormat format) const
 
bool hasStencilFormatBeenDeterminedForFormat (GrGLFormat format) const
 
int getStencilFormatIndexForFormat (GrGLFormat format) const
 
void setStencilFormatIndexForFormat (GrGLFormat, int index)
 
MSFBOType msFBOType () const
 
bool usesMSAARenderBuffers () const
 
bool framebufferResolvesMustBeFullSize () const
 
bool canResolveSingleToMSAA () const
 
bool usesImplicitMSAAResolve () const
 
InvalidateFBType invalidateFBType () const
 
MapBufferType mapBufferType () const
 What type of buffer mapping is supported? More...
 
TransferBufferType transferBufferType () const
 What type of transfer buffer is supported? More...
 
bool fenceSyncSupport () const
 
FenceType fenceType () const
 How is GrGLsync implemented? More...
 
MultiDrawType multiDrawType () const
 How are multi draws implemented (if at all)? More...
 
RegenerateMipmapType regenerateMipmapType () const
 How is restricting sampled miplevels in onRegenerateMipmapLevels implemented? More...
 
int maxFragmentUniformVectors () const
 The maximum number of fragment uniform vectors (GLES has min. 16). More...
 
bool packFlipYSupport () const
 Is there support for GL_PACK_REVERSE_ROW_ORDER. More...
 
bool textureUsageSupport () const
 Is there support for texture parameter GL_TEXTURE_USAGE. More...
 
bool imagingSupport () const
 Is GL_ARB_IMAGING supported. More...
 
bool vertexArrayObjectSupport () const
 Is there support for Vertex Array Objects? More...
 
bool debugSupport () const
 Is there support for GL_KHR_debug? More...
 
bool ES2CompatibilitySupport () const
 Is there support for ES2 compatability? More...
 
bool drawRangeElementsSupport () const
 Is there support for glDrawRangeElements? More...
 
bool baseVertexBaseInstanceSupport () const
 Are the glDraw*Base(VertexBase)Instance methods, and baseInstance fields in indirect draw. More...
 
SurfaceReadPixelsSupport surfaceSupportsReadPixels (const GrSurface *) const override
 
SupportedWrite supportedWritePixelsColorType (GrColorType surfaceColorType, const GrBackendFormat &surfaceFormat, GrColorType srcColorType) const override
 
bool isCoreProfile () const
 
bool bindFragDataLocationSupport () const
 
bool bindUniformLocationSupport () const
 
bool rectangleTextureSupport () const
 Are textures with GL_TEXTURE_RECTANGLE type supported. More...
 
bool mipmapLevelControlSupport () const
 Can set the BASE and MAX mip map level. More...
 
bool mipmapLodControlSupport () const
 Can set the MIN/MAX LOD value. More...
 
bool doManualMipmapping () const
 
void onDumpJSON (SkJSONWriter *) const override
 
InvalidateBufferType invalidateBufferType () const
 
bool clearToBoundaryValuesIsBroken () const
 
bool clearTextureSupport () const
 glClearTex(Sub)Image support More...
 
bool drawArraysBaseVertexIsBroken () const
 
bool disallowTexSubImageForUnormConfigTexturesEverBoundToFBO () const
 
bool useDrawInsteadOfAllRenderTargetWrites () const
 
bool requiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines () const
 
bool dontSetBaseOrMaxLevelForExternalTextures () const
 
bool neverDisableColorWrites () const
 
bool mustSetAnyTexParameterToEnableMipmapping () const
 
bool mustResetBlendFuncBetweenDualSourceAndDisable () const
 
bool bindTexture0WhenChangingTextureFBOMultisampleCount () const
 
bool rebindColorAttachmentAfterCheckFramebufferStatus () const
 
bool flushBeforeWritePixels () const
 
int maxInstancesPerDrawWithoutCrashing (int pendingInstanceCount) const
 
bool canCopyTexSubImage (GrGLFormat dstFormat, bool dstHasMSAARenderBuffer, const GrTextureType *dstTypeIfTexture, GrGLFormat srcFormat, bool srcHasMSAARenderBuffer, const GrTextureType *srcTypeIfTexture) const
 
bool canCopyAsBlit (GrGLFormat dstFormat, int dstSampleCnt, const GrTextureType *dstTypeIfTexture, GrGLFormat srcFormat, int srcSampleCnt, const GrTextureType *srcTypeIfTexture, const SkRect &srcBounds, bool srcBoundsExact, const SkIRect &srcRect, const SkIRect &dstRect) const
 
bool canCopyAsDraw (GrGLFormat dstFormat, bool srcIsTexturable, bool scalingCopy) const
 
DstCopyRestrictions getDstCopyRestrictions (const GrRenderTargetProxy *src, GrColorType) const override
 
bool programBinarySupport () const
 
bool programParameterSupport () const
 
bool programBinaryFormatIsValid (GrGLenum binaryFormat) const
 
bool samplerObjectSupport () const
 
bool useSamplerObjects () const
 
bool textureSwizzleSupport () const
 
bool tiledRenderingSupport () const
 
bool fbFetchRequiresEnablePerSample () const
 
bool srgbWriteControl () const
 
bool skipErrorChecks () const
 
bool clientCanDisableMultisample () const
 
GrBackendFormat getBackendFormatFromCompressionType (SkTextureCompressionType) const override
 
skgpu::Swizzle getWriteSwizzle (const GrBackendFormat &, GrColorType) const override
 
uint64_t computeFormatKey (const GrBackendFormat &) const override
 
GrProgramDesc makeDesc (GrRenderTarget *, const GrProgramInfo &, ProgramDescOverrideFlags) const override
 
- 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
 

Additional Inherited Members

- Static Public Member Functions inherited from SkCapabilities
static sk_sp< const SkCapabilitiesRasterBackend ()
 
- 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 GL context. Most are determined by the GL version and the extensions string. It also tracks formats that have passed the FBO completeness test.

Definition at line 49 of file GrGLCaps.h.

Member Enumeration Documentation

◆ BlitFramebufferFlags

Enumerator
kNoSupport_BlitFramebufferFlag 
kNoScalingOrMirroring_BlitFramebufferFlag 
kResolveMustBeFull_BlitFrambufferFlag 
kNoMSAADst_BlitFramebufferFlag 
kNoFormatConversion_BlitFramebufferFlag 
kNoFormatConversionForMSAASrc_BlitFramebufferFlag 
kRectsMustMatchForMSAASrc_BlitFramebufferFlag 

Definition at line 84 of file GrGLCaps.h.

84 {
92 };
@ kNoScalingOrMirroring_BlitFramebufferFlag
Definition: GrGLCaps.h:86
@ kResolveMustBeFull_BlitFrambufferFlag
Definition: GrGLCaps.h:87
@ kNoSupport_BlitFramebufferFlag
Definition: GrGLCaps.h:85
@ kRectsMustMatchForMSAASrc_BlitFramebufferFlag
Definition: GrGLCaps.h:91
@ kNoFormatConversion_BlitFramebufferFlag
Definition: GrGLCaps.h:89
@ kNoFormatConversionForMSAASrc_BlitFramebufferFlag
Definition: GrGLCaps.h:90
@ kNoMSAADst_BlitFramebufferFlag
Definition: GrGLCaps.h:88

◆ FenceType

enum class GrGLCaps::FenceType
strong
Enumerator
kNone 
kSyncObject 
kNVFence 

Definition at line 120 of file GrGLCaps.h.

120 {
121 kNone,
122 kSyncObject,
123 kNVFence
124 };
@ kNone
Definition: layer.h:53

◆ InvalidateBufferType

enum class GrGLCaps::InvalidateBufferType
strong
Enumerator
kNone 
kNullData 
kInvalidate 

Definition at line 100 of file GrGLCaps.h.

100 {
101 kNone,
102 kNullData, // Call glBufferData with a null data pointer.
103 kInvalidate // glInvalidateBufferData
104 };

◆ InvalidateFBType

Enumerator
kNone_InvalidateFBType 
kDiscard_InvalidateFBType 
kInvalidate_InvalidateFBType 

Definition at line 94 of file GrGLCaps.h.

94 {
96 kDiscard_InvalidateFBType, //<! glDiscardFramebuffer()
97 kInvalidate_InvalidateFBType, //<! glInvalidateFramebuffer()
98 };
@ kNone_InvalidateFBType
Definition: GrGLCaps.h:95
@ kDiscard_InvalidateFBType
Definition: GrGLCaps.h:96
@ kInvalidate_InvalidateFBType
Definition: GrGLCaps.h:97

◆ MapBufferType

Enumerator
kNone_MapBufferType 
kMapBuffer_MapBufferType 
kMapBufferRange_MapBufferType 
kChromium_MapBufferType 

Definition at line 106 of file GrGLCaps.h.

106 {
108 kMapBuffer_MapBufferType, // glMapBuffer()
109 kMapBufferRange_MapBufferType, // glMapBufferRange()
110 kChromium_MapBufferType, // GL_CHROMIUM_map_sub
111 };
@ kMapBufferRange_MapBufferType
Definition: GrGLCaps.h:109
@ kMapBuffer_MapBufferType
Definition: GrGLCaps.h:108
@ kNone_MapBufferType
Definition: GrGLCaps.h:107
@ kChromium_MapBufferType
Definition: GrGLCaps.h:110

◆ MSFBOType

The type of MSAA for FBOs supported. Different extensions have different semantics of how / when a resolve is performed.

Enumerator
kNone_MSFBOType 

no support for MSAA FBOs

kStandard_MSFBOType 

OpenGL 3.0+, OpenGL ES 3.0+, GL_ARB_framebuffer_object, GL_CHROMIUM_framebuffer_multisample, GL_ANGLE_framebuffer_multisample, or GL_EXT_framebuffer_multisample

kES_Apple_MSFBOType 

GL_APPLE_framebuffer_multisample ES extension

kES_IMG_MsToTexture_MSFBOType 

GL_IMG_multisampled_render_to_texture. This variation does not have MSAA renderbuffers. Instead the texture is multisampled when bound to the FBO and then resolved automatically when read. It also defines an alternate value for GL_MAX_SAMPLES (which we call GR_GL_MAX_SAMPLES_IMG).

kES_EXT_MsToTexture_MSFBOType 

GL_EXT_multisampled_render_to_texture. Same as the IMG one above but uses the standard GL_MAX_SAMPLES value.

Definition at line 55 of file GrGLCaps.h.

55 {
56 /**
57 * no support for MSAA FBOs
58 */
60 /**
61 * OpenGL 3.0+, OpenGL ES 3.0+, GL_ARB_framebuffer_object,
62 * GL_CHROMIUM_framebuffer_multisample, GL_ANGLE_framebuffer_multisample,
63 * or GL_EXT_framebuffer_multisample
64 */
66 /**
67 * GL_APPLE_framebuffer_multisample ES extension
68 */
70 /**
71 * GL_IMG_multisampled_render_to_texture. This variation does not have MSAA renderbuffers.
72 * Instead the texture is multisampled when bound to the FBO and then resolved automatically
73 * when read. It also defines an alternate value for GL_MAX_SAMPLES (which we call
74 * GR_GL_MAX_SAMPLES_IMG).
75 */
77 /**
78 * GL_EXT_multisampled_render_to_texture. Same as the IMG one above but uses the standard
79 * GL_MAX_SAMPLES value.
80 */
82 };
@ kES_Apple_MSFBOType
Definition: GrGLCaps.h:69
@ kES_EXT_MsToTexture_MSFBOType
Definition: GrGLCaps.h:81
@ kNone_MSFBOType
Definition: GrGLCaps.h:59
@ kES_IMG_MsToTexture_MSFBOType
Definition: GrGLCaps.h:76
@ kStandard_MSFBOType
Definition: GrGLCaps.h:65

◆ MultiDrawType

enum class GrGLCaps::MultiDrawType
strong
Enumerator
kNone 
kMultiDrawIndirect 
kANGLEOrWebGL 

Definition at line 126 of file GrGLCaps.h.

126 {
127 kNone,
128 kMultiDrawIndirect, // ARB_multi_draw_indirect, EXT_multi_draw_indirect, or GL 4.3 core.
129 kANGLEOrWebGL // ANGLE_base_vertex_base_instance or
130 // WEBGL_draw_instanced_base_vertex_base_instance
131 };

◆ RegenerateMipmapType

enum class GrGLCaps::RegenerateMipmapType
strong
Enumerator
kBaseLevel 
kBasePlusMaxLevel 
kBasePlusSync 

Definition at line 133 of file GrGLCaps.h.

133 {
134 kBaseLevel,
135 kBasePlusMaxLevel,
136 kBasePlusSync
137 };

◆ TransferBufferType

enum class GrGLCaps::TransferBufferType
strong
Enumerator
kNone 
kNV_PBO 
kARB_PBO 
kChromium 

Definition at line 113 of file GrGLCaps.h.

113 {
114 kNone,
115 kNV_PBO, // NV_pixel_buffer_object
116 kARB_PBO, // ARB_pixel_buffer_object
117 kChromium, // CHROMIUM_pixel_transfer_buffer_object
118 };

Constructor & Destructor Documentation

◆ GrGLCaps()

GrGLCaps::GrGLCaps ( const GrContextOptions contextOptions,
const GrGLContextInfo ctxInfo,
const GrGLInterface glInterface 
)

Initializes the GrGLCaps to the set of features supported in the current OpenGL context accessible via ctxInfo.

Definition at line 56 of file GrGLCaps.cpp.

58 : INHERITED(contextOptions) {
59 fStandard = ctxInfo.standard();
60
61 fPackFlipYSupport = false;
62 fTextureUsageSupport = false;
63 fImagingSupport = false;
64 fVertexArrayObjectSupport = false;
65 fDebugSupport = false;
66 fES2CompatibilitySupport = false;
67 fDrawRangeElementsSupport = false;
68 fBaseVertexBaseInstanceSupport = false;
69 fIsCoreProfile = false;
70 fBindFragDataLocationSupport = false;
71 fRectangleTextureSupport = false;
72 fBindUniformLocationSupport = false;
73 fMipmapLevelControlSupport = false;
74 fMipmapLodControlSupport = false;
75 fDoManualMipmapping = false;
76 fClearToBoundaryValuesIsBroken = false;
77 fClearTextureSupport = false;
78 fDrawArraysBaseVertexIsBroken = false;
79 fDisallowTexSubImageForUnormConfigTexturesEverBoundToFBO = false;
80 fUseDrawInsteadOfAllRenderTargetWrites = false;
81 fRequiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines = false;
82 fDontSetBaseOrMaxLevelForExternalTextures = false;
83 fNeverDisableColorWrites = false;
84 fMustSetAnyTexParameterToEnableMipmapping = false;
85 fAllowBGRA8CopyTexSubImage = false;
86 fAllowSRGBCopyTexSubImage = false;
87 fDisallowDynamicMSAA = false;
88 fMustResetBlendFuncBetweenDualSourceAndDisable = false;
89 fBindTexture0WhenChangingTextureFBOMultisampleCount = false;
90 fRebindColorAttachmentAfterCheckFramebufferStatus = false;
91 fFlushBeforeWritePixels = false;
92 fDisableScalingCopyAsDraws = false;
93 fPadRG88TransferAlignment = false;
94 fProgramBinarySupport = false;
95 fProgramParameterSupport = false;
96 fSamplerObjectSupport = false;
97 fUseSamplerObjects = false;
98 fTextureSwizzleSupport = false;
99 fTiledRenderingSupport = false;
100 fFenceSyncSupport = false;
101 fFBFetchRequiresEnablePerSample = false;
102 fSRGBWriteControl = false;
103 fSkipErrorChecks = false;
104
105 fShaderCaps = std::make_unique<GrShaderCaps>();
106
107 this->init(contextOptions, ctxInfo, glInterface);
108}
std::unique_ptr< GrShaderCaps > fShaderCaps
Definition: GrCaps.h:584
GrGLStandard standard() const
Definition: GrGLContext.h:30

Member Function Documentation

◆ baseVertexBaseInstanceSupport()

bool GrGLCaps::baseVertexBaseInstanceSupport ( ) const
inline

Are the glDraw*Base(VertexBase)Instance methods, and baseInstance fields in indirect draw.

Definition at line 369 of file GrGLCaps.h.

369{ return fBaseVertexBaseInstanceSupport; }

◆ bindFragDataLocationSupport()

bool GrGLCaps::bindFragDataLocationSupport ( ) const
inline

Definition at line 379 of file GrGLCaps.h.

379{ return fBindFragDataLocationSupport; }

◆ bindTexture0WhenChangingTextureFBOMultisampleCount()

bool GrGLCaps::bindTexture0WhenChangingTextureFBOMultisampleCount ( ) const
inline

Definition at line 450 of file GrGLCaps.h.

450 {
451 return fBindTexture0WhenChangingTextureFBOMultisampleCount;
452 }

◆ bindUniformLocationSupport()

bool GrGLCaps::bindUniformLocationSupport ( ) const
inline

Definition at line 381 of file GrGLCaps.h.

381{ return fBindUniformLocationSupport; }

◆ canCopyAsBlit()

bool GrGLCaps::canCopyAsBlit ( GrGLFormat  dstFormat,
int  dstSampleCnt,
const GrTextureType dstTypeIfTexture,
GrGLFormat  srcFormat,
int  srcSampleCnt,
const GrTextureType srcTypeIfTexture,
const SkRect srcBounds,
bool  srcBoundsExact,
const SkIRect srcRect,
const SkIRect dstRect 
) const

Definition at line 3605 of file GrGLCaps.cpp.

3610 {
3611 auto blitFramebufferFlags = fBlitFramebufferFlags;
3612 if (!this->canFormatBeFBOColorAttachment(dstFormat) ||
3613 !this->canFormatBeFBOColorAttachment(srcFormat)) {
3614 return false;
3615 }
3616
3617 if (dstTypeIfTexture && *dstTypeIfTexture == GrTextureType::kExternal) {
3618 return false;
3619 }
3620 if (srcTypeIfTexture && *srcTypeIfTexture == GrTextureType::kExternal) {
3621 return false;
3622 }
3623
3624 if (GrGLCaps::kNoSupport_BlitFramebufferFlag & blitFramebufferFlags) {
3625 return false;
3626 }
3627
3628 if (dstSampleCnt > 1 && dstSampleCnt != srcSampleCnt) {
3629 // Regardless of support-level, all blits require src and dst sample counts to match if
3630 // the dst is MSAA.
3631 return false;
3632 }
3633
3634 if (srcRect.width() != dstRect.width() || srcRect.height() != dstRect.height()) {
3635 // If the blit would scale contents, it's only valid for non-MSAA framebuffers that we
3636 // can write directly to.
3637 if ((GrGLCaps::kNoScalingOrMirroring_BlitFramebufferFlag & blitFramebufferFlags) ||
3638 this->useDrawInsteadOfAllRenderTargetWrites() || srcSampleCnt > 1) {
3639 return false;
3640 }
3641 }
3642
3643 if (GrGLCaps::kResolveMustBeFull_BlitFrambufferFlag & blitFramebufferFlags) {
3644 if (srcSampleCnt > 1) {
3645 if (1 == dstSampleCnt) {
3646 return false;
3647 }
3648 if (SkRect::Make(srcRect) != srcBounds || !srcBoundsExact) {
3649 return false;
3650 }
3651 }
3652 }
3653
3654 if (GrGLCaps::kNoMSAADst_BlitFramebufferFlag & blitFramebufferFlags) {
3655 if (dstSampleCnt > 1) {
3656 return false;
3657 }
3658 }
3659
3660 if (GrGLCaps::kNoFormatConversion_BlitFramebufferFlag & blitFramebufferFlags) {
3661 if (srcFormat != dstFormat) {
3662 return false;
3663 }
3664 } else if (GrGLCaps::kNoFormatConversionForMSAASrc_BlitFramebufferFlag & blitFramebufferFlags) {
3665 if (srcSampleCnt > 1 && srcFormat != dstFormat) {
3666 return false;
3667 }
3668 }
3669
3671 if (srcSampleCnt > 1) {
3672 if (dstRect != srcRect) {
3673 return false;
3674 }
3675 }
3676 }
3677 return true;
3678}
bool useDrawInsteadOfAllRenderTargetWrites() const
Definition: GrGLCaps.h:417
bool canFormatBeFBOColorAttachment(GrGLFormat) const
Definition: GrGLCaps.cpp:4973
constexpr int32_t height() const
Definition: SkRect.h:165
constexpr int32_t width() const
Definition: SkRect.h:158
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669

◆ canCopyAsDraw()

bool GrGLCaps::canCopyAsDraw ( GrGLFormat  dstFormat,
bool  srcIsTexturable,
bool  scalingCopy 
) const

Definition at line 3680 of file GrGLCaps.cpp.

3680 {
3681 return this->isFormatRenderable(dstFormat, 1) &&
3682 srcIsTexturable &&
3683 !(fDisableScalingCopyAsDraws && scalingCopy);
3684}
bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const override
Definition: GrGLCaps.cpp:4926

◆ canCopyTexSubImage()

bool GrGLCaps::canCopyTexSubImage ( GrGLFormat  dstFormat,
bool  dstHasMSAARenderBuffer,
const GrTextureType dstTypeIfTexture,
GrGLFormat  srcFormat,
bool  srcHasMSAARenderBuffer,
const GrTextureType srcTypeIfTexture 
) const

Definition at line 3525 of file GrGLCaps.cpp.

3528 {
3529 // When it comes to format types and component sizes the gl spec is fairly complex as
3530 // requirements differ depending on many properties (e.g. if the internalFormat was created with
3531 // a sized format or not). These affect the rules about which format types can be copied to
3532 // which other types. For now we are being more restrictive and requiring that the types must
3533 // match exactly.
3534 if (this->getFormatDefaultExternalType(dstFormat) !=
3535 this->getFormatDefaultExternalType(srcFormat)) {
3536 return false;
3537 }
3538
3539 // Either both the src and dst formats need to be SRGB or both need to not be SRGB
3540 if (GrGLFormatIsSRGB(dstFormat) != GrGLFormatIsSRGB(srcFormat)) {
3541 return false;
3542 }
3543
3544 if (GR_IS_GR_GL_ES(fStandard)) {
3545 // Table 3.9 of the ES2 spec indicates the supported formats with CopyTexSubImage
3546 // and BGRA isn't in the spec. There doesn't appear to be any extension that adds it.
3547 // ANGLE, for one, does not allow it. However, we've found it works on some drivers and
3548 // avoids bugs with using glBlitFramebuffer.
3549 if ((dstFormat == GrGLFormat::kBGRA8 || srcFormat == GrGLFormat::kBGRA8) &&
3550 !fAllowBGRA8CopyTexSubImage) {
3551 return false;
3552 }
3553
3554 // Table 3.9 of the ES2 spec indicates the supported formats with CopyTexSubImage
3555 // and SRGB isn't in the spec. There doesn't appear to be any extension that adds it.
3556 // ANGLE, for one, does not allow it. However, we've found it works on some drivers and
3557 // avoids bugs with using glBlitFramebuffer.
3558 if ((GrGLFormatIsSRGB(dstFormat) || GrGLFormatIsSRGB(srcFormat)) &&
3559 !fAllowSRGBCopyTexSubImage) {
3560 return false;
3561 }
3562
3563 // Table 3.9 of the ES2 spec and 3.16 of ES3 spec indicates the supported internal base
3564 // formats with CopyTexSubImage. Each base format can be copied to itself or formats with
3565 // less channels.
3566 uint32_t dstChannels = GrGLFormatChannels(dstFormat);
3567 uint32_t srcChannels = GrGLFormatChannels(srcFormat);
3568 if (!dstChannels || !srcChannels) {
3569 // The formats don't represent color channels (i.e. may be depth stencil)
3570 return false;
3571 }
3572 // The dst channels have to be a subset of the srcChannels, except R, RG, or RGB, channels
3573 // can go to LUM. (See expansion of Table 3.9 in EXT_texture_rg).
3574 if ((dstChannels & srcChannels) != srcChannels) {
3575 if (dstChannels == kGray_SkColorChannelFlag ||
3576 dstChannels == kGrayAlpha_SkColorChannelFlags) {
3577 // The dst can't have gray if the src is alpha-only.
3578 if (srcChannels == kAlpha_SkColorChannelFlag) {
3579 return false;
3580 }
3581 } else {
3582 return false;
3583 }
3584 }
3585 }
3586
3587 // CopyTexSubImage is invalid or doesn't copy what we want when we have msaa render buffers.
3588 if (dstHasMSAARenderBuffer || srcHasMSAARenderBuffer) {
3589 return false;
3590 }
3591
3592 // CopyTex(Sub)Image writes to a texture and we have no way of dynamically wrapping a RT in a
3593 // texture.
3594 if (!dstTypeIfTexture) {
3595 return false;
3596 }
3597
3598 // Check that we could wrap the source in an FBO, that the dst is not TEXTURE_EXTERNAL, that no
3599 // mirroring is required
3600 return this->canFormatBeFBOColorAttachment(srcFormat) &&
3601 (!srcTypeIfTexture || *srcTypeIfTexture != GrTextureType::kExternal) &&
3602 *dstTypeIfTexture != GrTextureType::kExternal;
3603}
#define GR_IS_GR_GL_ES(standard)
Definition: GrGLTypes.h:49
static constexpr bool GrGLFormatIsSRGB(GrGLFormat format)
Definition: GrGLUtil.h:588
static constexpr uint32_t GrGLFormatChannels(GrGLFormat format)
Definition: GrGLUtil.h:41
@ kGrayAlpha_SkColorChannelFlags
Definition: SkColor.h:245
@ kAlpha_SkColorChannelFlag
Definition: SkColor.h:242
@ kGray_SkColorChannelFlag
Definition: SkColor.h:243
GrGLenum getFormatDefaultExternalType(GrGLFormat format) const
Definition: GrGLCaps.h:254

◆ canFormatBeFBOColorAttachment()

bool GrGLCaps::canFormatBeFBOColorAttachment ( GrGLFormat  format) const

Definition at line 4973 of file GrGLCaps.cpp.

4973 {
4974 return SkToBool(this->getFormatInfo(format).fFlags & FormatInfo::kFBOColorAttachment_Flag);
4975}
uint16_t fFlags
Definition: ShapeLayer.cpp:106
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
uint32_t uint32_t * format

◆ canResolveSingleToMSAA()

bool GrGLCaps::canResolveSingleToMSAA ( ) const
inline

Can we resolve a single-sample framebuffer into an MSAA framebuffer?

Definition at line 308 of file GrGLCaps.h.

308 {
309 SkASSERT(fMSFBOType != kNone_MSFBOType);
310 return fMSFBOType != kES_Apple_MSFBOType &&
311 !(fBlitFramebufferFlags & GrGLCaps::kNoMSAADst_BlitFramebufferFlag);
312 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ clearTextureSupport()

bool GrGLCaps::clearTextureSupport ( ) const
inline

glClearTex(Sub)Image support

Definition at line 402 of file GrGLCaps.h.

402{ return fClearTextureSupport; }

◆ clearToBoundaryValuesIsBroken()

bool GrGLCaps::clearToBoundaryValuesIsBroken ( ) const
inline

Definition at line 399 of file GrGLCaps.h.

399{ return fClearToBoundaryValuesIsBroken; }

◆ clientCanDisableMultisample()

bool GrGLCaps::clientCanDisableMultisample ( ) const
inline

Definition at line 516 of file GrGLCaps.h.

516{ return fClientCanDisableMultisample; }

◆ computeFormatKey()

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

Implements GrCaps.

Definition at line 5123 of file GrGLCaps.cpp.

5123 {
5124 auto glFormat = GrBackendFormats::AsGLFormat(format);
5125 return (uint64_t)(glFormat);
5126}
SK_API GrGLFormat AsGLFormat(const GrBackendFormat &)

◆ debugSupport()

bool GrGLCaps::debugSupport ( ) const
inline

Is there support for GL_KHR_debug?

Definition at line 359 of file GrGLCaps.h.

359{ return fDebugSupport; }

◆ didQueryImplementationReadSupport()

void GrGLCaps::didQueryImplementationReadSupport ( GrGLFormat  format,
GrGLenum  readFormat,
GrGLenum  readType 
) const

Let caps know the result of GL_IMPLEMENTATION_READ_FORMAT and _TYPE query for a format to update supported glReadPixels arguments.

Definition at line 5011 of file GrGLCaps.cpp.

5013 {
5014 auto& formatInfo = const_cast<GrGLCaps*>(this)->getFormatInfo(format);
5015 for (int i = 0; i < formatInfo.fColorTypeInfoCount; ++i) {
5016 auto& surfCTInfo = formatInfo.fColorTypeInfos[i];
5017 for (int j = 0; j < surfCTInfo.fExternalIOFormatCount; ++j) {
5018 auto& readCTInfo = surfCTInfo.fExternalIOFormats[j];
5019 if (readCTInfo.fRequiresImplementationReadQuery) {
5020 if (readCTInfo.fExternalReadFormat != readFormat ||
5021 readCTInfo.fExternalType != readType) {
5022 // Don't zero out fExternalType. It's also used for writing data to the texture!
5023 readCTInfo.fExternalReadFormat = 0;
5024 }
5025 }
5026 }
5027 }
5028 formatInfo.fHaveQueriedImplementationReadSupport = true;
5029}

◆ disallowTexSubImageForUnormConfigTexturesEverBoundToFBO()

bool GrGLCaps::disallowTexSubImageForUnormConfigTexturesEverBoundToFBO ( ) const
inline

Definition at line 411 of file GrGLCaps.h.

411 {
412 return fDisallowTexSubImageForUnormConfigTexturesEverBoundToFBO;
413 }

◆ doManualMipmapping()

bool GrGLCaps::doManualMipmapping ( ) const
inline

Definition at line 392 of file GrGLCaps.h.

392{ return fDoManualMipmapping; }

◆ dontSetBaseOrMaxLevelForExternalTextures()

bool GrGLCaps::dontSetBaseOrMaxLevelForExternalTextures ( ) const
inline

Definition at line 429 of file GrGLCaps.h.

429 {
430 return fDontSetBaseOrMaxLevelForExternalTextures;
431 }

◆ drawArraysBaseVertexIsBroken()

bool GrGLCaps::drawArraysBaseVertexIsBroken ( ) const
inline

Definition at line 407 of file GrGLCaps.h.

407{ return fDrawArraysBaseVertexIsBroken; }

◆ drawRangeElementsSupport()

bool GrGLCaps::drawRangeElementsSupport ( ) const
inline

Is there support for glDrawRangeElements?

Definition at line 365 of file GrGLCaps.h.

365{ return fDrawRangeElementsSupport; }

◆ ES2CompatibilitySupport()

bool GrGLCaps::ES2CompatibilitySupport ( ) const
inline

Is there support for ES2 compatability?

Definition at line 362 of file GrGLCaps.h.

362{ return fES2CompatibilitySupport; }

◆ fbFetchRequiresEnablePerSample()

bool GrGLCaps::fbFetchRequiresEnablePerSample ( ) const
inline

Definition at line 505 of file GrGLCaps.h.

505{ return fFBFetchRequiresEnablePerSample; }

◆ fenceSyncSupport()

bool GrGLCaps::fenceSyncSupport ( ) const
inline

Supports using GrGLsync.

Definition at line 332 of file GrGLCaps.h.

332{ return fFenceSyncSupport; }

◆ fenceType()

FenceType GrGLCaps::fenceType ( ) const
inline

How is GrGLsync implemented?

Definition at line 335 of file GrGLCaps.h.

335{ return fFenceType; }

◆ flushBeforeWritePixels()

bool GrGLCaps::flushBeforeWritePixels ( ) const
inline

Definition at line 461 of file GrGLCaps.h.

461 {
462 return fFlushBeforeWritePixels;
463 }

◆ formatSupportsTexStorage()

bool GrGLCaps::formatSupportsTexStorage ( GrGLFormat  format) const

Definition at line 4985 of file GrGLCaps.cpp.

4985 {
4986 return SkToBool(this->getFormatInfo(format).fFlags & FormatInfo::kUseTexStorage_Flag);
4987}

◆ framebufferResolvesMustBeFullSize()

bool GrGLCaps::framebufferResolvesMustBeFullSize ( ) const
inline

Is it unsupported to only resolve a sub-rectangle of a framebuffer?

Definition at line 299 of file GrGLCaps.h.

299 {
300 SkASSERT(fMSFBOType != kNone_MSFBOType);
301 return fMSFBOType == kES_Apple_MSFBOType ||
302 (fBlitFramebufferFlags & kResolveMustBeFull_BlitFrambufferFlag);
303 }

◆ getBackendFormatFromCompressionType()

GrBackendFormat GrGLCaps::getBackendFormatFromCompressionType ( SkTextureCompressionType  compressionType) const
overridevirtual

Implements GrCaps.

Definition at line 5051 of file GrGLCaps.cpp.

5052 {
5053 switch (compressionType) {
5055 return {};
5057 // if ETC2 is available default to that format
5060 }
5063 }
5064 return {};
5069 }
5070 return {};
5075 }
5076 return {};
5077 }
5078
5080}
#define GR_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
Definition: GrGLDefines.h:261
#define GR_GL_TEXTURE_2D
Definition: GrGLDefines.h:152
#define GR_GL_COMPRESSED_ETC1_RGB8
Definition: GrGLDefines.h:278
#define GR_GL_COMPRESSED_RGB8_ETC2
Definition: GrGLDefines.h:285
#define GR_GL_COMPRESSED_RGB_S3TC_DXT1_EXT
Definition: GrGLDefines.h:260
@ kCOMPRESSED_ETC1_RGB8
@ kCOMPRESSED_RGB8_BC1
@ kCOMPRESSED_RGB8_ETC2
@ kCOMPRESSED_RGBA8_BC1
#define SkUNREACHABLE
Definition: SkAssert.h:135
bool isFormatTexturable(const GrBackendFormat &, GrTextureType) const override
Definition: GrGLCaps.cpp:4897
SK_API GrBackendFormat MakeGL(GrGLenum format, GrGLenum target)

◆ getDstCopyRestrictions()

GrCaps::DstCopyRestrictions GrGLCaps::getDstCopyRestrictions ( const GrRenderTargetProxy src,
GrColorType  colorType 
) const
overridevirtual

Reimplemented from GrCaps.

Definition at line 3748 of file GrGLCaps.cpp.

3749 {
3750 // If the src is a texture, we can implement the blit as a draw assuming the config is
3751 // renderable.
3752 if (src->asTextureProxy() && !this->isFormatAsColorTypeRenderable(colorType,
3753 src->backendFormat())) {
3754 return {};
3755 }
3756
3757 if (const auto* texProxy = src->asTextureProxy()) {
3758 if (texProxy->textureType() == GrTextureType::kExternal) {
3759 // Not supported for FBO blit or CopyTexSubImage. Caller will have to fall back to a
3760 // draw (if the source is also a texture).
3761 return {};
3762 }
3763 }
3764
3765 // We look for opportunities to use CopyTexSubImage, or fbo blit. If neither are
3766 // possible and we return false to fallback to creating a render target dst for render-to-
3767 // texture. This code prefers CopyTexSubImage to fbo blit and avoids triggering temporary fbo
3768 // creation. It isn't clear that avoiding temporary fbo creation is actually optimal.
3769 DstCopyRestrictions blitFramebufferRestrictions = {};
3770 if (src->numSamples() > 1 &&
3771 (fBlitFramebufferFlags & kResolveMustBeFull_BlitFrambufferFlag)) {
3772 blitFramebufferRestrictions.fRectsMustMatch = GrSurfaceProxy::RectsMustMatch::kYes;
3773 blitFramebufferRestrictions.fMustCopyWholeSrc = true;
3774 // Mirroring causes rects to mismatch later, don't allow it.
3775 } else if (src->numSamples() > 1 && (fBlitFramebufferFlags &
3777 blitFramebufferRestrictions.fRectsMustMatch = GrSurfaceProxy::RectsMustMatch::kYes;
3778 }
3779
3780 auto srcFormat = GrBackendFormats::AsGLFormat(src->backendFormat());
3781 // Check for format issues with glCopyTexSubImage2D
3782 if (srcFormat == GrGLFormat::kBGRA8) {
3783 // glCopyTexSubImage2D doesn't work with this config. If the bgra can be used with fbo blit
3784 // then we set up for that, otherwise fail.
3785 if (this->canFormatBeFBOColorAttachment(srcFormat)) {
3786 return blitFramebufferRestrictions;
3787 }
3788 // Caller will have to use a draw.
3789 return {};
3790 }
3791
3792 {
3793 bool srcIsMSAARenderbuffer = src->numSamples() > 1 &&
3794 this->usesMSAARenderBuffers();
3795 if (srcIsMSAARenderbuffer) {
3796 // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. Set up for FBO
3797 // blit or fail.
3798 if (this->canFormatBeFBOColorAttachment(srcFormat)) {
3799 return blitFramebufferRestrictions;
3800 }
3801 // Caller will have to use a draw.
3802 return {};
3803 }
3804 }
3805
3806 // We'll do a CopyTexSubImage, no restrictions.
3807 return {};
3808}
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
bool usesMSAARenderBuffers() const
Definition: GrGLCaps.h:290

◆ getFormatDefaultExternalType()

GrGLenum GrGLCaps::getFormatDefaultExternalType ( GrGLFormat  format) const
inline

Gets the default external type to use with glTex[Sub]Image... when the data pointer is null.

Definition at line 254 of file GrGLCaps.h.

254 {
255 return this->getFormatInfo(format).fDefaultExternalType;
256 }

◆ getFormatFromColorType()

GrGLFormat GrGLCaps::getFormatFromColorType ( GrColorType  colorType) const
inline

Definition at line 176 of file GrGLCaps.h.

176 {
177 int idx = static_cast<int>(colorType);
178 return fColorTypeToFormatTable[idx];
179 }

◆ getReadPixelsFormat()

void GrGLCaps::getReadPixelsFormat ( GrGLFormat  surfaceFormat,
GrColorType  surfaceColorType,
GrColorType  memoryColorType,
GrGLenum externalFormat,
GrGLenum externalType 
) const

Definition at line 1380 of file GrGLCaps.cpp.

1382 {
1383 this->getExternalFormat(surfaceFormat, surfaceColorType, memoryColorType,
1384 kReadPixels_ExternalFormatUsage, externalFormat, externalType);
1385}

◆ getRenderbufferInternalFormat()

GrGLenum GrGLCaps::getRenderbufferInternalFormat ( GrGLFormat  format) const
inline

Gets the internal format to use with glRenderbufferStorageMultisample...(). May be sized or base depending upon the GL. Not applicable to compressed textures.

Definition at line 247 of file GrGLCaps.h.

247 {
248 return this->getFormatInfo(format).fInternalFormatForRenderbuffer;
249 }

◆ getRenderTargetSampleCount() [1/2]

int GrGLCaps::getRenderTargetSampleCount ( int  requestedCount,
const GrBackendFormat format 
) const
inlineoverridevirtual

Implements GrCaps.

Definition at line 158 of file GrGLCaps.h.

159 {
160 return this->getRenderTargetSampleCount(requestedCount,
162 }
int getRenderTargetSampleCount(int requestedCount, const GrBackendFormat &format) const override
Definition: GrGLCaps.h:158

◆ getRenderTargetSampleCount() [2/2]

int GrGLCaps::getRenderTargetSampleCount ( int  requestedCount,
GrGLFormat  format 
) const

Definition at line 4936 of file GrGLCaps.cpp.

4936 {
4937 const FormatInfo& info = this->getFormatInfo(format);
4938
4939 int count = info.fColorSampleCounts.size();
4940 if (!count) {
4941 return 0;
4942 }
4943
4944 requestedCount = std::max(1, requestedCount);
4945 if (1 == requestedCount) {
4946 return info.fColorSampleCounts[0] == 1 ? 1 : 0;
4947 }
4948
4949 for (int sampleCount : info.fColorSampleCounts) {
4950 if (sampleCount >= requestedCount) {
4951 if (fDriverBugWorkarounds.max_msaa_sample_count_4) {
4952 sampleCount = std::min(sampleCount, 4);
4953 }
4954 return sampleCount;
4955 }
4956 }
4957 return 0;
4958}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
int count
Definition: FontMgrTest.cpp:50
GrDriverBugWorkarounds fDriverBugWorkarounds
Definition: GrCaps.h:668
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ getStencilFormatIndexForFormat()

int GrGLCaps::getStencilFormatIndexForFormat ( GrGLFormat  format) const
inline

Gets the stencil format index for the format. This assumes hasStencilFormatBeenDeterminedForFormat has already been checked. Returns a value < 0 if no stencil format is supported with the format. Otherwise, returned index refers to the array returned by stencilFormats().

Definition at line 271 of file GrGLCaps.h.

271 {
273 return this->getFormatInfo(format).fStencilFormatIndex;
274 }
bool hasStencilFormatBeenDeterminedForFormat(GrGLFormat format) const
Definition: GrGLCaps.h:261

◆ getTexImageExternalFormatAndType()

void GrGLCaps::getTexImageExternalFormatAndType ( GrGLFormat  surfaceFormat,
GrGLenum externalFormat,
GrGLenum externalType 
) const

Gets the external format and type to pass to glTexImage2D with nullptr to create an uninitialized texture. See getTexImageOrStorageInternalFormat() for the internal format.

Definition at line 1354 of file GrGLCaps.cpp.

1355 {
1356 const auto& info = this->getFormatInfo(surfaceFormat);
1357 *externalType = info.fDefaultExternalType;
1358 *externalFormat = info.fDefaultExternalFormat;
1359}

◆ getTexImageOrStorageInternalFormat()

GrGLenum GrGLCaps::getTexImageOrStorageInternalFormat ( GrGLFormat  format) const
inline

Gets the internal format to use with glTexImage...() and glTexStorage...(). May be sized or base depending upon the GL. Not applicable to compressed textures.

Definition at line 185 of file GrGLCaps.h.

185 {
186 return this->getFormatInfo(format).fInternalFormatForTexImageOrStorage;
187 }

◆ getTexSubImageDefaultFormatTypeAndColorType()

void GrGLCaps::getTexSubImageDefaultFormatTypeAndColorType ( GrGLFormat  format,
GrGLenum externalFormat,
GrGLenum externalType,
GrColorType colorType 
) const

Gets the external format, type, and bytes per pixel to use when uploading solid color data via glTexSubImage...() to clear the texture at creation.

Definition at line 1361 of file GrGLCaps.cpp.

1364 {
1365 const auto& info = this->getFormatInfo(format);
1366 *externalType = info.fDefaultExternalType;
1367 *externalFormat = info.fDefaultExternalFormat;
1368 *colorType = info.fDefaultColorType;
1369}

◆ getTexSubImageExternalFormatAndType()

void GrGLCaps::getTexSubImageExternalFormatAndType ( GrGLFormat  surfaceFormat,
GrColorType  surfaceColorType,
GrColorType  memoryColorType,
GrGLenum externalFormat,
GrGLenum externalType 
) const

Given a src data color type and a color type interpretation for a texture of a given format this provides the external GL format and type to use with glTexSubImage2d. The color types should originate from supportedWritePixelsColorType().

Definition at line 1371 of file GrGLCaps.cpp.

1375 {
1376 this->getExternalFormat(surfaceFormat, surfaceColorType, memoryColorType,
1377 kTexImage_ExternalFormatUsage, externalFormat, externalType);
1378}

◆ getWriteSwizzle()

skgpu::Swizzle GrGLCaps::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 5097 of file GrGLCaps.cpp.

5098 {
5099 const auto& info = this->getFormatInfo(GrBackendFormats::AsGLFormat(format));
5100 for (int i = 0; i < info.fColorTypeInfoCount; ++i) {
5101 const auto& ctInfo = info.fColorTypeInfos[i];
5102 if (ctInfo.fColorType == colorType) {
5103 return ctInfo.fWriteSwizzle;
5104 }
5105 }
5106 SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.",
5107 (int)colorType,
5109 return {};
5110}
#define SkDEBUGFAILF(fmt,...)
Definition: SkAssert.h:119

◆ hasStencilFormatBeenDeterminedForFormat()

bool GrGLCaps::hasStencilFormatBeenDeterminedForFormat ( GrGLFormat  format) const
inline

Has a stencil format index been found for the format (or we've found that no format works).

Definition at line 261 of file GrGLCaps.h.

261 {
262 return this->getFormatInfo(format).fStencilFormatIndex != FormatInfo::kUnknown_StencilIndex;
263 }

◆ imagingSupport()

bool GrGLCaps::imagingSupport ( ) const
inline

Is GL_ARB_IMAGING supported.

Definition at line 353 of file GrGLCaps.h.

353{ return fImagingSupport; }

◆ invalidateBufferType()

InvalidateBufferType GrGLCaps::invalidateBufferType ( ) const
inline

Definition at line 396 of file GrGLCaps.h.

396{ return fInvalidateBufferType; }

◆ invalidateFBType()

InvalidateFBType GrGLCaps::invalidateFBType ( ) const
inline

Definition at line 323 of file GrGLCaps.h.

323{ return fInvalidateFBType; }

◆ isCoreProfile()

bool GrGLCaps::isCoreProfile ( ) const
inline

Definition at line 377 of file GrGLCaps.h.

377{ return fIsCoreProfile; }

◆ isFormatAsColorTypeRenderable()

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

Implements GrCaps.

Definition at line 4909 of file GrGLCaps.cpp.

4910 {
4911 if (format.textureType() == GrTextureType::kRectangle && !this->rectangleTextureSupport()) {
4912 return false;
4913 }
4914 if (format.textureType() == GrTextureType::kExternal) {
4915 return false;
4916 }
4918 const FormatInfo& info = this->getFormatInfo(f);
4919 if (!SkToBool(info.colorTypeFlags(ct) & ColorTypeInfo::kRenderable_Flag)) {
4920 return false;
4921 }
4922
4923 return this->isFormatRenderable(f, sampleCount);
4924}

◆ isFormatCopyable()

bool GrGLCaps::isFormatCopyable ( const GrBackendFormat format) const
overridevirtual

Implements GrCaps.

Definition at line 4977 of file GrGLCaps.cpp.

4977 {
4978 // In GL we have three ways to be able to copy. CopyTexImage, blit, and draw. CopyTexImage
4979 // requires the src to be an FBO attachment, blit requires both src and dst to be FBO
4980 // attachments, and draw requires the dst to be an FBO attachment. Thus to copy from and to
4981 // the same config, we need that config to be bindable to an FBO.
4983}

◆ isFormatRenderable() [1/2]

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

Implements GrCaps.

Definition at line 4926 of file GrGLCaps.cpp.

4926 {
4927 if (format.textureType() == GrTextureType::kRectangle && !this->rectangleTextureSupport()) {
4928 return false;
4929 }
4930 if (format.textureType() == GrTextureType::kExternal) {
4931 return false;
4932 }
4933 return this->isFormatRenderable(GrBackendFormats::AsGLFormat(format), sampleCount);
4934}

◆ isFormatRenderable() [2/2]

bool GrGLCaps::isFormatRenderable ( GrGLFormat  format,
int  sampleCount 
) const
inline

Definition at line 154 of file GrGLCaps.h.

154 {
155 return sampleCount <= this->maxRenderTargetSampleCount(format);
156 }
int maxRenderTargetSampleCount(const GrBackendFormat &format) const override
Definition: GrGLCaps.h:165

◆ isFormatSRGB()

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

Implements GrCaps.

Definition at line 4893 of file GrGLCaps.cpp.

◆ isFormatTexturable() [1/2]

bool GrGLCaps::isFormatTexturable ( const GrBackendFormat format,
GrTextureType  textureType 
) const
overridevirtual

Implements GrCaps.

Definition at line 4897 of file GrGLCaps.cpp.

4897 {
4898 if (textureType == GrTextureType::kRectangle && !this->rectangleTextureSupport()) {
4899 return false;
4900 }
4902}
bool rectangleTextureSupport() const
Are textures with GL_TEXTURE_RECTANGLE type supported.
Definition: GrGLCaps.h:384

◆ isFormatTexturable() [2/2]

bool GrGLCaps::isFormatTexturable ( GrGLFormat  format) const

Definition at line 4904 of file GrGLCaps.cpp.

4904 {
4905 const FormatInfo& info = this->getFormatInfo(format);
4906 return SkToBool(info.fFlags & FormatInfo::kTexturable_Flag);
4907}

◆ makeDesc()

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

Implements GrCaps.

Definition at line 5128 of file GrGLCaps.cpp.

5130 {
5131 SkASSERT(overrideFlags == ProgramDescOverrideFlags::kNone);
5133 GrProgramDesc::Build(&desc, programInfo, *this);
5134 return desc;
5135}
static void Build(GrProgramDesc *, const GrProgramInfo &, const GrCaps &)

◆ mapBufferType()

MapBufferType GrGLCaps::mapBufferType ( ) const
inline

What type of buffer mapping is supported?

Definition at line 326 of file GrGLCaps.h.

326{ return fMapBufferType; }

◆ maxFragmentUniformVectors()

int GrGLCaps::maxFragmentUniformVectors ( ) const
inline

The maximum number of fragment uniform vectors (GLES has min. 16).

Definition at line 344 of file GrGLCaps.h.

344{ return fMaxFragmentUniformVectors; }

◆ maxInstancesPerDrawWithoutCrashing()

int GrGLCaps::maxInstancesPerDrawWithoutCrashing ( int  pendingInstanceCount) const
inline

Definition at line 468 of file GrGLCaps.h.

468 {
469 return (fMaxInstancesPerDrawWithoutCrashing)
470 ? fMaxInstancesPerDrawWithoutCrashing : pendingInstanceCount;
471 }

◆ maxRenderTargetSampleCount() [1/2]

int GrGLCaps::maxRenderTargetSampleCount ( const GrBackendFormat format) const
inlineoverridevirtual

Implements GrCaps.

Definition at line 165 of file GrGLCaps.h.

165 {
167 }

◆ maxRenderTargetSampleCount() [2/2]

int GrGLCaps::maxRenderTargetSampleCount ( GrGLFormat  format) const

Definition at line 4960 of file GrGLCaps.cpp.

4960 {
4961 const FormatInfo& info = this->getFormatInfo(format);
4962 const auto& table = info.fColorSampleCounts;
4963 if (table.empty()) {
4964 return 0;
4965 }
4966 int count = table[table.size() - 1];
4967 if (fDriverBugWorkarounds.max_msaa_sample_count_4) {
4968 count = std::min(count, 4);
4969 }
4970 return count;
4971}
SI F table(const skcms_Curve *curve, F v)

◆ maxTextureMaxAnisotropy()

float GrGLCaps::maxTextureMaxAnisotropy ( ) const
inline

Definition at line 170 of file GrGLCaps.h.

170{ return fMaxTextureMaxAnisotropy; }

◆ mipmapLevelControlSupport()

bool GrGLCaps::mipmapLevelControlSupport ( ) const
inline

Can set the BASE and MAX mip map level.

Definition at line 387 of file GrGLCaps.h.

387{ return fMipmapLevelControlSupport; }

◆ mipmapLodControlSupport()

bool GrGLCaps::mipmapLodControlSupport ( ) const
inline

Can set the MIN/MAX LOD value.

Definition at line 390 of file GrGLCaps.h.

390{ return fMipmapLodControlSupport; }

◆ msFBOType()

MSFBOType GrGLCaps::msFBOType ( ) const
inline

Reports the type of MSAA FBO support.

Definition at line 285 of file GrGLCaps.h.

285{ return fMSFBOType; }

◆ multiDrawType()

MultiDrawType GrGLCaps::multiDrawType ( ) const
inline

How are multi draws implemented (if at all)?

Definition at line 338 of file GrGLCaps.h.

338{ return fMultiDrawType; }

◆ mustResetBlendFuncBetweenDualSourceAndDisable()

bool GrGLCaps::mustResetBlendFuncBetweenDualSourceAndDisable ( ) const
inline

Definition at line 443 of file GrGLCaps.h.

443 {
444 return fMustResetBlendFuncBetweenDualSourceAndDisable;
445 }

◆ mustSetAnyTexParameterToEnableMipmapping()

bool GrGLCaps::mustSetAnyTexParameterToEnableMipmapping ( ) const
inline

Definition at line 437 of file GrGLCaps.h.

437 {
438 return fMustSetAnyTexParameterToEnableMipmapping;
439 }

◆ neverDisableColorWrites()

bool GrGLCaps::neverDisableColorWrites ( ) const
inline

Definition at line 434 of file GrGLCaps.h.

434{ return fNeverDisableColorWrites; }

◆ onDumpJSON()

void GrGLCaps::onDumpJSON ( SkJSONWriter writer) const
overridevirtual

Reimplemented from GrCaps.

Definition at line 1351 of file GrGLCaps.cpp.

1351{ }

◆ packFlipYSupport()

bool GrGLCaps::packFlipYSupport ( ) const
inline

Is there support for GL_PACK_REVERSE_ROW_ORDER.

Definition at line 347 of file GrGLCaps.h.

347{ return fPackFlipYSupport; }

◆ programBinaryFormatIsValid()

bool GrGLCaps::programBinaryFormatIsValid ( GrGLenum  binaryFormat) const

Definition at line 4881 of file GrGLCaps.cpp.

4881 {
4882 return std::find(fProgramBinaryFormats.begin(), fProgramBinaryFormats.end(), binaryFormat) !=
4883 fProgramBinaryFormats.end();
4884}
int find(T *array, int N, T item)

◆ programBinarySupport()

bool GrGLCaps::programBinarySupport ( ) const
inline

Definition at line 488 of file GrGLCaps.h.

488{ return fProgramBinarySupport; }

◆ programParameterSupport()

bool GrGLCaps::programParameterSupport ( ) const
inline

Definition at line 489 of file GrGLCaps.h.

489{ return fProgramParameterSupport; }

◆ rebindColorAttachmentAfterCheckFramebufferStatus()

bool GrGLCaps::rebindColorAttachmentAfterCheckFramebufferStatus ( ) const
inline

Definition at line 456 of file GrGLCaps.h.

456 {
457 return fRebindColorAttachmentAfterCheckFramebufferStatus;
458 }

◆ rectangleTextureSupport()

bool GrGLCaps::rectangleTextureSupport ( ) const
inline

Are textures with GL_TEXTURE_RECTANGLE type supported.

Definition at line 384 of file GrGLCaps.h.

384{ return fRectangleTextureSupport; }

◆ regenerateMipmapType()

RegenerateMipmapType GrGLCaps::regenerateMipmapType ( ) const
inline

How is restricting sampled miplevels in onRegenerateMipmapLevels implemented?

Definition at line 341 of file GrGLCaps.h.

341{ return fRegenerateMipmapType; }

◆ requiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines()

bool GrGLCaps::requiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines ( ) const
inline

Definition at line 423 of file GrGLCaps.h.

423 {
424 return fRequiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines;
425 }

◆ samplerObjectSupport()

bool GrGLCaps::samplerObjectSupport ( ) const
inline

Are sampler objects available in this GL?

Definition at line 493 of file GrGLCaps.h.

493{ return fSamplerObjectSupport; }

◆ setStencilFormatIndexForFormat()

void GrGLCaps::setStencilFormatIndexForFormat ( GrGLFormat  format,
int  index 
)

If index is >= 0 this records an index into stencilFormats() as the best stencil format for the format. If < 0 it records that the format has no supported stencil format index.

Definition at line 1397 of file GrGLCaps.cpp.

1397 {
1399 this->getFormatInfo(format).fStencilFormatIndex =
1400 index < 0 ? FormatInfo::kUnsupported_StencilFormatIndex : index;
1401}

◆ shouldQueryImplementationReadSupport()

bool GrGLCaps::shouldQueryImplementationReadSupport ( GrGLFormat  format) const

Would it be useful to check GL_IMPLEMENTATION_READ_FORMAT and _TYPE for this format to detect more efficient glReadPixels arguments?

Definition at line 4989 of file GrGLCaps.cpp.

4989 {
4990 const auto& formatInfo = const_cast<GrGLCaps*>(this)->getFormatInfo(format);
4991 if (!formatInfo.fHaveQueriedImplementationReadSupport) {
4992 // Check whether we will actually learn anything useful.
4993 bool needQuery = false;
4994 for (int i = 0; i < formatInfo.fColorTypeInfoCount && !needQuery; ++i) {
4995 const auto& surfCTInfo = formatInfo.fColorTypeInfos[i];
4996 for (int j = 0; j < surfCTInfo.fExternalIOFormatCount; ++j) {
4997 if (surfCTInfo.fExternalIOFormats[j].fRequiresImplementationReadQuery) {
4998 needQuery = true;
4999 break;
5000 }
5001 }
5002 }
5003 if (!needQuery) {
5004 // Pretend we already checked it.
5005 const_cast<FormatInfo&>(formatInfo).fHaveQueriedImplementationReadSupport = true;
5006 }
5007 }
5008 return !formatInfo.fHaveQueriedImplementationReadSupport;
5009}

◆ skipErrorChecks()

bool GrGLCaps::skipErrorChecks ( ) const
inline

Skip checks for GL errors and framebuffer completeness. Note that this does not skip checking shader compilation and program linking status.

Definition at line 514 of file GrGLCaps.h.

514{ return fSkipErrorChecks; }

◆ srgbWriteControl()

bool GrGLCaps::srgbWriteControl ( ) const
inline

Definition at line 508 of file GrGLCaps.h.

508{ return fSRGBWriteControl; }

◆ stencilFormats()

const skia_private::TArray< GrGLFormat, true > & GrGLCaps::stencilFormats ( ) const
inline

Gets an array of legal stencil formats. These formats are not guaranteed to be supported by the driver but are legal GLenum names given the GL version and extensions supported.

Definition at line 223 of file GrGLCaps.h.

223 {
224 return fStencilFormats;
225 }

◆ supportedWritePixelsColorType()

GrCaps::SupportedWrite GrGLCaps::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 4847 of file GrGLCaps.cpp.

4849 {
4850 // We first try to find a supported write pixels GrColorType that matches the data's
4851 // srcColorType. If that doesn't exists we will use any supported GrColorType.
4853 const auto& formatInfo = this->getFormatInfo(GrBackendFormats::AsGLFormat(surfaceFormat));
4854 bool foundSurfaceCT = false;
4855 size_t transferOffsetAlignment = 0;
4856 if (formatInfo.fFlags & FormatInfo::kTransfers_Flag) {
4857 transferOffsetAlignment = 1;
4858 }
4859 for (int i = 0; !foundSurfaceCT && i < formatInfo.fColorTypeInfoCount; ++i) {
4860 if (formatInfo.fColorTypeInfos[i].fColorType == surfaceColorType) {
4861 const ColorTypeInfo& ctInfo = formatInfo.fColorTypeInfos[i];
4862 foundSurfaceCT = true;
4863 for (int j = 0; j < ctInfo.fExternalIOFormatCount; ++j) {
4864 const auto& ioInfo = ctInfo.fExternalIOFormats[j];
4865 if (ioInfo.fExternalTexImageFormat != 0) {
4866 if (ioInfo.fColorType == srcColorType) {
4867 return {srcColorType, transferOffsetAlignment};
4868 }
4869 // Currently we just pick the first supported format that we find as our
4870 // fallback.
4871 if (fallbackCT == GrColorType::kUnknown) {
4872 fallbackCT = ioInfo.fColorType;
4873 }
4874 }
4875 }
4876 }
4877 }
4878 return {fallbackCT, transferOffsetAlignment};
4879}
GrColorType
Definition: GrTypesPriv.h:540

◆ surfaceSupportsReadPixels()

GrCaps::SurfaceReadPixelsSupport GrGLCaps::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 4740 of file GrGLCaps.cpp.

4741 {
4742 if (surface->isProtected()) {
4744 }
4745 if (auto tex = static_cast<const GrGLTexture*>(surface->asTexture())) {
4746 // We don't support reading pixels directly from EXTERNAL textures as it would require
4747 // binding the texture to a FBO. For now we also disallow reading back directly
4748 // from compressed textures.
4749 if (tex->target() == GR_GL_TEXTURE_EXTERNAL || GrGLFormatIsCompressed(tex->format())) {
4751 }
4752 } else if (auto rt = static_cast<const GrGLRenderTarget*>(surface->asRenderTarget())) {
4753 // glReadPixels does not allow reading back from a MSAA framebuffer. If the underlying
4754 // GrSurface doesn't have a second FBO to resolve to then we must make a copy.
4755 if (rt->numSamples() > 1 && !rt->asTexture()) {
4757 }
4758 }
4760}
#define GR_GL_TEXTURE_EXTERNAL
Definition: GrGLDefines.h:1052
bool GrGLFormatIsCompressed(GrGLFormat format)
Definition: GrGLUtil.cpp:812
VkSurfaceKHR surface
Definition: main.cc:49

◆ textureSwizzleSupport()

bool GrGLCaps::textureSwizzleSupport ( ) const
inline

Definition at line 501 of file GrGLCaps.h.

501{ return fTextureSwizzleSupport; }

◆ textureUsageSupport()

bool GrGLCaps::textureUsageSupport ( ) const
inline

Is there support for texture parameter GL_TEXTURE_USAGE.

Definition at line 350 of file GrGLCaps.h.

350{ return fTextureUsageSupport; }

◆ tiledRenderingSupport()

bool GrGLCaps::tiledRenderingSupport ( ) const
inline

Definition at line 503 of file GrGLCaps.h.

503{ return fTiledRenderingSupport; }

◆ transferBufferType()

TransferBufferType GrGLCaps::transferBufferType ( ) const
inline

What type of transfer buffer is supported?

Definition at line 329 of file GrGLCaps.h.

329{ return fTransferBufferType; }

◆ useDrawInsteadOfAllRenderTargetWrites()

bool GrGLCaps::useDrawInsteadOfAllRenderTargetWrites ( ) const
inline

Definition at line 417 of file GrGLCaps.h.

417 {
418 return fUseDrawInsteadOfAllRenderTargetWrites;
419 }

◆ useSamplerObjects()

bool GrGLCaps::useSamplerObjects ( ) const
inline

Are we using sampler objects in favor of texture parameters? (This will only be true if samplerObjectSupport()).

Definition at line 499 of file GrGLCaps.h.

499{ return fUseSamplerObjects; }

◆ usesImplicitMSAAResolve()

bool GrGLCaps::usesImplicitMSAAResolve ( ) const
inline

Is the MSAA FBO extension one where the texture is multisampled when bound to an FBO and then implicitly resolved when read.

Definition at line 318 of file GrGLCaps.h.

318 {
319 return kES_IMG_MsToTexture_MSFBOType == fMSFBOType ||
320 kES_EXT_MsToTexture_MSFBOType == fMSFBOType;
321 }

◆ usesMSAARenderBuffers()

bool GrGLCaps::usesMSAARenderBuffers ( ) const
inline

Does the preferred MSAA FBO extension have MSAA renderbuffers?

Definition at line 290 of file GrGLCaps.h.

290 {
291 return kNone_MSFBOType != fMSFBOType &&
292 kES_IMG_MsToTexture_MSFBOType != fMSFBOType &&
293 kES_EXT_MsToTexture_MSFBOType != fMSFBOType;
294 }

◆ vertexArrayObjectSupport()

bool GrGLCaps::vertexArrayObjectSupport ( ) const
inline

Is there support for Vertex Array Objects?

Definition at line 356 of file GrGLCaps.h.

356{ return fVertexArrayObjectSupport; }

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