aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ProxyTest.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 /tests/ProxyTest.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 'tests/ProxyTest.cpp')
-rw-r--r--tests/ProxyTest.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index edf54f6113..01c881c90b 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -12,6 +12,7 @@
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
+#include "GrContextPriv.h"
#include "GrRenderTargetPriv.h"
#include "GrRenderTargetProxy.h"
#include "GrResourceProvider.h"
@@ -109,7 +110,8 @@ static void check_texture(skiatest::Reporter* reporter,
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
- GrResourceProvider* provider = ctxInfo.grContext()->resourceProvider();
+ GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
+ GrResourceProvider* resourceProvider = ctxInfo.grContext()->resourceProvider();
const GrCaps& caps = *ctxInfo.grContext()->caps();
const GrGpuResource::UniqueID kInvalidResourceID = GrGpuResource::UniqueID::InvalidID();
@@ -134,13 +136,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
{
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
- tex = provider->createApproxTexture(desc, 0);
+ tex = resourceProvider->createApproxTexture(desc, 0);
} else {
- tex = provider->createTexture(desc, budgeted);
+ tex = resourceProvider->createTexture(desc, budgeted);
}
sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(
- provider, desc,
+ proxyProvider, desc,
fit, budgeted));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
@@ -156,7 +158,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
widthHeight, widthHeight, config,
kInvalidResourceID, budgeted);
int supportedSamples = caps.getSampleCount(numSamples, config);
- check_rendertarget(reporter, caps, provider,
+ check_rendertarget(reporter, caps, resourceProvider,
proxy->asRenderTargetProxy(),
supportedSamples,
fit, caps.maxWindowRectangles(), false);
@@ -168,29 +170,30 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
{
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
- tex = provider->createApproxTexture(desc, 0);
+ tex = resourceProvider->createApproxTexture(desc, 0);
} else {
- tex = provider->createTexture(desc, budgeted);
+ tex = resourceProvider->createTexture(desc, budgeted);
}
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(provider,
- desc,
- fit,
- budgeted));
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(
+ proxyProvider,
+ desc,
+ fit,
+ budgeted));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
- // This forces the proxy to compute and cache its pre-instantiation
- // size guess. Later, when it is actually instantiated, it checks
- // that the instantiated size is <= to the pre-computation.
- // If the proxy never computed its pre-instantiation size then the
- // check is skipped.
+ // This forces the proxy to compute and cache its
+ // pre-instantiation size guess. Later, when it is actually
+ // instantiated, it checks that the instantiated size is <= to
+ // the pre-computation. If the proxy never computed its
+ // pre-instantiation size then the check is skipped.
proxy->gpuMemorySize();
check_surface(reporter, proxy.get(), origin,
widthHeight, widthHeight, config,
kInvalidResourceID, budgeted);
- check_texture(reporter, provider, proxy->asTextureProxy(),
- fit, false);
+ check_texture(reporter, resourceProvider,
+ proxy->asTextureProxy(), fit, false);
}
}
@@ -281,7 +284,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
- GrResourceProvider* provider = ctxInfo.grContext()->resourceProvider();
+ GrProxyProvider* provider = ctxInfo.grContext()->contextPriv().proxyProvider();
for (auto flags : { kRenderTarget_GrSurfaceFlag, kNone_GrSurfaceFlags }) {
for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {