aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-09-29 15:58:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-29 20:19:14 +0000
commitbb76ace72bee5d44189b6ee6c81cda174ce9ea30 (patch)
tree679a7724b6b8361fd0e29293cb362d3db10cb9ff /src/gpu
parent4b85b6dd5a7296f4543b226a534c76ef6f438e55 (diff)
Fall back to non mipped Texture when we can't copy base to mipped texture
TBR: bsalomon@google.com Bug: skia:7094 Change-Id: I9d2ba78c4d4332a22e2357cde0598de51299067d Reviewed-on: https://skia-review.googlesource.com/53541 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrBitmapTextureMaker.cpp6
-rw-r--r--src/gpu/SkGr.cpp4
-rw-r--r--src/gpu/gl/GrGLCaps.h9
-rw-r--r--src/gpu/mock/GrMockCaps.h4
-rw-r--r--src/gpu/mtl/GrMtlCaps.h4
-rw-r--r--src/gpu/vk/GrVkCaps.h4
6 files changed, 31 insertions, 0 deletions
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp
index 00dd48d0a9..ab8ee249a9 100644
--- a/src/gpu/GrBitmapTextureMaker.cpp
+++ b/src/gpu/GrBitmapTextureMaker.cpp
@@ -55,6 +55,12 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM
} else {
proxy = GrCopyBaseMipMapToTextureProxy(this->context(), originalProxy.get(),
dstColorSpace);
+ if (!proxy) {
+ // We failed to make a mipped proxy with the base copied into it. This could have
+ // been from failure to make the proxy or failure to do the copy. Thus we will fall
+ // back to just using the non mipped proxy; See skbug.com/7094.
+ return originalProxy;
+ }
}
}
if (!proxy) {
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index e26de49e36..8035027732 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -223,6 +223,10 @@ sk_sp<GrTextureProxy> GrCopyBaseMipMapToTextureProxy(GrContext* ctx,
SkColorSpace* dstColorSpace) {
SkASSERT(baseProxy);
+ if (!ctx->caps()->isConfigCopyable(baseProxy->config())) {
+ return nullptr;
+ }
+
SkDestinationSurfaceColorMode colorMode = dstColorSpace
? SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware
: SkDestinationSurfaceColorMode::kLegacy;
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 1ce6094a6b..68cbc9bf16 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -125,6 +125,15 @@ public:
return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderable_Flag);
}
}
+
+ bool isConfigCopyable(GrPixelConfig config) const override {
+ // In GL we have three ways to be able to copy. CopyTexImage, blit, and draw. CopyTexImage
+ // requires the src to be an FBO attachment, blit requires both src and dst to be FBO
+ // attachments, and draw requires the dst to be an FBO attachment. Thus to copy from and to
+ // the same config, we need that config to be renderable so we can attach it to an FBO.
+ return this->isConfigRenderable(config, false);
+ }
+
bool canConfigBeImageStorage(GrPixelConfig config) const override {
return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kCanUseAsImageStorage_Flag);
}
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index b1d9a84bcf..90cc8243cc 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -31,6 +31,10 @@ public:
bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override {
return fOptions.fConfigOptions[config].fRenderable[withMSAA];
}
+ bool isConfigCopyable(GrPixelConfig config) const override {
+ return false;
+ }
+
bool canConfigBeImageStorage(GrPixelConfig) const override { return false; }
bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
bool* rectsMustMatch, bool* disallowSubrect) const override {
diff --git a/src/gpu/mtl/GrMtlCaps.h b/src/gpu/mtl/GrMtlCaps.h
index 9590bb9e12..b793159ad5 100644
--- a/src/gpu/mtl/GrMtlCaps.h
+++ b/src/gpu/mtl/GrMtlCaps.h
@@ -39,6 +39,10 @@ public:
}
}
+ bool isConfigCopyable(GrPixelConfig config) const override {
+ return true;
+ }
+
bool canConfigBeImageStorage(GrPixelConfig) const override { return false; }
#if 0
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
index 0161bf7e37..ad514953b9 100644
--- a/src/gpu/vk/GrVkCaps.h
+++ b/src/gpu/vk/GrVkCaps.h
@@ -39,6 +39,10 @@ public:
return SkToBool(ConfigInfo::kRenderable_Flag & fConfigTable[config].fOptimalFlags);
}
+ bool isConfigCopyable(GrPixelConfig config) const override {
+ return true;
+ }
+
bool canConfigBeImageStorage(GrPixelConfig) const override { return false; }
bool isConfigTexturableLinearly(GrPixelConfig config) const {