aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProxyProvider.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-03-09 12:05:04 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-09 18:02:00 +0000
commita8d9211bc3f34fcb3cf331d8fd76e4ea5803fe20 (patch)
tree5e13626cb2fc91f839ecf624953921ee7bf31b1b /src/gpu/GrProxyProvider.cpp
parent33cb22cb2b60255a2755cc88072490fe8d05b0b9 (diff)
Add promise images for deferred instantiation of wrapped gpu textures
This will allow a client to make an SkImage that "wraps" a gpu texture, however the client does need to supply the actual gpu texture at Image creation time. Instead it is retrieve at flush time via a callback. Bug: skia: Change-Id: I6267a55ab7102101a7bd80a6f547b6a870d2df08 Reviewed-on: https://skia-review.googlesource.com/109021 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
Diffstat (limited to 'src/gpu/GrProxyProvider.cpp')
-rw-r--r--src/gpu/GrProxyProvider.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index dbd49a7ac3..7c82544cb1 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -524,6 +524,20 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
GrMipMapped mipMapped,
GrRenderTargetFlags renderTargetFlags,
SkBackingFit fit, SkBudgeted budgeted) {
+ // For non-ddl draws always make lazy proxy's single use.
+ LazyInstantiationType lazyType = fResourceProvider ? LazyInstantiationType::kSingleUse
+ : LazyInstantiationType::kMultipleUse;
+ return this->createLazyProxy(std::move(callback), desc, origin, mipMapped, renderTargetFlags,
+ fit, budgeted, lazyType);
+}
+
+sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
+ const GrSurfaceDesc& desc,
+ GrSurfaceOrigin origin,
+ GrMipMapped mipMapped,
+ GrRenderTargetFlags renderTargetFlags,
+ SkBackingFit fit, SkBudgeted budgeted,
+ LazyInstantiationType lazyType) {
SkASSERT((desc.fWidth <= 0 && desc.fHeight <= 0) ||
(desc.fWidth > 0 && desc.fHeight > 0));
uint32_t flags = GrResourceProvider::kNoPendingIO_Flag;
@@ -539,11 +553,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
}
#endif
- using LazyInstantiationType = GrSurfaceProxy::LazyInstantiationType;
- // For non-ddl draws always make lazy proxy's single use.
- LazyInstantiationType lazyType = fResourceProvider ? LazyInstantiationType::kSingleUse
- : LazyInstantiationType::kMultipleUse;
-
return sk_sp<GrTextureProxy>(
SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags)
? new GrTextureRenderTargetProxy(std::move(callback), lazyType, desc, origin,