Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private 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?
 
TransferBufferType transferBufferType () const
 What type of transfer buffer is supported?
 
bool fenceSyncSupport () const
 
FenceType fenceType () const
 How is GrGLsync implemented?
 
MultiDrawType multiDrawType () const
 How are multi draws implemented (if at all)?
 
RegenerateMipmapType regenerateMipmapType () const
 How is restricting sampled miplevels in onRegenerateMipmapLevels implemented?
 
int maxFragmentUniformVectors () const
 The maximum number of fragment uniform vectors (GLES has min. 16).
 
bool packFlipYSupport () const
 Is there support for GL_PACK_REVERSE_ROW_ORDER.
 
bool textureUsageSupport () const
 Is there support for texture parameter GL_TEXTURE_USAGE.
 
bool imagingSupport () const
 Is GL_ARB_IMAGING supported.
 
bool vertexArrayObjectSupport () const
 Is there support for Vertex Array Objects?
 
bool debugSupport () const
 Is there support for GL_KHR_debug?
 
bool ES2CompatibilitySupport () const
 Is there support for ES2 compatability?
 
bool drawRangeElementsSupport () const
 Is there support for glDrawRangeElements?
 
bool baseVertexBaseInstanceSupport () const
 Are the glDraw*Base(VertexBase)Instance methods, and baseInstance fields in indirect draw.
 
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.
 
bool mipmapLevelControlSupport () const
 Can set the BASE and MAX mip map level.
 
bool mipmapLodControlSupport () const
 Can set the MIN/MAX LOD value.
 
bool doManualMipmapping () const
 
void onDumpJSON (SkJSONWriter *) const override
 
InvalidateBufferType invalidateBufferType () const
 
bool clearToBoundaryValuesIsBroken () const
 
bool clearTextureSupport () const
 glClearTex(Sub)Image support
 
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
 
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
 
bool isFormatCompressed (const GrBackendFormat &format) const
 
int internalMultisampleCount (const GrBackendFormat &format) const
 
bool surfaceSupportsWritePixels (const GrSurface *) const
 
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
 
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
 
bool clampToBorderSupport () const
 
skgpu::Swizzle getReadSwizzle (const GrBackendFormat &format, GrColorType colorType) const
 
const GrDriverBugWorkaroundsworkarounds () const
 
virtual void addExtraSamplerKey (skgpu::KeyBuilder *, GrSamplerState, const GrBackendFormat &) const
 
 GR_DECL_BITFIELD_CLASS_OPS_FRIENDS (ProgramDescOverrideFlags)
 
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
 

Private Member Functions

void onApplyOptionsOverrides (const GrContextOptions &options) override
 
bool onIsWindowRectanglesSupportedForRT (const GrBackendRenderTarget &) const override
 
bool onSurfaceSupportsWritePixels (const GrSurface *) const override
 
bool onCanCopySurface (const GrSurfaceProxy *dst, const SkIRect &dstRect, const GrSurfaceProxy *src, const SkIRect &srcRect) const override
 
GrBackendFormat onGetDefaultBackendFormat (GrColorType) const override
 
bool onAreColorTypeAndFormatCompatible (GrColorType, const GrBackendFormat &) const override
 
SupportedRead onSupportedReadPixelsColorType (GrColorType, const GrBackendFormat &, GrColorType) const override
 
skgpu::Swizzle onGetReadSwizzle (const GrBackendFormat &, GrColorType) const override
 
GrDstSampleFlags onGetDstSampleFlagsForProxy (const GrRenderTargetProxy *) const override
 
bool onSupportsDynamicMSAA (const GrRenderTargetProxy *) const override
 

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

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

◆ 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 55 of file GrGLCaps.cpp.

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

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

3679 {
3680 return this->isFormatRenderable(dstFormat, 1) &&
3681 srcIsTexturable &&
3682 !(fDisableScalingCopyAsDraws && scalingCopy);
3683}
bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const override

◆ canCopyTexSubImage()

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

