Funnel most proxy creation through GrProxyProvider
This is to provide a choke point for DDL to create Lazy Proxies.
Change-Id: If178da13bc6447b31b7601810236d34502d9efbd
Reviewed-on: https://skia-review.googlesource.com/93303
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index 404e020..1150c79 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -17,6 +17,7 @@
class GrCaps;
class GrResourceProvider;
class GrSingleOwner;
+class GrBackendRenderTarget;
/*
* A factory for creating GrSurfaceProxy-derived objects.
@@ -57,16 +58,75 @@
sk_sp<GrTextureProxy> findOrCreateProxyByUniqueKey(const GrUniqueKey&, GrSurfaceOrigin);
/*
- * Create an un-mipmapped texture proxy with data.
+ * Create a texture proxy that is backed by an instantiated GrSurface. This is almost entirely
+ * used by Skia's testing code.
+ * DDL TODO: remove the remaining Skia-internal use of this method and make it truly
+ * testing-only.
*/
- sk_sp<GrTextureProxy> createTextureProxy(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel&);
+ sk_sp<GrTextureProxy> createInstantiatedProxy(const GrSurfaceDesc&, SkBackingFit, SkBudgeted,
+ uint32_t flags = 0);
+
+ /*
+ * Create an un-mipmapped texture proxy with data.
+ * DDL TODO: need to refine ownership semantics of 'srcData' if we're in completely
+ * deferred mode
+ */
+ sk_sp<GrTextureProxy> createTextureProxy(const GrSurfaceDesc&, SkBudgeted,
+ const void* srcData, size_t rowBytes);
/*
* Create a mipmapped texture proxy with data.
+ *
+ * @param desc Description of the texture properties.
+ * @param budgeted Does the texture count against the resource cache budget?
+ * @param texels A contiguous array of mipmap levels
+ * @param mipLevelCount The amount of elements in the texels array
*/
- sk_sp<GrTextureProxy> createTextureProxy(const GrSurfaceDesc&, SkBudgeted,
- const GrMipLevel texels[], int mipLevelCount,
- SkDestinationSurfaceColorMode mipColorMode);
+ sk_sp<GrTextureProxy> createMipMapProxy(const GrSurfaceDesc&, SkBudgeted,
+ const GrMipLevel texels[], int mipLevelCount,
+ SkDestinationSurfaceColorMode mipColorMode =
+ SkDestinationSurfaceColorMode::kLegacy);
+
+
+ /*
+ * Create a mipmapped texture proxy without any data.
+ *
+ * Like the call above but there are no texels to upload. A texture proxy is returned that
+ * simply has space allocated for the mips. We will allocated the full amount of mip levels
+ * based on the width and height in the GrSurfaceDesc.
+ */
+ sk_sp<GrTextureProxy> createMipMapProxy(const GrSurfaceDesc&, SkBudgeted);
+
+ /*
+ * Create a GrSurfaceProxy without any data.
+ */
+ sk_sp<GrTextureProxy> createProxy(const GrSurfaceDesc&, SkBackingFit, SkBudgeted,
+ uint32_t flags = 0);
+
+ /*
+ * Create a texture proxy that wraps a (non-renderable) backend texture.
+ */
+ sk_sp<GrTextureProxy> createWrappedTextureProxy(const GrBackendTexture&, GrSurfaceOrigin);
+
+ /*
+ * Create a texture proxy that wraps a backend texture and is both texture-able and renderable
+ */
+ sk_sp<GrTextureProxy> createWrappedTextureProxy(const GrBackendTexture&,
+ GrSurfaceOrigin,
+ int sampleCnt);
+
+ /*
+ * Create a render target proxy that wraps a backend rendertarget
+ */
+ sk_sp<GrSurfaceProxy> createWrappedRenderTargetProxy(const GrBackendRenderTarget&,
+ GrSurfaceOrigin);
+
+ /*
+ * Create a render target proxy that wraps a backend texture?
+ */
+ sk_sp<GrSurfaceProxy> createWrappedRenderTargetProxy(const GrBackendTexture& tex,
+ GrSurfaceOrigin origin,
+ int sampleCnt);
// 'proxy' is about to be used as a texture src or drawn to. This query can be used to
// determine if it is going to need a texture domain or a full clear.