aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mtl/GrMtlCaps.mm
diff options
context:
space:
mode:
authorGravatar Timothy Liang <timliang@google.com>2018-07-31 10:51:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-31 16:25:55 +0000
commite30739a1e1d90183bc6bf7414e409e89016881f5 (patch)
tree4b84aeadee82fde5b45ec75aa1782897e2c9625f /src/gpu/mtl/GrMtlCaps.mm
parentc8ece3d5f877d67114dfda51a336dfdf7838095a (diff)
implemented copy surface as draw for metal gpu backend
Bug: skia: Change-Id: Ie61bd6ad9f288b8a025d44f887a0954101a7d710 Reviewed-on: https://skia-review.googlesource.com/142687 Commit-Queue: Timothy Liang <timliang@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/mtl/GrMtlCaps.mm')
-rw-r--r--src/gpu/mtl/GrMtlCaps.mm18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm
index 3093352272..dc70d28e2a 100644
--- a/src/gpu/mtl/GrMtlCaps.mm
+++ b/src/gpu/mtl/GrMtlCaps.mm
@@ -129,6 +129,20 @@ bool GrMtlCaps::canCopyAsBlit(GrPixelConfig dstConfig, int dstSampleCount,
return true;
}
+bool GrMtlCaps::canCopyAsDraw(GrPixelConfig dstConfig, bool dstIsRenderable,
+ GrPixelConfig srcConfig, bool srcIsTextureable) const {
+ // TODO: Make copySurfaceAsDraw handle the swizzle
+ if (this->shaderCaps()->configOutputSwizzle(srcConfig) !=
+ this->shaderCaps()->configOutputSwizzle(dstConfig)) {
+ return false;
+ }
+
+ if (!dstIsRenderable || !srcIsTextureable) {
+ return false;
+ }
+ return true;
+}
+
bool GrMtlCaps::canCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIPoint& dstPoint) const {
GrSurfaceOrigin dstOrigin = dst->origin();
@@ -147,7 +161,9 @@ bool GrMtlCaps::canCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy*
return this->canCopyAsBlit(dst->config(), dstSampleCnt, dstOrigin,
src->config(), srcSampleCnt, srcOrigin,
- srcRect, dstPoint, dst == src);
+ srcRect, dstPoint, dst == src) ||
+ this->canCopyAsDraw(dst->config(), SkToBool(dst->asRenderTargetProxy()),
+ src->config(), SkToBool(src->asTextureProxy()));
}
void GrMtlCaps::initGrCaps(const id<MTLDevice> device) {