Definition at line 3524 of file GrGLCaps.cpp.

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

4981 {
4982 return SkToBool(this->getFormatInfo(format).fFlags & FormatInfo::kFBOColorAttachment_Flag);
4983}
uint16_t fFlags
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 5131 of file GrGLCaps.cpp.

5131 {
5132 auto glFormat = GrBackendFormats::AsGLFormat(format);
5133 return (uint64_t)(glFormat);
5134}
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 5019 of file GrGLCaps.cpp.

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

◆ 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 4993 of file GrGLCaps.cpp.

4993 {
4994 return SkToBool(this->getFormatInfo(format).fFlags & FormatInfo::kUseTexStorage_Flag);
4995}

◆ 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 5059 of file GrGLCaps.cpp.

5060 {
5061 switch (compressionType) {
5063 return {};
5065 // if ETC2 is available default to that format
5068 }
5071 }
5072 return {};
5077 }
5078 return {};
5083 }
5084 return {};
5085 }
5086
5088}
#define GR_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
#define GR_GL_TEXTURE_2D
#define GR_GL_COMPRESSED_ETC1_RGB8
#define GR_GL_COMPRESSED_RGB8_ETC2
#define GR_GL_COMPRESSED_RGB_S3TC_DXT1_EXT
@ 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
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 3747 of file GrGLCaps.cpp.

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

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

◆ 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 4944 of file GrGLCaps.cpp.

4944 {
4945 const FormatInfo& info = this->getFormatInfo(format);
4946
4947 int count = info.fColorSampleCounts.size();
4948 if (!count) {
4949 return 0;
4950 }
4951
4952 requestedCount = std::max(1, requestedCount);
4953 if (1 == requestedCount) {
4954 return info.fColorSampleCounts[0] == 1 ? 1 : 0;
4955 }
4956
4957 for (int sampleCount : info.fColorSampleCounts) {
4958 if (sampleCount >= requestedCount) {
4959 if (fDriverBugWorkarounds.max_msaa_sample_count_4) {
4960 sampleCount = std::min(sampleCount, 4);
4961 }
4962 return sampleCount;
4963 }
4964 }
4965 return 0;
4966}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
int count
GrDriverBugWorkarounds fDriverBugWorkarounds
Definition GrCaps.h:668

◆ 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 1353 of file GrGLCaps.cpp.

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

◆ 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 1360 of file GrGLCaps.cpp.

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

◆ 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 1370 of file GrGLCaps.cpp.

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

◆ 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 5105 of file GrGLCaps.cpp.

5106 {
5107 const auto& info = this->getFormatInfo(GrBackendFormats::AsGLFormat(format));
5108 for (int i = 0; i < info.fColorTypeInfoCount; ++i) {
5109 const auto& ctInfo = info.fColorTypeInfos[i];
5110 if (ctInfo.fColorType == colorType) {
5111 return ctInfo.fWriteSwizzle;
5112 }
5113 }
5114 SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.",
5115 (int)colorType,
5117 return {};
5118}
#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 4917 of file GrGLCaps.cpp.

4918 {
4919 if (format.textureType() == GrTextureType::kRectangle && !this->rectangleTextureSupport()) {
4920 return false;
4921 }
4922 if (format.textureType() == GrTextureType::kExternal) {
4923 return false;
4924 }
4926 const FormatInfo& info = this->getFormatInfo(f);
4927 if (!SkToBool(info.colorTypeFlags(ct) & ColorTypeInfo::kRenderable_Flag)) {
4928 return false;
4929 }
4930
4931 return this->isFormatRenderable(f, sampleCount);
4932}

◆ isFormatCopyable()

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

Implements GrCaps.

Definition at line 4985 of file GrGLCaps.cpp.

4985 {
4986 // In GL we have three ways to be able to copy. CopyTexImage, blit, and draw. CopyTexImage
4987 // requires the src to be an FBO attachment, blit requires both src and dst to be FBO
4988 // attachments, and draw requires the dst to be an FBO attachment. Thus to copy from and to
4989 // the same config, we need that config to be bindable to an FBO.
4991}

