aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp32
-rw-r--r--src/gpu/gl/GrGLCaps.h3
-rw-r--r--src/gpu/gl/GrGLGpu.cpp19
3 files changed, 45 insertions, 9 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 2ec95347f8..1a41a5b686 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -1018,6 +1018,7 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
// is available.
if (ctxInfo.version() >= GR_GL_VER(3, 0)) {
fBlitFramebufferFlags = kNoFormatConversionForMSAASrc_BlitFramebufferFlag |
+ kNoMSAADst_BlitFramebufferFlag |
kRectsMustMatchForMSAASrc_BlitFramebufferFlag;
} else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample") ||
ctxInfo.hasExtension("GL_ANGLE_framebuffer_blit")) {
@@ -1026,7 +1027,8 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fBlitFramebufferFlags = kNoScalingOrMirroring_BlitFramebufferFlag |
kResolveMustBeFull_BlitFrambufferFlag |
kNoMSAADst_BlitFramebufferFlag |
- kNoFormatConversion_BlitFramebufferFlag;
+ kNoFormatConversion_BlitFramebufferFlag |
+ kRectsMustMatchForMSAASrc_BlitFramebufferFlag;
}
} else {
if (fUsesMixedSamples) {
@@ -2068,7 +2070,14 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
#endif
}
-bool GrGLCaps::initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* desc) const {
+bool GrGLCaps::initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* desc,
+ bool* rectsMustMatch, bool* disallowSubrect) const {
+ // By default, we don't require rects to match.
+ *rectsMustMatch = false;
+
+ // By default, we allow subrects.
+ *disallowSubrect = false;
+
// If the src is a texture, we can implement the blit as a draw assuming the config is
// renderable.
if (src->asTexture() && this->isConfigRenderable(src->config(), false)) {
@@ -2089,7 +2098,20 @@ bool GrGLCaps::initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* desc
// texture. This code prefers CopyTexSubImage to fbo blit and avoids triggering temporary fbo
// creation. It isn't clear that avoiding temporary fbo creation is actually optimal.
GrSurfaceOrigin originForBlitFramebuffer = kDefault_GrSurfaceOrigin;
- if (this->blitFramebufferSupportFlags() & kNoScalingOrMirroring_BlitFramebufferFlag) {
+ bool rectsMustMatchForBlitFramebuffer = false;
+ bool disallowSubrectForBlitFramebuffer = false;
+ if (src->numColorSamples() &&
+ (this->blitFramebufferSupportFlags() & kResolveMustBeFull_BlitFrambufferFlag)) {
+ rectsMustMatchForBlitFramebuffer = true;
+ disallowSubrectForBlitFramebuffer = true;
+ // Mirroring causes rects to mismatch later, don't allow it.
+ originForBlitFramebuffer = src->origin();
+ } else if (src->numColorSamples() && (this->blitFramebufferSupportFlags() &
+ kRectsMustMatchForMSAASrc_BlitFramebufferFlag)) {
+ rectsMustMatchForBlitFramebuffer = true;
+ // Mirroring causes rects to mismatch later, don't allow it.
+ originForBlitFramebuffer = src->origin();
+ } else if (this->blitFramebufferSupportFlags() & kNoScalingOrMirroring_BlitFramebufferFlag) {
originForBlitFramebuffer = src->origin();
}
@@ -2100,6 +2122,8 @@ bool GrGLCaps::initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* desc
if (this->canConfigBeFBOColorAttachment(kBGRA_8888_GrPixelConfig)) {
desc->fOrigin = originForBlitFramebuffer;
desc->fConfig = kBGRA_8888_GrPixelConfig;
+ *rectsMustMatch = rectsMustMatchForBlitFramebuffer;
+ *disallowSubrect = disallowSubrectForBlitFramebuffer;
return true;
}
return false;
@@ -2112,6 +2136,8 @@ bool GrGLCaps::initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* desc
if (this->canConfigBeFBOColorAttachment(src->config())) {
desc->fOrigin = originForBlitFramebuffer;
desc->fConfig = src->config();
+ *rectsMustMatch = rectsMustMatchForBlitFramebuffer;
+ *disallowSubrect = disallowSubrectForBlitFramebuffer;
return true;
}
return false;
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index a659435784..b8c4745a50 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -359,7 +359,8 @@ public:
return fRGBAToBGRAReadbackConversionsAreSlow;
}
- bool initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* desc) const override;
+ bool initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* desc, bool* rectsMustMatch,
+ bool* disallowSubrect) const override;
private:
enum ExternalFormatUsage {
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 6cdda0672a..3af3ed25aa 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3344,8 +3344,13 @@ static inline bool can_blit_framebuffer_for_copy_surface(const GrSurface* dst,
}
}
if (GrGLCaps::kResolveMustBeFull_BlitFrambufferFlag & blitFramebufferFlags) {
- if (srcRT && srcRT->numColorSamples() && dstRT && !dstRT->numColorSamples()) {
- return false;
+ if (srcRT && srcRT->numColorSamples()) {
+ if (dstRT && !dstRT->numColorSamples()) {
+ return false;
+ }
+ if (SkRect::Make(srcRect) != srcRT->getBoundsRect()) {
+ return false;
+ }
}
}
if (GrGLCaps::kNoMSAADst_BlitFramebufferFlag & blitFramebufferFlags) {
@@ -3364,9 +3369,13 @@ static inline bool can_blit_framebuffer_for_copy_surface(const GrSurface* dst,
}
}
if (GrGLCaps::kRectsMustMatchForMSAASrc_BlitFramebufferFlag & blitFramebufferFlags) {
- if (srcRT && srcRT->numColorSamples() &&
- (dstPoint.fX != srcRect.fLeft || dstPoint.fY != srcRect.fTop)) {
- return false;
+ if (srcRT && srcRT->numColorSamples()) {
+ if (dstPoint.fX != srcRect.fLeft || dstPoint.fY != srcRect.fTop) {
+ return false;
+ }
+ if (dst->origin() != src->origin()) {
+ return false;
+ }
}
}
return true;