diff options
author | Robert Phillips <robertphillips@google.com> | 2018-01-16 08:06:32 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-16 13:28:43 +0000 |
commit | 0bd24dc41f2351d84f5fce32130668a5792d134b (patch) | |
tree | c46dc6fb7636fd7c2185e1f855f1dd582512fcc4 /src/gpu/GrProxyProvider.h | |
parent | 3167aa0c9c84cab1b0252031166e4a345e2afe2d (diff) |
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>
Diffstat (limited to 'src/gpu/GrProxyProvider.h')
-rw-r--r-- | src/gpu/GrProxyProvider.h | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h index 404e020b43..1150c794a6 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 @@ public: sk_sp<GrTextureProxy> findOrCreateProxyByUniqueKey(const GrUniqueKey&, GrSurfaceOrigin); /* + * 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> 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 GrMipLevel&); + 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. |