◆ isFormatRenderable() [1/2]

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

Implements GrCaps.

Definition at line 4934 of file GrGLCaps.cpp.

4934 {
4935 if (format.textureType() == GrTextureType::kRectangle && !this->rectangleTextureSupport()) {
4936 return false;
4937 }
4938 if (format.textureType() == GrTextureType::kExternal) {
4939 return false;
4940 }
4941 return this->isFormatRenderable(GrBackendFormats::AsGLFormat(format), sampleCount);
4942}

◆ 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 4901 of file GrGLCaps.cpp.

◆ isFormatTexturable() [1/2]

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

Implements GrCaps.

Definition at line 4905 of file GrGLCaps.cpp.

4905 {
4906 if (textureType == GrTextureType::kRectangle && !this->rectangleTextureSupport()) {
4907 return false;
4908 }
4910}
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 4912 of file GrGLCaps.cpp.

4912 {
4913 const FormatInfo& info = this->getFormatInfo(format);
4914 return SkToBool(info.fFlags & FormatInfo::kTexturable_Flag);
4915}

◆ makeDesc()

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

Implements GrCaps.

Definition at line 5136 of file GrGLCaps.cpp.

5138 {
5139 SkASSERT(overrideFlags == ProgramDescOverrideFlags::kNone);
5141 GrProgramDesc::Build(&desc, programInfo, *this);
5142 return desc;
5143}
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 4968 of file GrGLCaps.cpp.

4968 {
4969 const FormatInfo& info = this->getFormatInfo(format);
4970 const auto& table = info.fColorSampleCounts;
4971 if (table.empty()) {
4972 return 0;
4973 }
4974 int count = table[table.size() - 1];
4975 if (fDriverBugWorkarounds.max_msaa_sample_count_4) {
4976 count = std::min(count, 4);
4977 }
4978 return count;
4979}
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; }

◆ onApplyOptionsOverrides()

void GrGLCaps::onApplyOptionsOverrides ( const GrContextOptions options)
overrideprivatevirtual

Reimplemented from GrCaps.

Definition at line 4700 of file GrGLCaps.cpp.

4700 {
4701 if (options.fDisableDriverCorrectnessWorkarounds) {
4702 SkASSERT(!fDoManualMipmapping);
4703 SkASSERT(!fClearToBoundaryValuesIsBroken);
4704 SkASSERT(0 == fMaxInstancesPerDrawWithoutCrashing);
4705 SkASSERT(!fDrawArraysBaseVertexIsBroken);
4706 SkASSERT(!fDisallowTexSubImageForUnormConfigTexturesEverBoundToFBO);
4707 SkASSERT(!fUseDrawInsteadOfAllRenderTargetWrites);
4708 SkASSERT(!fRequiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines);
4709 SkASSERT(!fDontSetBaseOrMaxLevelForExternalTextures);
4710 SkASSERT(!fNeverDisableColorWrites);
4711 }
4713 fProgramBinarySupport = false;
4714 }
4715
4716 switch (options.fSkipGLErrorChecks) {
4718 fSkipErrorChecks = false;
4719 break;
4721 fSkipErrorChecks = true;
4722 break;
4724 break;
4725 }
4726}
const char * options

◆ onAreColorTypeAndFormatCompatible()

bool GrGLCaps::onAreColorTypeAndFormatCompatible ( GrColorType  ct,
const GrBackendFormat format 
) const
overrideprivatevirtual

Implements GrCaps.

Definition at line 5039 of file GrGLCaps.cpp.

5040 {
5042 const auto& info = this->getFormatInfo(glFormat);
5043 for (int i = 0; i < info.fColorTypeInfoCount; ++i) {
5044 if (info.fColorTypeInfos[i].fColorType == ct) {
5045 return true;
5046 }
5047 }
5048 return false;
5049}
GrGLFormat
Definition GrGLTypes.h:59

◆ onCanCopySurface()

