From 5ab7276a35906734b017add5cc37fd8cf477a63b Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Wed, 7 Jun 2017 12:04:18 -0400 Subject: Suppress rendererability of kAlpha8 GL_CHROMIUM_framebuffer_multisample for ANGLE D3D9 For ANGLE D3D9 ES2 we're seeing GL_CHROMIUM_framebuffer_multisample but not GL_ANGLE_framebuffer_multisample. The same occurs for ANGLE D3D11 ES2 but kAlpha8 is renderable in that case. Bug: 730082 Change-Id: I7eda844b0ad48150d19406517d1dfbe453e9e478 Reviewed-on: https://skia-review.googlesource.com/18980 Commit-Queue: Robert Phillips Reviewed-by: Brian Salomon --- src/gpu/gl/GrGLCaps.cpp | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'src/gpu/gl/GrGLCaps.cpp') diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 0f3d7add82..9b8b2c9f5e 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -33,6 +33,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, fPackFlipYSupport = false; fTextureUsageSupport = false; fTextureRedSupport = false; + fAlpha8IsRenderable = false; fImagingSupport = false; fVertexArrayObjectSupport = false; fDirectStateAccessSupport = false; @@ -1042,11 +1043,13 @@ void GrGLCaps::initFSAASupport(const GrContextOptions& contextOptions, const GrG fMSFBOType = kES_IMG_MsToTexture_MSFBOType; } else if (fUsesMixedSamples) { fMSFBOType = kMixedSamples_MSFBOType; - } else if (ctxInfo.version() >= GR_GL_VER(3,0) || - ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { + } else if (ctxInfo.version() >= GR_GL_VER(3,0)) { + fMSFBOType = kStandard_MSFBOType; + fAlpha8IsRenderable = true; + } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { fMSFBOType = kStandard_MSFBOType; } else if (ctxInfo.hasExtension("GL_ANGLE_framebuffer_multisample")) { - fMSFBOType = kEXT_MSFBOType; + fMSFBOType = kStandard_MSFBOType; } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { fMSFBOType = kES_Apple_MSFBOType; } @@ -1055,10 +1058,18 @@ void GrGLCaps::initFSAASupport(const GrContextOptions& contextOptions, const GrG fMSFBOType = kMixedSamples_MSFBOType; } else if (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { + fMSFBOType = kStandard_MSFBOType; + if (!fIsCoreProfile && ctxInfo.renderer() != kOSMesa_GrGLRenderer) { + // Core profile removes ALPHA8 support. + // OpenGL 3.0+ (and GL_ARB_framebuffer_object) supports ALPHA8 as renderable. + // However, osmesa fails if it is used even when GL_ARB_framebuffer_object is + // present. + fAlpha8IsRenderable = true; + } } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { - fMSFBOType = kEXT_MSFBOType; + fMSFBOType = kStandard_MSFBOType; } } @@ -1200,7 +1211,6 @@ SkString GrGLCaps::dump() const { static const char* kMSFBOExtStr[] = { "None", - "EXT", "Standard", "Apple", "IMG MS To Texture", @@ -1208,12 +1218,11 @@ SkString GrGLCaps::dump() const { "MixedSamples", }; GR_STATIC_ASSERT(0 == kNone_MSFBOType); - GR_STATIC_ASSERT(1 == kEXT_MSFBOType); - GR_STATIC_ASSERT(2 == kStandard_MSFBOType); - GR_STATIC_ASSERT(3 == kES_Apple_MSFBOType); - GR_STATIC_ASSERT(4 == kES_IMG_MsToTexture_MSFBOType); - GR_STATIC_ASSERT(5 == kES_EXT_MsToTexture_MSFBOType); - GR_STATIC_ASSERT(6 == kMixedSamples_MSFBOType); + GR_STATIC_ASSERT(1 == kStandard_MSFBOType); + GR_STATIC_ASSERT(2 == kES_Apple_MSFBOType); + GR_STATIC_ASSERT(3 == kES_IMG_MsToTexture_MSFBOType); + GR_STATIC_ASSERT(4 == kES_EXT_MsToTexture_MSFBOType); + GR_STATIC_ASSERT(5 == kMixedSamples_MSFBOType); GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); static const char* kInvalidateFBTypeStr[] = { @@ -1250,6 +1259,7 @@ SkString GrGLCaps::dump() const { r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")); r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); + r.appendf("Alpha8 is renderable: %s\n", (fAlpha8IsRenderable ? "YES" : "NO")); r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO")); @@ -1799,20 +1809,18 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, if (texelBufferSupport) { fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; } + fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags; } else { fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ALPHA; fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_ALPHA8; fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = GR_GL_ALPHA; fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::AAAA(); + if (fAlpha8IsRenderable) { + fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags; + } } - if (this->textureRedSupport() || - (kStandard_MSFBOType == this->msFBOType() && ctxInfo.renderer() != kOSMesa_GrGLRenderer)) { - // OpenGL 3.0+ (and GL_ARB_framebuffer_object) supports ALPHA8 as renderable. - // However, osmesa fails if it is used even when GL_ARB_framebuffer_object is present. - // Core profile removes ALPHA8 support, but we should have chosen R8 in that case. - fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags; - } + // ES2 Command Buffer does not allow TexStorage with R8_EXT (so Alpha_8 and Gray_8) if (texStorageSupported && !isCommandBufferES2) { fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; -- cgit v1.2.3