aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSurfaceProxy.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-01-08 13:40:32 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-08 19:05:31 +0000
commit1afd4cdb0800e2e395b465da24eb71e0e834dafa (patch)
treed3353e7e4487a86d00002ab882f34ec24347000b /src/gpu/GrSurfaceProxy.cpp
parent5ec5d677b02c41a3c58609461cd8b62c2feaeddc (diff)
Add GrProxyProvider
This pulls all the proxy tracking & creation functionality out of the GrResourceCache and GrResourceProvider and consolidates it in the GrProxyProvider. Change-Id: I7256f7c544319a70c1bd93dd5a9ccbe5fa0a544f Reviewed-on: https://skia-review.googlesource.com/91501 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrSurfaceProxy.cpp')
-rw-r--r--src/gpu/GrSurfaceProxy.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 8dd43deace..1090d0d74e 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -13,7 +13,7 @@
#include "GrContextPriv.h"
#include "GrGpuResourcePriv.h"
#include "GrOpList.h"
-#include "GrResourceProvider.h"
+#include "GrProxyProvider.h"
#include "GrSurfaceContext.h"
#include "GrTexturePriv.h"
#include "GrTextureRenderTargetProxy.h"
@@ -202,7 +202,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrSurface> surf, GrSurfa
if (surf->getUniqueKey().isValid()) {
// The proxy may already be in the hash. Thus we need to look for it first before creating
// new one.
- GrResourceProvider* provider = surf->getContext()->resourceProvider();
+ GrProxyProvider* provider = surf->getContext()->contextPriv().proxyProvider();
sk_sp<GrSurfaceProxy> proxy = provider->findProxyByUniqueKey(surf->getUniqueKey(), origin);
if (proxy) {
return proxy;
@@ -231,7 +231,7 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex, GrSurfac
if (tex->getUniqueKey().isValid()) {
// The proxy may already be in the hash. Thus we need to look for it first before creating
// new one.
- GrResourceProvider* provider = tex->getContext()->resourceProvider();
+ GrProxyProvider* provider = tex->getContext()->contextPriv().proxyProvider();
sk_sp<GrTextureProxy> proxy = provider->findProxyByUniqueKey(tex->getUniqueKey(), origin);
if (proxy) {
return proxy;
@@ -245,14 +245,14 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex, GrSurfac
}
}
-sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceProvider,
+sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrProxyProvider* proxyProvider,
const GrSurfaceDesc& desc,
SkBackingFit fit,
SkBudgeted budgeted,
uint32_t flags) {
SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags);
- const GrCaps* caps = resourceProvider->caps();
+ const GrCaps* caps = proxyProvider->caps();
// TODO: move this logic into GrResourceProvider!
// TODO: share this testing code with check_texture_creation_params
@@ -311,7 +311,7 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceP
#endif
}
-sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceProvider,
+sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrProxyProvider* proxyProvider,
const GrSurfaceDesc& desc,
SkBudgeted budgeted,
const void* srcData,
@@ -319,13 +319,13 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceP
if (srcData) {
GrMipLevel mipLevel = { srcData, rowBytes };
- return resourceProvider->createTextureProxy(desc, budgeted, mipLevel);
+ return proxyProvider->createTextureProxy(desc, budgeted, mipLevel);
}
- return GrSurfaceProxy::MakeDeferred(resourceProvider, desc, SkBackingFit::kExact, budgeted);
+ return GrSurfaceProxy::MakeDeferred(proxyProvider, desc, SkBackingFit::kExact, budgeted);
}
-sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(GrResourceProvider* resourceProvider,
+sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(GrProxyProvider* proxyProvider,
const GrSurfaceDesc& desc,
SkBudgeted budgeted) {
// SkMipMap doesn't include the base level in the level count so we have to add 1
@@ -339,11 +339,11 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(GrResourceProvider* res
texels[i].fRowBytes = 0;
}
- return MakeDeferredMipMap(resourceProvider, desc, budgeted, texels.get(), mipCount);
+ return MakeDeferredMipMap(proxyProvider, desc, budgeted, texels.get(), mipCount);
}
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(
- GrResourceProvider* resourceProvider,
+ GrProxyProvider* proxyProvider,
const GrSurfaceDesc& desc,
SkBudgeted budgeted,
const GrMipLevel texels[],
@@ -353,14 +353,14 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(
if (texels) {
return nullptr;
}
- return GrSurfaceProxy::MakeDeferred(resourceProvider, desc, budgeted, nullptr, 0);
+ return GrSurfaceProxy::MakeDeferred(proxyProvider, desc, budgeted, nullptr, 0);
}
if (!texels) {
return nullptr;
}
if (1 == mipLevelCount) {
- return resourceProvider->createTextureProxy(desc, budgeted, texels[0]);
+ return proxyProvider->createTextureProxy(desc, budgeted, texels[0]);
}
#ifdef SK_DEBUG
@@ -381,14 +381,7 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(
SkASSERT((firstLevelHasData && allOtherLevelsHaveData) || allOtherLevelsLackData);
#endif
- sk_sp<GrTexture> tex(resourceProvider->createTexture(desc, budgeted,
- texels, mipLevelCount,
- mipColorMode));
- if (!tex) {
- return nullptr;
- }
-
- return GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
+ return proxyProvider->createTextureProxy(desc, budgeted, texels, mipLevelCount, mipColorMode);
}
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,