bool GrGLCaps::onCanCopySurface ( const GrSurfaceProxy dst,
const SkIRect dstRect,
const GrSurfaceProxy src,
const SkIRect srcRect 
) const
overrideprivatevirtual

Implements GrCaps.

Definition at line 3699 of file GrGLCaps.cpp.

3700 {
3701 if (src->isProtected() == GrProtected::kYes && dst->isProtected() != GrProtected::kYes) {
3702 return false;
3703 }
3704
3705 int dstSampleCnt = 0;
3706 int srcSampleCnt = 0;
3707 if (const GrRenderTargetProxy* rtProxy = dst->asRenderTargetProxy()) {
3708 dstSampleCnt = rtProxy->numSamples();
3709 }
3710 if (const GrRenderTargetProxy* rtProxy = src->asRenderTargetProxy()) {
3711 srcSampleCnt = rtProxy->numSamples();
3712 }
3713 SkASSERT((dstSampleCnt > 0) == SkToBool(dst->asRenderTargetProxy()));
3714 SkASSERT((srcSampleCnt > 0) == SkToBool(src->asRenderTargetProxy()));
3715
3716 const GrTextureProxy* dstTex = dst->asTextureProxy();
3717 const GrTextureProxy* srcTex = src->asTextureProxy();
3718
3719 GrTextureType dstTexType;
3720 GrTextureType* dstTexTypePtr = nullptr;
3721 GrTextureType srcTexType;
3722 GrTextureType* srcTexTypePtr = nullptr;
3723 if (dstTex) {
3724 dstTexType = dstTex->textureType();
3725 dstTexTypePtr = &dstTexType;
3726 }
3727 if (srcTex) {
3728 srcTexType = srcTex->textureType();
3729 srcTexTypePtr = &srcTexType;
3730 }
3731
3732 auto dstFormat = GrBackendFormats::AsGLFormat(dst->backendFormat());
3733 auto srcFormat = GrBackendFormats::AsGLFormat(src->backendFormat());
3734 // Only copyAsBlit() and copyAsDraw() can handle scaling between src and dst.
3735 const bool scalingCopy = srcRect.size() != dstRect.size();
3736 if (!scalingCopy &&
3737 this->canCopyTexSubImage(dstFormat, has_msaa_render_buffer(dst, *this), dstTexTypePtr,
3738 srcFormat, has_msaa_render_buffer(src, *this), srcTexTypePtr)) {
3739 return true;
3740 }
3741 return this->canCopyAsBlit(dstFormat, dstSampleCnt, dstTexTypePtr, srcFormat, srcSampleCnt,
3742 srcTexTypePtr, src->getBoundsRect(), src->priv().isExact(), srcRect,
3743 dstRect) ||
3744 this->canCopyAsDraw(dstFormat, SkToBool(srcTex), scalingCopy);
3745}
static bool has_msaa_render_buffer(const GrSurfaceProxy *surf, const GrGLCaps &glCaps)
GrTextureType
bool canCopyAsDraw(GrGLFormat dstFormat, bool srcIsTexturable, bool scalingCopy) 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
GrTextureType textureType() const
dst
Definition cp.py:12
constexpr SkISize size() const
Definition SkRect.h:172

◆ onDumpJSON()

void GrGLCaps::onDumpJSON ( SkJSONWriter writer) const
overridevirtual

Reimplemented from GrCaps.

Definition at line 1350 of file GrGLCaps.cpp.

1350{ }

◆ onGetDefaultBackendFormat()

GrBackendFormat GrGLCaps::onGetDefaultBackendFormat ( GrColorType  ct) const
overrideprivatevirtual

Implements GrCaps.

Definition at line 5051 of file GrGLCaps.cpp.

5051 {
5052 auto format = this->getFormatFromColorType(ct);
5054 return {};
5055 }
5057}
static constexpr GrGLenum GrGLFormatToEnum(GrGLFormat format)
Definition GrGLUtil.h:445
GrGLFormat getFormatFromColorType(GrColorType colorType) const
Definition GrGLCaps.h:176

