diff options
author | Brian Salomon <bsalomon@google.com> | 2016-10-14 11:30:51 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-14 20:40:37 +0000 |
commit | 00731b42bcd89b98ef01b5aad3bbe51cb7018c9c (patch) | |
tree | 52e1d3b2433363658976784bfafd5d6f25e6bc0e /src | |
parent | f61abec29934484f59b0348d92b15c89e202202f (diff) |
Capture ES3 MSAA blit restrictions using BlitFramebufferSupport not MSFBOType.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3416
Change-Id: I2baeb954bceb9d92e43e585320ae5fda1b996641
Reviewed-on: https://skia-review.googlesource.com/3416
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 38 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 17 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 22 |
3 files changed, 37 insertions, 40 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 7d1bea37d6..c2e8f11b3b 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -930,12 +930,9 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa fMSFBOType = kES_IMG_MsToTexture_MSFBOType; } else if (fUsesMixedSamples) { fMSFBOType = kMixedSamples_MSFBOType; - } else if (ctxInfo.version() >= GR_GL_VER(3,0)) { - fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; - } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { - // chrome's extension is equivalent to the EXT msaa - // and fbo_blit extensions. - fMSFBOType = kDesktop_EXT_MSFBOType; + } else if (ctxInfo.version() >= GR_GL_VER(3,0) || + ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { + fMSFBOType = kStandard_MSFBOType; } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { fMSFBOType = kES_Apple_MSFBOType; } @@ -953,13 +950,13 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa if (fUsesMixedSamples) { fMSFBOType = kMixedSamples_MSFBOType; fBlitFramebufferSupport = kFull_BlitFramebufferSupport; - } else if ((ctxInfo.version() >= GR_GL_VER(3,0)) || - ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { - fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; + } else if (ctxInfo.version() >= GR_GL_VER(3,0) || + ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { + fMSFBOType = kStandard_MSFBOType; fBlitFramebufferSupport = kFull_BlitFramebufferSupport; } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { - fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; + fMSFBOType = kEXT_MSFBOType; fBlitFramebufferSupport = kFull_BlitFramebufferSupport; } } @@ -1082,22 +1079,20 @@ SkString GrGLCaps::dump() const { static const char* kMSFBOExtStr[] = { "None", - "ARB", "EXT", - "ES 3.0", + "Standard", "Apple", "IMG MS To Texture", "EXT MS To Texture", "MixedSamples", }; GR_STATIC_ASSERT(0 == kNone_MSFBOType); - GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); - GR_STATIC_ASSERT(2 == kDesktop_EXT_MSFBOType); - GR_STATIC_ASSERT(3 == kES_3_0_MSFBOType); - GR_STATIC_ASSERT(4 == kES_Apple_MSFBOType); - GR_STATIC_ASSERT(5 == kES_IMG_MsToTexture_MSFBOType); - GR_STATIC_ASSERT(6 == kES_EXT_MsToTexture_MSFBOType); - GR_STATIC_ASSERT(7 == kMixedSamples_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(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); static const char* kInvalidateFBTypeStr[] = { @@ -1635,9 +1630,8 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa fConfigTable[kAlpha_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType; fConfigTable[kAlpha_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; if (this->textureRedSupport() || - (kDesktop_ARB_MSFBOType == this->msFBOType() && - ctxInfo.renderer() != kOSMesa_GrGLRenderer)) { - // desktop ARB extension/3.0+ supports ALPHA8 as renderable. + (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 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; diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index f0b09407aa..e162b38b9c 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -42,17 +42,13 @@ public: */ kNone_MSFBOType = 0, /** - * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object). + * OpenGL < 3.0 with GL_EXT_framebuffer_object. Doesn't allow rendering to ALPHA. */ - kDesktop_ARB_MSFBOType, + kEXT_MSFBOType, /** - * earlier GL_EXT_framebuffer* extensions + * OpenGL 3.0+, OpenGL ES 3.0+, and GL_ARB_framebuffer_object. */ - kDesktop_EXT_MSFBOType, - /** - * Similar to kDesktop_ARB but with additional restrictions on glBlitFramebuffer. - */ - kES_3_0_MSFBOType, + kStandard_MSFBOType, /** * GL_APPLE_framebuffer_multisample ES extension */ @@ -84,6 +80,11 @@ public: * or mirroring. */ kNoScalingNoMirroring_BlitFramebufferSupport, + /** + * ES3 has restricted support when the src is MSAA: src rect == dst rect, dst format == src + * format. + */ + kRectsAndFormatsMatchForMSAASrc_BlitFramebufferSupport, kFull_BlitFramebufferSupport }; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 56f01ed018..eae0aa9963 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -1472,10 +1472,9 @@ static bool renderbuffer_storage_msaa(const GrGLContext& ctx, CLEAR_ERROR_BEFORE_ALLOC(ctx.interface()); SkASSERT(GrGLCaps::kNone_MSFBOType != ctx.caps()->msFBOType()); switch (ctx.caps()->msFBOType()) { - case GrGLCaps::kDesktop_ARB_MSFBOType: - case GrGLCaps::kDesktop_EXT_MSFBOType: + case GrGLCaps::kEXT_MSFBOType: + case GrGLCaps::kStandard_MSFBOType: case GrGLCaps::kMixedSamples_MSFBOType: - case GrGLCaps::kES_3_0_MSFBOType: GL_ALLOC_CALL(ctx.interface(), RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, sampleCount, @@ -3488,14 +3487,17 @@ static inline bool can_blit_framebuffer(const GrSurface* dst, return false; } break; - case GrGLCaps::kFull_BlitFramebufferSupport: + // ES3 doesn't allow framebuffer blits when the src has MSAA and the configs don't + // match or the rects are not the same (not just the same size but have the same + // edges). + case GrGLCaps::kRectsAndFormatsMatchForMSAASrc_BlitFramebufferSupport: + if ((src->desc().fSampleCnt > 0 || src->config() != dst->config())) { + return false; + } break; - } - // ES3 doesn't allow framebuffer blits when the src has MSAA and the configs don't match - // or the rects are not the same (not just the same size but have the same edges). - if (GrGLCaps::kES_3_0_MSFBOType == gpu->glCaps().msFBOType() && - (src->desc().fSampleCnt > 0 || src->config() != dst->config())) { - return false; + + case GrGLCaps::kFull_BlitFramebufferSupport: + return true; } const GrGLTexture* dstTex = static_cast<const GrGLTexture*>(dst->asTexture()); if (dstTex && dstTex->target() != GR_GL_TEXTURE_2D) { |