9#ifndef GrGLCaps_DEFINED
10#define GrGLCaps_DEFINED
152 int sampleCount = 1)
const override;
178 return fColorTypeToFormatTable[idx];
186 return this->getFormatInfo(
format).fInternalFormatForTexImageOrStorage;
224 return fStencilFormats;
248 return this->getFormatInfo(
format).fInternalFormatForRenderbuffer;
255 return this->getFormatInfo(
format).fDefaultExternalType;
262 return this->getFormatInfo(
format).fStencilFormatIndex != FormatInfo::kUnknown_StencilIndex;
273 return this->getFormatInfo(
format).fStencilFormatIndex;
412 return fDisallowTexSubImageForUnormConfigTexturesEverBoundToFBO;
418 return fUseDrawInsteadOfAllRenderTargetWrites;
424 return fRequiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines;
430 return fDontSetBaseOrMaxLevelForExternalTextures;
438 return fMustSetAnyTexParameterToEnableMipmapping;
444 return fMustResetBlendFuncBetweenDualSourceAndDisable;
451 return fBindTexture0WhenChangingTextureFBOMultisampleCount;
457 return fRebindColorAttachmentAfterCheckFramebufferStatus;
462 return fFlushBeforeWritePixels;
469 return (fMaxInstancesPerDrawWithoutCrashing)
470 ? fMaxInstancesPerDrawWithoutCrashing : pendingInstanceCount;
475 GrGLFormat srcFormat,
bool srcHasMSAARenderBuffer,
481 const SkRect& srcBounds,
bool srcBoundsExact,
528#if defined(GR_TEST_UTILS)
531 std::vector<GrTest::TestFormatColorTypeCombination> getTestingCombinations()
const override;
535 enum ExternalFormatUsage {
536 kTexImage_ExternalFormatUsage,
537 kReadPixels_ExternalFormatUsage,
546 struct FormatWorkarounds {
547 bool fDisableSRGBRenderWithMSAAForMacAMD =
false;
548 bool fDisableRGBA16FTexStorageForCrBug1008003 =
false;
549 bool fDisableBGRATextureStorageForIntelWindowsES =
false;
550 bool fDisableLuminance16F =
false;
551 bool fDisableTexStorage =
false;
552 bool fDisallowDirectRG8ReadPixels =
false;
553 bool fDisallowBGRA8ReadPixels =
false;
554 bool fDisallowR8ForPowerVRSGX54x =
false;
555 bool fDisallowUnorm16Transfers =
false;
556 bool fDisallowTextureUnorm16 =
false;
557 bool fDisallowETC2Compression =
false;
575 bool onSurfaceSupportsWritePixels(
const GrSurface*)
const override;
595 int fMaxFragmentUniformVectors = 0;
596 float fMaxTextureMaxAnisotropy = 1.f;
607 bool fPackFlipYSupport : 1;
608 bool fTextureUsageSupport : 1;
609 bool fImagingSupport : 1;
610 bool fVertexArrayObjectSupport : 1;
611 bool fDebugSupport : 1;
612 bool fES2CompatibilitySupport : 1;
613 bool fDrawRangeElementsSupport : 1;
614 bool fBaseVertexBaseInstanceSupport : 1;
615 bool fIsCoreProfile : 1;
616 bool fBindFragDataLocationSupport : 1;
617 bool fBindUniformLocationSupport : 1;
618 bool fRectangleTextureSupport : 1;
619 bool fMipmapLevelControlSupport : 1;
620 bool fMipmapLodControlSupport : 1;
621 bool fClearTextureSupport : 1;
622 bool fProgramBinarySupport : 1;
623 bool fProgramParameterSupport : 1;
624 bool fSamplerObjectSupport : 1;
625 bool fUseSamplerObjects : 1;
626 bool fTextureSwizzleSupport : 1;
627 bool fTiledRenderingSupport : 1;
628 bool fFenceSyncSupport : 1;
629 bool fFBFetchRequiresEnablePerSample : 1;
630 bool fSRGBWriteControl : 1;
631 bool fSkipErrorChecks : 1;
632 bool fClientCanDisableMultisample : 1;
635 bool fDoManualMipmapping : 1;
636 bool fClearToBoundaryValuesIsBroken : 1;
637 bool fDrawArraysBaseVertexIsBroken : 1;
638 bool fDisallowTexSubImageForUnormConfigTexturesEverBoundToFBO : 1;
639 bool fUseDrawInsteadOfAllRenderTargetWrites : 1;
640 bool fRequiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines : 1;
641 bool fDontSetBaseOrMaxLevelForExternalTextures : 1;
642 bool fNeverDisableColorWrites : 1;
643 bool fMustSetAnyTexParameterToEnableMipmapping : 1;
644 bool fAllowBGRA8CopyTexSubImage : 1;
645 bool fAllowSRGBCopyTexSubImage : 1;
646 bool fDisallowDynamicMSAA : 1;
647 bool fMustResetBlendFuncBetweenDualSourceAndDisable : 1;
648 bool fBindTexture0WhenChangingTextureFBOMultisampleCount : 1;
649 bool fRebindColorAttachmentAfterCheckFramebufferStatus : 1;
650 bool fFlushBeforeWritePixels : 1;
651 bool fDisableScalingCopyAsDraws : 1;
652 bool fPadRG88TransferAlignment : 1;
653 int fMaxInstancesPerDrawWithoutCrashing = 0;
657 struct ReadPixelsFormat {
658 ReadPixelsFormat() : fFormat(0), fType(0) {}
664 enum class FormatType {
666 kNormalizedFixedPoint,
671 struct ColorTypeInfo {
674 kUploadData_Flag = 0x1,
677 kRenderable_Flag = 0x2,
704 bool haveQueriedImplementationReadFormat)
const {
705 for (
int i = 0;
i < fExternalIOFormatCount; ++
i) {
706 if (fExternalIOFormats[
i].
fColorType == externalColorType) {
707 if (
usage == kTexImage_ExternalFormatUsage) {
708 return fExternalIOFormats[
i].fExternalTexImageFormat;
711 if (!haveQueriedImplementationReadFormat &&
712 fExternalIOFormats[
i].fRequiresImplementationReadQuery) {
715 return fExternalIOFormats[
i].fExternalReadFormat;
723 for (
int i = 0;
i < fExternalIOFormatCount; ++
i) {
724 if (fExternalIOFormats[
i].
fColorType == externalColorType) {
725 return fExternalIOFormats[
i].fExternalType;
731 std::unique_ptr<ExternalIOFormats[]> fExternalIOFormats;
732 int fExternalIOFormatCount = 0;
737 for (
int i = 0;
i < fColorTypeInfoCount; ++
i) {
739 return fColorTypeInfos[
i].fFlags;
746 ExternalFormatUsage
usage)
const {
747 for (
int i = 0;
i < fColorTypeInfoCount; ++
i) {
748 if (fColorTypeInfos[
i].
fColorType == surfaceColorType) {
749 return fColorTypeInfos[
i].externalFormat(externalColorType,
usage,
750 fHaveQueriedImplementationReadSupport);
757 for (
int i = 0;
i < fColorTypeInfoCount; ++
i) {
758 if (fColorTypeInfos[
i].
fColorType == surfaceColorType) {
759 return fColorTypeInfos[
i].externalType(externalColorType);
766 kTexturable_Flag = 0x01,
769 kFBOColorAttachment_Flag = 0x02,
770 kFBOColorAttachmentWithMSAA_Flag = 0x04,
771 kUseTexStorage_Flag = 0x08,
776 kTransfers_Flag = 0x10,
780 FormatType fFormatType = FormatType::kUnknown;
783 GrGLenum fCompressedInternalFormat = 0;
789 GrGLenum fInternalFormatForTexImageOrStorage = 0;
792 GrGLenum fInternalFormatForRenderbuffer = 0;
797 GrGLenum fDefaultExternalFormat = 0;
803 bool fHaveQueriedImplementationReadSupport =
false;
807 kUnknown_StencilIndex = -1,
809 kUnsupported_StencilFormatIndex = -2
813 int fStencilFormatIndex = kUnknown_StencilIndex;
817 std::unique_ptr<ColorTypeInfo[]> fColorTypeInfos;
818 int fColorTypeInfoCount = 0;
825 return fFormatTable[
static_cast<int>(
format)];
static constexpr int kGrGLColorFormatCount
static const int kGrColorTypeCnt
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
GrCaps(const GrContextOptions &)
bool flushBeforeWritePixels() const
bool skipErrorChecks() const
bool bindUniformLocationSupport() const
uint64_t computeFormatKey(const GrBackendFormat &) const override
DstCopyRestrictions getDstCopyRestrictions(const GrRenderTargetProxy *src, GrColorType) const override
bool isFormatAsColorTypeRenderable(GrColorType ct, const GrBackendFormat &format, int sampleCount=1) const override
void getReadPixelsFormat(GrGLFormat surfaceFormat, GrColorType surfaceColorType, GrColorType memoryColorType, GrGLenum *externalFormat, GrGLenum *externalType) const
@ kNoScalingOrMirroring_BlitFramebufferFlag
@ kResolveMustBeFull_BlitFrambufferFlag
@ kNoSupport_BlitFramebufferFlag
@ kRectsMustMatchForMSAASrc_BlitFramebufferFlag
@ kNoFormatConversion_BlitFramebufferFlag
@ kNoFormatConversionForMSAASrc_BlitFramebufferFlag
@ kNoMSAADst_BlitFramebufferFlag
bool drawRangeElementsSupport() const
Is there support for glDrawRangeElements?
GrGLenum getRenderbufferInternalFormat(GrGLFormat format) const
GrBackendFormat getBackendFormatFromCompressionType(SkTextureCompressionType) const override
bool vertexArrayObjectSupport() const
Is there support for Vertex Array Objects?
bool baseVertexBaseInstanceSupport() const
Are the glDraw*Base(VertexBase)Instance methods, and baseInstance fields in indirect draw.
bool canCopyAsDraw(GrGLFormat dstFormat, bool srcIsTexturable, bool scalingCopy) const
bool samplerObjectSupport() const
@ kES_EXT_MsToTexture_MSFBOType
@ kES_IMG_MsToTexture_MSFBOType
GrGLCaps(const GrContextOptions &contextOptions, const GrGLContextInfo &ctxInfo, const GrGLInterface *glInterface)
bool dontSetBaseOrMaxLevelForExternalTextures() const
bool ES2CompatibilitySupport() const
Is there support for ES2 compatability?
int maxRenderTargetSampleCount(const GrBackendFormat &format) const override
bool useSamplerObjects() const
bool textureUsageSupport() const
Is there support for texture parameter GL_TEXTURE_USAGE.
bool mustResetBlendFuncBetweenDualSourceAndDisable() const
bool imagingSupport() const
Is GL_ARB_IMAGING supported.
bool isCoreProfile() const
void didQueryImplementationReadSupport(GrGLFormat format, GrGLenum readFormat, GrGLenum readType) const
float maxTextureMaxAnisotropy() const
int maxInstancesPerDrawWithoutCrashing(int pendingInstanceCount) const
bool mipmapLodControlSupport() const
Can set the MIN/MAX LOD value.
MSFBOType msFBOType() const
void getTexSubImageExternalFormatAndType(GrGLFormat surfaceFormat, GrColorType surfaceColorType, GrColorType memoryColorType, GrGLenum *externalFormat, GrGLenum *externalType) const
@ kMapBufferRange_MapBufferType
@ kMapBuffer_MapBufferType
@ kChromium_MapBufferType
bool usesMSAARenderBuffers() const
bool drawArraysBaseVertexIsBroken() const
bool requiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines() const
bool usesImplicitMSAAResolve() const
InvalidateFBType invalidateFBType() const
bool rectangleTextureSupport() const
Are textures with GL_TEXTURE_RECTANGLE type supported.
bool hasStencilFormatBeenDeterminedForFormat(GrGLFormat format) const
bool debugSupport() const
Is there support for GL_KHR_debug?
bool bindTexture0WhenChangingTextureFBOMultisampleCount() const
bool clearToBoundaryValuesIsBroken() const
bool doManualMipmapping() const
bool programBinarySupport() const
bool formatSupportsTexStorage(GrGLFormat) const
RegenerateMipmapType regenerateMipmapType() const
How is restricting sampled miplevels in onRegenerateMipmapLevels implemented?
GrGLenum getFormatDefaultExternalType(GrGLFormat format) const
GrProgramDesc makeDesc(GrRenderTarget *, const GrProgramInfo &, ProgramDescOverrideFlags) const override
bool useDrawInsteadOfAllRenderTargetWrites() const
bool fenceSyncSupport() const
bool isFormatSRGB(const GrBackendFormat &) const override
bool neverDisableColorWrites() const
MultiDrawType multiDrawType() const
How are multi draws implemented (if at all)?
bool isFormatCopyable(const GrBackendFormat &) const override
bool rebindColorAttachmentAfterCheckFramebufferStatus() const
bool programBinaryFormatIsValid(GrGLenum binaryFormat) const
SupportedWrite supportedWritePixelsColorType(GrColorType surfaceColorType, const GrBackendFormat &surfaceFormat, GrColorType srcColorType) const override
bool framebufferResolvesMustBeFullSize() const
bool canResolveSingleToMSAA() const
bool disallowTexSubImageForUnormConfigTexturesEverBoundToFBO() const
bool programParameterSupport() const
FenceType fenceType() const
How is GrGLsync implemented?
void getTexSubImageDefaultFormatTypeAndColorType(GrGLFormat format, GrGLenum *externalFormat, GrGLenum *externalType, GrColorType *colorType) const
bool isFormatRenderable(GrGLFormat format, int sampleCount) const
bool textureSwizzleSupport() const
GrGLFormat getFormatFromColorType(GrColorType colorType) const
int getStencilFormatIndexForFormat(GrGLFormat format) const
SurfaceReadPixelsSupport surfaceSupportsReadPixels(const GrSurface *) const override
bool packFlipYSupport() const
Is there support for GL_PACK_REVERSE_ROW_ORDER.
bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const override
bool canFormatBeFBOColorAttachment(GrGLFormat) const
bool canCopyTexSubImage(GrGLFormat dstFormat, bool dstHasMSAARenderBuffer, const GrTextureType *dstTypeIfTexture, GrGLFormat srcFormat, bool srcHasMSAARenderBuffer, const GrTextureType *srcTypeIfTexture) const
bool fbFetchRequiresEnablePerSample() const
void setStencilFormatIndexForFormat(GrGLFormat, int index)
MapBufferType mapBufferType() const
What type of buffer mapping is supported?
bool clearTextureSupport() const
glClearTex(Sub)Image support
bool mipmapLevelControlSupport() const
Can set the BASE and MAX mip map level.
skgpu::Swizzle getWriteSwizzle(const GrBackendFormat &, GrColorType) const override
bool mustSetAnyTexParameterToEnableMipmapping() const
int getRenderTargetSampleCount(int requestedCount, const GrBackendFormat &format) const override
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 tiledRenderingSupport() const
void getTexImageExternalFormatAndType(GrGLFormat surfaceFormat, GrGLenum *externalFormat, GrGLenum *externalType) const
@ kDiscard_InvalidateFBType
@ kInvalidate_InvalidateFBType
int maxFragmentUniformVectors() const
The maximum number of fragment uniform vectors (GLES has min. 16).
bool clientCanDisableMultisample() const
bool shouldQueryImplementationReadSupport(GrGLFormat format) const
bool isFormatTexturable(const GrBackendFormat &, GrTextureType) const override
bool srgbWriteControl() const
InvalidateBufferType invalidateBufferType() const
void onDumpJSON(SkJSONWriter *) const override
TransferBufferType transferBufferType() const
What type of transfer buffer is supported?
bool bindFragDataLocationSupport() const
const skia_private::TArray< GrGLFormat, true > & stencilFormats() const
GrGLenum getTexImageOrStorageInternalFormat(GrGLFormat format) const
uint32_t uint32_t * format
static void usage(char *argv0)