◆ onGetDstSampleFlagsForProxy()

GrDstSampleFlags GrGLCaps::onGetDstSampleFlagsForProxy ( const GrRenderTargetProxy rt) const
overrideprivatevirtual

Reimplemented from GrCaps.

Definition at line 5120 of file GrGLCaps.cpp.

5120 {
5121 if (rt->asTextureProxy()) {
5123 }
5125}
virtual GrTextureProxy * asTextureProxy()

◆ onGetReadSwizzle()

skgpu::Swizzle GrGLCaps::onGetReadSwizzle ( const GrBackendFormat format,
GrColorType  colorType 
) const
overrideprivatevirtual

Implements GrCaps.

Definition at line 5090 of file GrGLCaps.cpp.

5091 {
5093 const auto& info = this->getFormatInfo(glFormat);
5094 for (int i = 0; i < info.fColorTypeInfoCount; ++i) {
5095 const auto& ctInfo = info.fColorTypeInfos[i];
5096 if (ctInfo.fColorType == colorType) {
5097 return ctInfo.fReadSwizzle;
5098 }
5099 }
5100 SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.",
5101 (int)colorType, (int)glFormat);
5102 return {};
5103}

◆ onIsWindowRectanglesSupportedForRT()

bool GrGLCaps::onIsWindowRectanglesSupportedForRT ( const GrBackendRenderTarget backendRT) const
overrideprivatevirtual

Reimplemented from GrCaps.

Definition at line 4894 of file GrGLCaps.cpp.

4894 {
4895 GrGLFramebufferInfo fbInfo;
4897 // Window Rectangles are not supported for FBO 0;
4898 return fbInfo.fFBOID != 0;
4899}
#define SkAssertResult(cond)
Definition SkAssert.h:123
SK_API bool GetGLFramebufferInfo(const GrBackendRenderTarget &, GrGLFramebufferInfo *)

◆ onSupportedReadPixelsColorType()

GrCaps::SupportedRead GrGLCaps::onSupportedReadPixelsColorType ( GrColorType  srcColorType,
const GrBackendFormat srcBackendFormat,
GrColorType  dstColorType 
) const
overrideprivatevirtual

Implements GrCaps.

Definition at line 4806 of file GrGLCaps.cpp.

4808 {
4809
4810 SkTextureCompressionType compression = GrBackendFormatToCompressionType(srcBackendFormat);
4811 if (compression != SkTextureCompressionType::kNone) {
4814 0};
4815 }
4816
4817 // We first try to find a supported read pixels GrColorType that matches the requested
4818 // dstColorType. If that doesn't exists we will use any valid read pixels GrColorType.
4819 GrCaps::SupportedRead fallbackRead = {GrColorType::kUnknown, 0};
4820 const auto& formatInfo = this->getFormatInfo(GrBackendFormats::AsGLFormat(srcBackendFormat));
4821 bool foundSrcCT = false;
4822 for (int i = 0; !foundSrcCT && i < formatInfo.fColorTypeInfoCount; ++i) {
4823 if (formatInfo.fColorTypeInfos[i].fColorType == srcColorType) {
4824 const ColorTypeInfo& ctInfo = formatInfo.fColorTypeInfos[i];
4825 foundSrcCT = true;
4826 for (int j = 0; j < ctInfo.fExternalIOFormatCount; ++j) {
4827 const auto& ioInfo = ctInfo.fExternalIOFormats[j];
4828 if (ioInfo.fExternalReadFormat != 0) {
4829 if (formatInfo.fHaveQueriedImplementationReadSupport ||
4830 !ioInfo.fRequiresImplementationReadQuery) {
4831 GrGLenum transferOffsetAlignment = 0;
4832 if (formatInfo.fFlags & FormatInfo::kTransfers_Flag) {
4833 transferOffsetAlignment =
4834 offset_alignment_for_transfer_buffer(ioInfo.fExternalType);
4835 if (dstColorType == GrColorType::kRG_88 && fPadRG88TransferAlignment) {
4836 transferOffsetAlignment = 2;
4837 }
4838 }
4839 if (ioInfo.fColorType == dstColorType) {
4840 return {dstColorType, transferOffsetAlignment};
4841 }
4842 // Currently we just pick the first supported format that we find as our
4843 // fallback.
4844 if (fallbackRead.fColorType == GrColorType::kUnknown) {
4845 fallbackRead = {ioInfo.fColorType, transferOffsetAlignment};
4846 }
4847 }
4848 }
4849 }
4850 }
4851 }
4852 return fallbackRead;
4853}
SkTextureCompressionType GrBackendFormatToCompressionType(const GrBackendFormat &format)
size_t offset_alignment_for_transfer_buffer(GrGLenum externalType)
unsigned int GrGLenum
Definition GrGLTypes.h:102
static constexpr bool SkTextureCompressionTypeIsOpaque(SkTextureCompressionType compression)
GrColorType fColorType
Definition GrCaps.h:333

