aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-01-16 15:07:54 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-16 20:53:28 +0000
commit6be756b673b823881e90a2ef68c12b640ddde549 (patch)
treef7e09cae44e5d5b3faddef00d9250962eec0e05a /tests
parent1ea485fd56a977b4e84b4e82039e8f2487813c1e (diff)
Move resourceProvider accessor to GrContextPriv (take 2)
TBR=bsalomon@google.com Change-Id: I3fd46ebfad0d04b8a2bfa6190f81308f3a6be620 Reviewed-on: https://skia-review.googlesource.com/95121 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/BlendTest.cpp4
-rw-r--r--tests/ClipStackTest.cpp4
-rw-r--r--tests/GrMipMappedTest.cpp6
-rw-r--r--tests/GrPipelineDynamicStateTest.cpp2
-rw-r--r--tests/GrSurfaceTest.cpp12
-rw-r--r--tests/ImageFilterCacheTest.cpp2
-rw-r--r--tests/IntTextureTest.cpp5
-rw-r--r--tests/PathRendererCacheTests.cpp2
-rw-r--r--tests/ProcessorTest.cpp10
-rw-r--r--tests/ProxyRefTest.cpp2
-rw-r--r--tests/ProxyTest.cpp12
-rw-r--r--tests/ResourceAllocatorTest.cpp2
-rw-r--r--tests/ResourceCacheTest.cpp32
-rw-r--r--tests/SurfaceTest.cpp5
-rw-r--r--tests/TextureProxyTest.cpp16
-rwxr-xr-xtests/TransferPixelsTest.cpp12
-rw-r--r--tests/WritePixelsTest.cpp2
17 files changed, 74 insertions, 56 deletions
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp
index bf985aa2ae..b17b9f1e45 100644
--- a/tests/BlendTest.cpp
+++ b/tests/BlendTest.cpp
@@ -95,7 +95,9 @@ static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
backingDesc.fConfig = config;
backingDesc.fSampleCnt = sampleCnt;
- *backingSurface = context->resourceProvider()->createTexture(backingDesc, SkBudgeted::kNo);
+ auto resourceProvider = context->contextPriv().resourceProvider();
+
+ *backingSurface = resourceProvider->createTexture(backingDesc, SkBudgeted::kNo);
if (!(*backingSurface)) {
return nullptr;
}
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index fe24bc14e6..c078422868 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -1486,7 +1486,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ClipMaskCache, reporter, ctxInfo) {
path.setFillType(SkPath::kEvenOdd_FillType);
static const char* kTag = GrClipStackClip::kMaskTestTag;
- GrResourceCache* cache = context->getResourceCache();
+ GrResourceCache* cache = context->contextPriv().getResourceCache();
static constexpr int kN = 5;
@@ -1496,7 +1496,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ClipMaskCache, reporter, ctxInfo) {
stack.save();
stack.clipPath(path, m, SkClipOp::kIntersect, true);
sk_sp<GrTextureProxy> mask = GrClipStackClip(&stack).testingOnly_createClipMask(context);
- mask->instantiate(context->resourceProvider());
+ mask->instantiate(context->contextPriv().resourceProvider());
GrTexture* tex = mask->priv().peekTexture();
REPORTER_ASSERT(reporter, 0 == strcmp(tex->getUniqueKey().tag(), kTag));
// Make sure mask isn't pinned in cache.
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 0ff0d2c8fb..04bcca7c4d 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -211,6 +211,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
return;
}
+ auto resourceProvider = context->contextPriv().resourceProvider();
+
for (auto willUseMips : {false, true}) {
for (auto isWrapped : {false, true}) {
GrMipMapped mipMapped = willUseMips ? GrMipMapped::kYes : GrMipMapped::kNo;
@@ -240,7 +242,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
GrTextureProxy* texProxy = device->accessRenderTargetContext()->asTextureProxy();
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped());
- texProxy->instantiate(context->resourceProvider());
+ texProxy->instantiate(resourceProvider);
GrTexture* texture = texProxy->priv().peekTexture();
REPORTER_ASSERT(reporter, mipMapped == texture->texturePriv().mipMapped());
@@ -252,7 +254,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
texProxy = as_IB(image)->peekProxy();
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped());
- texProxy->instantiate(context->resourceProvider());
+ texProxy->instantiate(resourceProvider);
texture = texProxy->priv().peekTexture();
REPORTER_ASSERT(reporter, mipMapped == texture->texturePriv().mipMapped());
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index f65744abeb..cd1ce1e053 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -146,7 +146,7 @@ private:
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo) {
GrContext* const context = ctxInfo.grContext();
- GrResourceProvider* rp = context->resourceProvider();
+ GrResourceProvider* rp = context->contextPriv().resourceProvider();
sk_sp<GrRenderTargetContext> rtc(
context->makeDeferredRenderTargetContext(SkBackingFit::kExact, kScreenSize, kScreenSize,
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 582510c1b4..eab930145c 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -24,6 +24,8 @@
// and render targets to GrSurface all work as expected.
DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
+ auto resourceProvider = context->contextPriv().resourceProvider();
+
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
@@ -31,7 +33,7 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
desc.fHeight = 256;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = 0;
- sk_sp<GrSurface> texRT1 = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
+ sk_sp<GrSurface> texRT1 = resourceProvider->createTexture(desc, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asRenderTarget());
REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asTexture());
@@ -44,7 +46,7 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
desc.fFlags = kNone_GrSurfaceFlags;
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
- sk_sp<GrTexture> tex1 = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
+ sk_sp<GrTexture> tex1 = resourceProvider->createTexture(desc, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget());
REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture());
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1.get()) == tex1->asTexture());
@@ -52,8 +54,8 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
nullptr, 256, 256, kRGBA_8888_GrPixelConfig, false, GrMipMapped::kNo);
- sk_sp<GrSurface> texRT2 = context->resourceProvider()->wrapRenderableBackendTexture(
- backendTex, 0, kBorrow_GrWrapOwnership);
+ sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture(
+ backendTex, 0, kBorrow_GrWrapOwnership);
REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget());
REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture());
@@ -72,7 +74,7 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- GrResourceProvider* resourceProvider = context->resourceProvider();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
const GrCaps* caps = context->caps();
GrPixelConfig configs[] = {
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index c33080888c..3105e9bb00 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -209,7 +209,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ct
return;
}
- if (!srcProxy->instantiate(context->resourceProvider())) {
+ if (!srcProxy->instantiate(context->contextPriv().resourceProvider())) {
return;
}
GrTexture* tex = srcProxy->priv().peekTexture();
diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp
index 2968c76d15..0bbb0718dc 100644
--- a/tests/IntTextureTest.cpp
+++ b/tests/IntTextureTest.cpp
@@ -41,6 +41,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
}
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
+ auto resourceProvider = context->contextPriv().resourceProvider();
+
static const int kS = UINT8_MAX + 1;
static const size_t kRowBytes = kS * sizeof(int32_t);
@@ -278,8 +280,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
// No rendering to integer textures.
GrSurfaceDesc intRTDesc = desc;
intRTDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- sk_sp<GrTexture> temp(context->resourceProvider()->createTexture(intRTDesc,
- SkBudgeted::kYes));
+ sk_sp<GrTexture> temp(resourceProvider->createTexture(intRTDesc, SkBudgeted::kYes));
REPORTER_ASSERT(reporter, !temp);
}
}
diff --git a/tests/PathRendererCacheTests.cpp b/tests/PathRendererCacheTests.cpp
index a3e272c81b..cc645827d9 100644
--- a/tests/PathRendererCacheTests.cpp
+++ b/tests/PathRendererCacheTests.cpp
@@ -77,7 +77,7 @@ static void test_path(skiatest::Reporter* reporter,
sk_sp<GrContext> ctx = GrContext::MakeMock(nullptr);
// The cache needs to be big enough that nothing gets flushed, or our expectations can be wrong
ctx->setResourceCacheLimits(100, 1000000);
- GrResourceCache* cache = ctx->getResourceCache();
+ GrResourceCache* cache = ctx->contextPriv().getResourceCache();
sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext(
SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 0,
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index e675335118..26f10a383a 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -158,6 +158,7 @@ void testingOnly_getIORefCnts(GrTextureProxy* proxy, int* refCnt, int* readCnt,
DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
GrSurfaceDesc desc;
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
@@ -181,7 +182,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
sk_sp<GrTextureProxy> proxy4 =
proxyProvider->createProxy(desc, SkBackingFit::kExact, SkBudgeted::kYes);
sk_sp<GrBuffer> buffer(texelBufferSupport
- ? context->resourceProvider()->createBuffer(
+ ? resourceProvider->createBuffer(
1024, GrBufferType::kTexel_GrBufferType,
GrAccessPattern::kStatic_GrAccessPattern, 0)
: nullptr);
@@ -352,6 +353,7 @@ sk_sp<GrTextureProxy> make_input_texture(GrProxyProvider* proxyProvider, int wid
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
+ auto resourceProvider = context->contextPriv().resourceProvider();
using FPFactory = GrFragmentProcessorTestFactory;
uint32_t seed = 0;
@@ -391,7 +393,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
}
for (int j = 0; j < timesToInvokeFactory; ++j) {
fp = FPFactory::MakeIdx(i, &testData);
- if (!fp->instantiate(context->resourceProvider())) {
+ if (!fp->instantiate(resourceProvider)) {
continue;
}
@@ -490,6 +492,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
+ auto resourceProvider = context->contextPriv().resourceProvider();
SkRandom random;
@@ -522,8 +525,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
continue;
}
const char* name = fp->name();
- if (!fp->instantiate(context->resourceProvider()) ||
- !clone->instantiate(context->resourceProvider())) {
+ if (!fp->instantiate(resourceProvider) || !clone->instantiate(resourceProvider)) {
continue;
}
REPORTER_ASSERT(reporter, !strcmp(fp->name(), clone->name()));
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index acd17be790..e84e6e7585 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -91,7 +91,7 @@ static sk_sp<GrTextureProxy> make_wrapped(GrProxyProvider* proxyProvider) {
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
- GrResourceProvider* resourceProvider = ctxInfo.grContext()->resourceProvider();
+ GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
for (auto make : { make_deferred, make_wrapped }) {
// A single write
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 077045f5db..0636ed4ce4 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -107,7 +107,7 @@ static void check_texture(skiatest::Reporter* reporter,
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
- GrResourceProvider* resourceProvider = ctxInfo.grContext()->resourceProvider();
+ GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
const GrCaps& caps = *ctxInfo.grContext()->caps();
int attempt = 0; // useful for debugging
@@ -196,7 +196,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
- GrResourceProvider* provider = ctxInfo.grContext()->resourceProvider();
+ GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
const GrCaps& caps = *ctxInfo.grContext()->caps();
static const int kWidthHeight = 100;
@@ -227,7 +227,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
backendRT, origin));
check_surface(reporter, sProxy.get(), origin,
kWidthHeight, kWidthHeight, config, SkBudgeted::kNo);
- check_rendertarget(reporter, caps, provider, sProxy->asRenderTargetProxy(),
+ check_rendertarget(reporter, caps, resourceProvider,
+ sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact, 0, true);
}
@@ -243,7 +244,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
check_surface(reporter, sProxy.get(), origin,
kWidthHeight, kWidthHeight, config, budgeted);
- check_rendertarget(reporter, caps, provider, sProxy->asRenderTargetProxy(),
+ check_rendertarget(reporter, caps, resourceProvider,
+ sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles(), true);
} else {
@@ -259,7 +261,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
check_surface(reporter, sProxy.get(), origin,
kWidthHeight, kWidthHeight, config, budgeted);
- check_texture(reporter, provider, sProxy->asTextureProxy(),
+ check_texture(reporter, resourceProvider, sProxy->asTextureProxy(),
SkBackingFit::kExact, true);
}
}
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 6ca4b0cf5c..55a7766944 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -101,7 +101,7 @@ static void non_overlap_test(skiatest::Reporter* reporter, GrResourceProvider* r
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
- GrResourceProvider* resourceProvider = ctxInfo.grContext()->resourceProvider();
+ GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
struct TestCase {
ProxyParams fP1;
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 96cda795df..dd122a0dea 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -127,14 +127,15 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
return;
}
- GrResourceProvider* provider = context->resourceProvider();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
- sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(provider, 4, 0, SkBudgeted::kYes);
+ sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(resourceProvider, 4, 0, SkBudgeted::kYes);
REPORTER_ASSERT(reporter, smallRT0);
{
// Two budgeted RTs with the same desc should share a stencil buffer.
- sk_sp<GrRenderTarget> smallRT1 = create_RT_with_SB(provider, 4, 0, SkBudgeted::kYes);
+ sk_sp<GrRenderTarget> smallRT1 = create_RT_with_SB(resourceProvider, 4, 0,
+ SkBudgeted::kYes);
REPORTER_ASSERT(reporter, smallRT1);
REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT1.get()));
@@ -142,7 +143,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
{
// An unbudgeted RT with the same desc should also share.
- sk_sp<GrRenderTarget> smallRT2 = create_RT_with_SB(provider, 4, 0, SkBudgeted::kNo);
+ sk_sp<GrRenderTarget> smallRT2 = create_RT_with_SB(resourceProvider, 4, 0, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, smallRT2);
REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT2.get()));
@@ -150,7 +151,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
{
// An RT with a much larger size should not share.
- sk_sp<GrRenderTarget> bigRT = create_RT_with_SB(provider, 400, 0, SkBudgeted::kNo);
+ sk_sp<GrRenderTarget> bigRT = create_RT_with_SB(resourceProvider, 400, 0, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, bigRT);
REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) != get_SB(bigRT.get()));
@@ -159,8 +160,8 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
int smallSampleCount = context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig);
if (smallSampleCount > 0) {
// An RT with a different sample count should not share.
- sk_sp<GrRenderTarget> smallMSAART0 = create_RT_with_SB(provider, 4, smallSampleCount,
- SkBudgeted::kNo);
+ sk_sp<GrRenderTarget> smallMSAART0 = create_RT_with_SB(resourceProvider, 4,
+ smallSampleCount, SkBudgeted::kNo);
#ifdef SK_BUILD_FOR_ANDROID
if (!smallMSAART0) {
// The nexus player seems to fail to create MSAA textures.
@@ -174,7 +175,8 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
{
// A second MSAA RT should share with the first MSAA RT.
- sk_sp<GrRenderTarget> smallMSAART1 = create_RT_with_SB(provider, 4, smallSampleCount,
+ sk_sp<GrRenderTarget> smallMSAART1 = create_RT_with_SB(resourceProvider, 4,
+ smallSampleCount,
SkBudgeted::kNo);
REPORTER_ASSERT(reporter, smallMSAART1);
@@ -185,7 +187,8 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
// samples didn't get rounded up to >= 8 or else they could share.).
int bigSampleCount = context->caps()->getSampleCount(8, kRGBA_8888_GrPixelConfig);
if (bigSampleCount != smallSampleCount) {
- sk_sp<GrRenderTarget> smallMSAART2 = create_RT_with_SB(provider, 4, bigSampleCount,
+ sk_sp<GrRenderTarget> smallMSAART2 = create_RT_with_SB(resourceProvider, 4,
+ bigSampleCount,
SkBudgeted::kNo);
REPORTER_ASSERT(reporter, smallMSAART2);
@@ -196,6 +199,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
GrGpu* gpu = context->getGpu();
// this test is only valid for GL
if (!gpu || !gpu->glContextForTesting()) {
@@ -220,10 +224,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
context->resetContext();
- sk_sp<GrTexture> borrowed(context->resourceProvider()->wrapBackendTexture(
+ sk_sp<GrTexture> borrowed(resourceProvider->wrapBackendTexture(
backendTextures[0], kBorrow_GrWrapOwnership));
- sk_sp<GrTexture> adopted(context->resourceProvider()->wrapBackendTexture(
+ sk_sp<GrTexture> adopted(resourceProvider->wrapBackendTexture(
backendTextures[1], kAdopt_GrWrapOwnership));
REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr);
@@ -349,12 +353,12 @@ public:
fContext = GrContext::MakeMock(nullptr);
SkASSERT(fContext);
fContext->setResourceCacheLimits(maxCnt, maxBytes);
- GrResourceCache* cache = fContext->getResourceCache();
+ GrResourceCache* cache = fContext->contextPriv().getResourceCache();
cache->purgeAllUnlocked();
SkASSERT(0 == cache->getResourceCount() && 0 == cache->getResourceBytes());
}
- GrResourceCache* cache() { return fContext->getResourceCache(); }
+ GrResourceCache* cache() { return fContext->contextPriv().getResourceCache(); }
GrContext* context() { return fContext.get(); }
@@ -1677,7 +1681,7 @@ static sk_sp<GrTextureProxy> make_mipmap_proxy(GrProxyProvider* proxyProvider,
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- GrResourceProvider* resourceProvider = context->resourceProvider();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
static const int kSize = 64;
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index a07b3361ef..7f0d9973b5 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -783,6 +783,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf
}
static const uint32_t kOrigColor = 0xFFAABBCC;
+ auto resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
+
for (auto& surfaceFunc : {&create_gpu_surface_backend_texture,
&create_gpu_surface_backend_texture_as_render_target}) {
for (int sampleCnt : {0, 4, 8}) {
@@ -798,8 +800,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf
// our surface functions.
GrRenderTarget* rt = surface->getCanvas()
->internal_private_accessTopLayerRenderTargetContext()->accessRenderTarget();
- REPORTER_ASSERT(reporter,
- ctxInfo.grContext()->resourceProvider()->attachStencilAttachment(rt));
+ REPORTER_ASSERT(reporter, resourceProvider->attachStencilAttachment(rt));
gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
}
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index 82a726db99..914e83e7df 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -78,7 +78,7 @@ static sk_sp<GrTextureProxy> wrapped(skiatest::Reporter* reporter,
static sk_sp<GrTextureProxy> wrapped_with_key(skiatest::Reporter* reporter,
GrContext* context, SkBackingFit fit) {
- GrResourceProvider* resourceProvider = context->resourceProvider();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
static GrUniqueKey::Domain d = GrUniqueKey::GenerateDomain();
static int kUniqueKeyData = 0;
@@ -110,7 +110,7 @@ static sk_sp<GrTextureProxy> wrapped_with_key(skiatest::Reporter* reporter,
static sk_sp<GrTextureProxy> create_wrapped_backend(GrContext* context, SkBackingFit fit,
sk_sp<GrTexture>* backingSurface) {
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- GrResourceProvider* resourceProvider = context->resourceProvider();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
@@ -132,9 +132,9 @@ static void basic_test(GrContext* context,
sk_sp<GrTextureProxy> proxy, bool proxyIsCached) {
static int id = 1;
- GrResourceProvider* resourceProvider = context->resourceProvider();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- GrResourceCache* cache = context->getResourceCache();
+ GrResourceCache* cache = context->contextPriv().getResourceCache();
int startCacheCount = cache->getResourceCount();
@@ -212,7 +212,7 @@ static void basic_test(GrContext* context,
static void invalidation_test(GrContext* context, skiatest::Reporter* reporter) {
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- GrResourceCache* cache = context->getResourceCache();
+ GrResourceCache* cache = context->contextPriv().getResourceCache();
REPORTER_ASSERT(reporter, 0 == cache->getResourceCount());
sk_sp<SkImage> rasterImg;
@@ -254,8 +254,8 @@ static void invalidation_test(GrContext* context, skiatest::Reporter* reporter)
// Test if invalidating unique ids prior to instantiating operates as expected
static void invalidation_and_instantiation_test(GrContext* context, skiatest::Reporter* reporter) {
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- GrResourceProvider* resourceProvider = context->resourceProvider();
- GrResourceCache* cache = context->getResourceCache();
+ GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
+ GrResourceCache* cache = context->contextPriv().getResourceCache();
REPORTER_ASSERT(reporter, 0 == cache->getResourceCount());
static GrUniqueKey::Domain d = GrUniqueKey::GenerateDomain();
@@ -294,7 +294,7 @@ static void invalidation_and_instantiation_test(GrContext* context, skiatest::Re
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TextureProxyTest, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- GrResourceCache* cache = context->getResourceCache();
+ GrResourceCache* cache = context->contextPriv().getResourceCache();
REPORTER_ASSERT(reporter, !proxyProvider->numUniqueKeyProxies_TestOnly());
REPORTER_ASSERT(reporter, 0 == cache->getResourceCount());
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index b59495f0f5..ee1a233d63 100755
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -68,6 +68,8 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix
return;
}
+ auto resourceProvider = context->contextPriv().resourceProvider();
+
// set up the data
const int kTextureWidth = 16;
const int kTextureHeight = 16;
@@ -82,10 +84,10 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix
// create and fill transfer buffer
size_t size = rowBytes*kBufferHeight;
uint32_t bufferFlags = GrResourceProvider::kNoPendingIO_Flag;
- sk_sp<GrBuffer> buffer(context->resourceProvider()->createBuffer(size,
- kXferCpuToGpu_GrBufferType,
- kDynamic_GrAccessPattern,
- bufferFlags));
+ sk_sp<GrBuffer> buffer(resourceProvider->createBuffer(size,
+ kXferCpuToGpu_GrBufferType,
+ kDynamic_GrAccessPattern,
+ bufferFlags));
if (!buffer) {
return;
}
@@ -102,7 +104,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix
desc.fHeight = kTextureHeight;
desc.fConfig = config;
desc.fSampleCnt = 0;
- sk_sp<GrTexture> tex = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
+ sk_sp<GrTexture> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo);
//////////////////////////
// transfer full data
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index b3da67bb96..a41e8f4071 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -504,7 +504,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsPendingIO, reporter, ctxInfo) {
sk_sp<GrTextureProxy> temp = proxyProvider->createProxy(desc, SkBackingFit::kApprox,
SkBudgeted::kYes);
- temp->instantiate(context->resourceProvider());
+ temp->instantiate(context->contextPriv().resourceProvider());
}
// Create the surfaces and flush them to ensure there is no lingering pendingIO