aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-01-19 10:31:56 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-19 16:07:43 +0000
commita9c8a05608fe32520a0899016fc28bb1f5ead355 (patch)
tree58a512e3ed8c0df4a2757b2e6cb904e8ce105f1c /src
parent5a0f3455320f5591c196844ff8a89b71a7d9aa56 (diff)
Be more explicit checking for render targets with MSAA render buffers
Previously, wrapping a non-0 FBO would always cause us to think it was MSAA, causing it to be un-copyable. Fixes https://github.com/flutter/flutter/issues/10284 Bug: skia:7412 Change-Id: If9c0f306ad8c0c3e23dee793a541a6852737f7d9 Reviewed-on: https://skia-review.googlesource.com/97100 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gl/GrGLGpu.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index fb82a54448..179391f3d9 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3367,6 +3367,14 @@ static inline bool can_blit_framebuffer_for_copy_surface(
return true;
}
+static bool rt_has_msaa_render_buffer(const GrGLRenderTarget* rt, const GrGLCaps& glCaps) {
+ // A RT has a separate MSAA renderbuffer if:
+ // 1) It's multisampled
+ // 2) We're using an extension with separate MSAA renderbuffers
+ // 3) It's not FBO 0, which is special and always auto-resolves
+ return rt->numColorSamples() > 0 && glCaps.usesMSAARenderBuffers() && rt->renderFBOID() != 0;
+}
+
static inline bool can_copy_texsubimage(const GrSurface* dst, GrSurfaceOrigin dstOrigin,
const GrSurface* src, GrSurfaceOrigin srcOrigin,
const GrGLGpu* gpu) {
@@ -3380,13 +3388,13 @@ static inline bool can_copy_texsubimage(const GrSurface* dst, GrSurfaceOrigin ds
const GrGLRenderTarget* dstRT = static_cast<const GrGLRenderTarget*>(dst->asRenderTarget());
// If dst is multisampled (and uses an extension where there is a separate MSAA renderbuffer)
// then we don't want to copy to the texture but to the MSAA buffer.
- if (dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) {
+ if (dstRT && rt_has_msaa_render_buffer(dstRT, gpu->glCaps())) {
return false;
}
const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->asRenderTarget());
// If the src is multisampled (and uses an extension where there is a separate MSAA
// renderbuffer) then it is an invalid operation to call CopyTexSubImage
- if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) {
+ if (srcRT && rt_has_msaa_render_buffer(srcRT, gpu->glCaps())) {
return false;
}