◆ onSupportsDynamicMSAA()

bool GrGLCaps::onSupportsDynamicMSAA ( const GrRenderTargetProxy rtProxy) const
overrideprivatevirtual

Reimplemented from GrCaps.

Definition at line 5127 of file GrGLCaps.cpp.

5127 {
5128 return !fDisallowDynamicMSAA;
5129}

◆ onSurfaceSupportsWritePixels()

bool GrGLCaps::onSurfaceSupportsWritePixels ( const GrSurface surface) const
overrideprivatevirtual

Implements GrCaps.

Definition at line 4728 of file GrGLCaps.cpp.

4728 {
4729 if (fDisallowTexSubImageForUnormConfigTexturesEverBoundToFBO) {
4730 if (auto tex = static_cast<const GrGLTexture*>(surface->asTexture())) {
4731 if (tex->hasBaseLevelBeenBoundToFBO()) {
4732 return false;
4733 }
4734 }
4735 }
4736 if (auto rt = surface->asRenderTarget()) {
4737 if (fUseDrawInsteadOfAllRenderTargetWrites) {
4738 return false;
4739 }
4740 if (rt->numSamples() > 1 && this->usesMSAARenderBuffers()) {
4741 return false;
4742 }
4743 return SkToBool(surface->asTexture());
4744 }
4745 return true;
4746}
VkSurfaceKHR surface
Definition main.cc:49

◆ 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 4889 of file GrGLCaps.cpp.

4889 {
4890 return std::find(fProgramBinaryFormats.begin(), fProgramBinaryFormats.end(), binaryFormat) !=
4891 fProgramBinaryFormats.end();
4892}

◆ 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 1396 of file GrGLCaps.cpp.

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

◆ 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 4997 of file GrGLCaps.cpp.

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

◆ 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 4855 of file GrGLCaps.cpp.

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

◆ 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 4748 of file GrGLCaps.cpp.

4749 {
4750 if (surface->isProtected()) {
4752 }
4753 if (auto tex = static_cast<const GrGLTexture*>(surface->asTexture())) {
4754 // We don't support reading pixels directly from EXTERNAL textures as it would require
4755 // binding the texture to a FBO. For now we also disallow reading back directly
4756 // from compressed textures.
4757 if (tex->target() == GR_GL_TEXTURE_EXTERNAL || GrGLFormatIsCompressed(tex->format())) {
4759 }
4760 } else if (auto rt = static_cast<const GrGLRenderTarget*>(surface->asRenderTarget())) {
4761 // glReadPixels does not allow reading back from a MSAA framebuffer. If the underlying
4762 // GrSurface doesn't have a second FBO to resolve to then we must make a copy.
4763 if (rt->numSamples() > 1 && !rt->asTexture()) {
4765 }
4766 }
4768}
#define GR_GL_TEXTURE_EXTERNAL
bool GrGLFormatIsCompressed(GrGLFormat format)
Definition GrGLUtil.cpp:812

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