aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-01-16 10:44:11 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-16 17:02:45 +0000
commit1f9ed8501b0007846b3032f4bfc38aee98c175a1 (patch)
treea342137e34180a110d1cd4129650a771290d0f17
parent20df20cfe822f613d6035baf5f5415a3a977e709 (diff)
Move resourceProvider accessor to GrContextPriv
Change-Id: I5cddd620a7ec4b006b7359864ede58e9d4dd684e Reviewed-on: https://skia-review.googlesource.com/94340 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r--bench/GrResourceCacheBench.cpp11
-rw-r--r--include/gpu/GrContext.h3
-rw-r--r--src/gpu/GrBackendTextureImageGenerator.cpp6
-rw-r--r--src/gpu/GrBufferAllocPool.cpp5
-rw-r--r--src/gpu/GrContext.cpp8
-rw-r--r--src/gpu/GrContextPriv.h5
-rw-r--r--src/gpu/GrDrawOpAtlas.cpp4
-rw-r--r--src/gpu/GrDrawingManager.cpp12
-rw-r--r--src/gpu/GrDrawingManager.h4
-rw-r--r--src/gpu/GrGpu.cpp7
-rw-r--r--src/gpu/GrGpuCommandBuffer.cpp3
-rw-r--r--src/gpu/GrGpuResource.cpp5
-rw-r--r--src/gpu/GrOnFlushResourceProvider.cpp26
-rw-r--r--src/gpu/GrPathRendererChain.cpp2
-rw-r--r--src/gpu/GrProcessor.cpp2
-rw-r--r--src/gpu/GrRenderTargetContext.cpp4
-rw-r--r--src/gpu/GrRenderTargetContext.h3
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp2
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp7
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.cpp2
-rw-r--r--src/gpu/vk/GrVkPipelineState.cpp5
-rw-r--r--src/image/SkImage_Gpu.cpp10
-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
-rw-r--r--tools/fiddle/fiddle_main.cpp13
40 files changed, 162 insertions, 117 deletions
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp
index d78af0a9e5..c48aed5e0b 100644
--- a/bench/GrResourceCacheBench.cpp
+++ b/bench/GrResourceCacheBench.cpp
@@ -9,10 +9,11 @@
#if SK_SUPPORT_GPU
-#include "GrGpuResource.h"
-#include "GrGpuResourcePriv.h"
#include "GrContext.h"
+#include "GrContextPriv.h"
#include "GrGpu.h"
+#include "GrGpuResource.h"
+#include "GrGpuResourcePriv.h"
#include "GrResourceCache.h"
#include "SkCanvas.h"
@@ -76,7 +77,7 @@ protected:
// Set the cache budget to be very large so no purging occurs.
context->setResourceCacheLimits(CACHE_SIZE_COUNT, 1 << 30);
- GrResourceCache* cache = context->getResourceCache();
+ GrResourceCache* cache = context->contextPriv().getResourceCache();
// Make sure the cache is empty.
cache->purgeAllUnlocked();
@@ -122,7 +123,7 @@ protected:
// Set the cache budget to be very large so no purging occurs.
fContext->setResourceCacheLimits(CACHE_SIZE_COUNT, 1 << 30);
- GrResourceCache* cache = fContext->getResourceCache();
+ GrResourceCache* cache = fContext->contextPriv().getResourceCache();
// Make sure the cache is empty.
cache->purgeAllUnlocked();
@@ -137,7 +138,7 @@ protected:
if (!fContext) {
return;
}
- GrResourceCache* cache = fContext->getResourceCache();
+ GrResourceCache* cache = fContext->contextPriv().getResourceCache();
SkASSERT(CACHE_SIZE_COUNT == cache->getResourceCount());
for (int i = 0; i < loops; ++i) {
for (int k = 0; k < CACHE_SIZE_COUNT; ++k) {
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 84c71f87a7..6b5d7500fa 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -305,9 +305,6 @@ public:
GrAtlasGlyphCache* getAtlasGlyphCache() { return fAtlasGlyphCache; }
GrTextBlobCache* getTextBlobCache() { return fTextBlobCache.get(); }
bool abandoned() const;
- GrResourceProvider* resourceProvider() { return fResourceProvider; }
- const GrResourceProvider* resourceProvider() const { return fResourceProvider; }
- GrResourceCache* getResourceCache() { return fResourceCache; }
/** Reset GPU stats */
void resetGpuStats() const ;
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 5dc23963f7..36dc139cab 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -43,7 +43,7 @@ GrBackendTextureImageGenerator::Make(sk_sp<GrTexture> texture, GrSurfaceOrigin o
// Attach our texture to this context's resource cache. This ensures that deletion will happen
// in the correct thread/context. This adds the only ref to the texture that will persist from
// this point. That ref will be released when the generator's RefHelper is freed.
- context->getResourceCache()->insertCrossContextGpuResource(texture.get());
+ context->contextPriv().getResourceCache()->insertCrossContextGpuResource(texture.get());
GrBackendTexture backendTexture = texture->getBackendTexture();
@@ -115,8 +115,8 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture(
// always make a wrapped copy, where the release proc informs us that the context is done
// with it. This is unfortunate - we'll have two texture objects referencing the same GPU
// object. However, no client can ever see the original texture, so this should be safe.
- tex = context->resourceProvider()->wrapBackendTexture(fBackendTexture,
- kBorrow_GrWrapOwnership);
+ tex = context->contextPriv().resourceProvider()->wrapBackendTexture(
+ fBackendTexture, kBorrow_GrWrapOwnership);
if (!tex) {
return nullptr;
}
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp
index 13ae404d3d..fc5fb66478 100644
--- a/src/gpu/GrBufferAllocPool.cpp
+++ b/src/gpu/GrBufferAllocPool.cpp
@@ -10,6 +10,7 @@
#include "GrBuffer.h"
#include "GrCaps.h"
#include "GrContext.h"
+#include "GrContextPriv.h"
#include "GrGpu.h"
#include "GrResourceProvider.h"
#include "GrTypes.h"
@@ -368,11 +369,11 @@ void GrBufferAllocPool::flushCpuData(const BufferBlock& block, size_t flushSize)
GrBuffer* GrBufferAllocPool::getBuffer(size_t size) {
- GrResourceProvider* rp = fGpu->getContext()->resourceProvider();
+ auto resourceProvider = fGpu->getContext()->contextPriv().resourceProvider();
// Shouldn't have to use this flag (https://bug.skia.org/4156)
static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag;
- return rp->createBuffer(size, fBufferType, kDynamic_GrAccessPattern, kFlags);
+ return resourceProvider->createBuffer(size, fBufferType, kDynamic_GrAccessPattern, kFlags);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 95d23441ac..c13cd539c2 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -484,7 +484,7 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst,
ASSERT_OWNED_PROXY_PRIV(dst->asSurfaceProxy());
GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "writeSurfacePixels", fContext);
- if (!dst->asSurfaceProxy()->instantiate(fContext->resourceProvider())) {
+ if (!dst->asSurfaceProxy()->instantiate(this->resourceProvider())) {
return false;
}
@@ -563,7 +563,7 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst,
return false;
}
- if (!tempProxy->instantiate(fContext->resourceProvider())) {
+ if (!tempProxy->instantiate(this->resourceProvider())) {
return false;
}
GrTexture* texture = tempProxy->priv().peekTexture();
@@ -616,7 +616,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src,
GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "readSurfacePixels", fContext);
// MDB TODO: delay this instantiation until later in the method
- if (!src->asSurfaceProxy()->instantiate(fContext->resourceProvider())) {
+ if (!src->asSurfaceProxy()->instantiate(this->resourceProvider())) {
return false;
}
@@ -724,7 +724,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src,
configToRead = tempDrawInfo.fReadConfig;
}
- if (!proxyToRead->instantiate(fContext->resourceProvider())) {
+ if (!proxyToRead->instantiate(this->resourceProvider())) {
return false;
}
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 2da8f34cda..bbf67a569a 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -170,6 +170,11 @@ public:
GrProxyProvider* proxyProvider() { return fContext->fProxyProvider; }
const GrProxyProvider* proxyProvider() const { return fContext->fProxyProvider; }
+ GrResourceProvider* resourceProvider() { return fContext->fResourceProvider; }
+ const GrResourceProvider* resourceProvider() const { return fContext->fResourceProvider; }
+
+ GrResourceCache* getResourceCache() { return fContext->fResourceCache; }
+
private:
explicit GrContextPriv(GrContext* context) : fContext(context) {}
GrContextPriv(const GrContextPriv&); // unimpl
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index 0ba9deca04..24e19f5b5e 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -188,7 +188,7 @@ inline bool GrDrawOpAtlas::updatePlot(GrDeferredUploadTarget* target, AtlasID* i
// MDB TODO: this is currently fine since the atlas' proxy is always pre-instantiated.
// Once it is deferred more care must be taken upon instantiation failure.
- if (!fProxies[pageIdx]->instantiate(fContext->resourceProvider())) {
+ if (!fProxies[pageIdx]->instantiate(fContext->contextPriv().resourceProvider())) {
return false;
}
@@ -309,7 +309,7 @@ bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDeferredUploadTarget* target, int
sk_sp<Plot> plotsp(SkRef(newPlot.get()));
// MDB TODO: this is currently fine since the atlas' proxy is always pre-instantiated.
// Once it is deferred more care must be taken upon instantiation failure.
- if (!fProxies[pageIdx]->instantiate(fContext->resourceProvider())) {
+ if (!fProxies[pageIdx]->instantiate(fContext->contextPriv().resourceProvider())) {
return false;
}
GrTextureProxy* proxy = fProxies[pageIdx].get();
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 7a7e0a3b0a..e60468b0d1 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -168,7 +168,7 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
bool flushed = false;
{
- GrResourceAllocator alloc(fContext->resourceProvider());
+ GrResourceAllocator alloc(fContext->contextPriv().resourceProvider());
for (int i = 0; i < fOpLists.count(); ++i) {
fOpLists[i]->gatherProxyIntervals(&alloc);
alloc.markEndOfOpList(i);
@@ -194,7 +194,7 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
// We always have to notify the cache when it requested a flush so it can reset its state.
if (flushed || type == GrResourceCache::FlushType::kCacheRequested) {
- fContext->getResourceCache()->notifyFlushOccurred(type);
+ fContext->contextPriv().getResourceCache()->notifyFlushOccurred(type);
}
for (GrOnFlushCallbackObject* onFlushCBObject : fOnFlushCBObjects) {
onFlushCBObject->postFlush(fFlushState.nextTokenToFlush(), fFlushingOpListIDs.begin(),
@@ -217,7 +217,7 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
}
#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
- if (!fOpLists[i]->instantiate(fContext->resourceProvider())) {
+ if (!fOpLists[i]->instantiate(fContext->contextPriv().resourceProvider())) {
SkDebugf("OpList failed to instantiate.\n");
fOpLists[i] = nullptr;
continue;
@@ -228,7 +228,7 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
// TODO: handle this instantiation via lazy surface proxies?
// Instantiate all deferred proxies (being built on worker threads) so we can upload them
- fOpLists[i]->instantiateDeferredProxies(fContext->resourceProvider());
+ fOpLists[i]->instantiateDeferredProxies(fContext->contextPriv().resourceProvider());
fOpLists[i]->prepare(flushState);
}
@@ -291,7 +291,7 @@ GrSemaphoresSubmitted GrDrawingManager::prepareSurfaceForExternalIO(
result = this->flush(proxy, numSemaphores, backendSemaphores);
}
- if (!proxy->instantiate(fContext->resourceProvider())) {
+ if (!proxy->instantiate(fContext->contextPriv().resourceProvider())) {
return result;
}
@@ -340,7 +340,7 @@ sk_sp<GrTextureOpList> GrDrawingManager::newTextureOpList(GrTextureProxy* textur
fOpLists.back()->makeClosed(*fContext->caps());
}
- sk_sp<GrTextureOpList> opList(new GrTextureOpList(fContext->resourceProvider(),
+ sk_sp<GrTextureOpList> opList(new GrTextureOpList(fContext->contextPriv().resourceProvider(),
textureProxy,
fContext->getAuditTrail()));
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index cbb28c494a..0162b4bd74 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -65,7 +65,7 @@ public:
GrCoverageCountingPathRenderer* getCoverageCountingPathRenderer();
void flushIfNecessary() {
- if (fContext->getResourceCache()->requestsFlush()) {
+ if (fContext->contextPriv().getResourceCache()->requestsFlush()) {
this->internalFlush(nullptr, GrResourceCache::kCacheRequested, 0, nullptr);
}
}
@@ -92,7 +92,7 @@ private:
, fAtlasTextContext(nullptr)
, fPathRendererChain(nullptr)
, fSoftwarePathRenderer(nullptr)
- , fFlushState(context->getGpu(), context->resourceProvider())
+ , fFlushState(context->getGpu(), context->contextPriv().resourceProvider())
, fFlushing(false) {}
void abandon();
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 3a095517b5..93f719ab48 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -13,6 +13,7 @@
#include "GrBuffer.h"
#include "GrCaps.h"
#include "GrContext.h"
+#include "GrContextPriv.h"
#include "GrGpuResourcePriv.h"
#include "GrMesh.h"
#include "GrPathRendering.h"
@@ -483,15 +484,17 @@ bool GrGpu::SamplePatternComparator::operator()(const SamplePattern& a,
GrSemaphoresSubmitted GrGpu::finishFlush(int numSemaphores,
GrBackendSemaphore backendSemaphores[]) {
+ GrResourceProvider* resourceProvider = fContext->contextPriv().resourceProvider();
+
if (this->caps()->fenceSyncSupport()) {
for (int i = 0; i < numSemaphores; ++i) {
sk_sp<GrSemaphore> semaphore;
if (backendSemaphores[i].isInitialized()) {
- semaphore = fContext->resourceProvider()->wrapBackendSemaphore(
+ semaphore = resourceProvider->wrapBackendSemaphore(
backendSemaphores[i], GrResourceProvider::SemaphoreWrapType::kWillSignal,
kBorrow_GrWrapOwnership);
} else {
- semaphore = fContext->resourceProvider()->makeSemaphore(false);
+ semaphore = resourceProvider->makeSemaphore(false);
}
this->insertSemaphore(semaphore, false);
diff --git a/src/gpu/GrGpuCommandBuffer.cpp b/src/gpu/GrGpuCommandBuffer.cpp
index 1dc16c1caa..096c3c4d38 100644
--- a/src/gpu/GrGpuCommandBuffer.cpp
+++ b/src/gpu/GrGpuCommandBuffer.cpp
@@ -46,8 +46,9 @@ bool GrGpuRTCommandBuffer::draw(const GrPipeline& pipeline,
SkASSERT(primProc.hasInstanceAttribs() == meshes[i].isInstanced());
}
#endif
+ auto resourceProvider = this->gpu()->getContext()->contextPriv().resourceProvider();
- if (pipeline.isBad() || !primProc.instantiate(this->gpu()->getContext()->resourceProvider())) {
+ if (pipeline.isBad() || !primProc.instantiate(resourceProvider)) {
return false;
}
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index df8e72c5ed..3d3c88bbe2 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -7,6 +7,7 @@
#include "GrGpuResource.h"
#include "GrContext.h"
+#include "GrContextPriv.h"
#include "GrResourceCache.h"
#include "GrGpu.h"
#include "GrGpuResourcePriv.h"
@@ -15,8 +16,8 @@
static inline GrResourceCache* get_resource_cache(GrGpu* gpu) {
SkASSERT(gpu);
SkASSERT(gpu->getContext());
- SkASSERT(gpu->getContext()->getResourceCache());
- return gpu->getContext()->getResourceCache();
+ SkASSERT(gpu->getContext()->contextPriv().getResourceCache());
+ return gpu->getContext()->contextPriv().getResourceCache();
}
GrGpuResource::GrGpuResource(GrGpu* gpu)
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index 7fcd30f941..8de827c5b5 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -19,10 +19,12 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
GrSurfaceDesc tmpDesc = desc;
tmpDesc.fFlags |= kRenderTarget_GrSurfaceFlag;
+ auto proxyProvider = fDrawingMgr->getContext()->contextPriv().proxyProvider();
+ auto resourceProvider = fDrawingMgr->getContext()->contextPriv().resourceProvider();
+
// Because this is being allocated at the start of a flush we must ensure the proxy
// will, when instantiated, have no pending IO.
// TODO: fold the kNoPendingIO_Flag into GrSurfaceFlags?
- GrProxyProvider* proxyProvider = fDrawingMgr->getContext()->contextPriv().proxyProvider();
sk_sp<GrSurfaceProxy> proxy = proxyProvider->createProxy(tmpDesc, SkBackingFit::kExact,
SkBudgeted::kYes,
GrResourceProvider::kNoPendingIO_Flag);
@@ -42,8 +44,7 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
// Since this is at flush time and these won't be allocated for us by the GrResourceAllocator
// we have to manually ensure it is allocated here. The proxy had best have been created
// with the kNoPendingIO flag!
- if (!renderTargetContext->asSurfaceProxy()->instantiate(
- fDrawingMgr->getContext()->resourceProvider())) {
+ if (!renderTargetContext->asSurfaceProxy()->instantiate(resourceProvider)) {
return nullptr;
}
@@ -67,11 +68,12 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
return nullptr;
}
+ auto resourceProvider = fDrawingMgr->getContext()->contextPriv().resourceProvider();
+
// Since this is at flush time and these won't be allocated for us by the GrResourceAllocator
// we have to manually ensure it is allocated here. The proxy had best have been created
// with the kNoPendingIO flag!
- if (!renderTargetContext->asSurfaceProxy()->instantiate(
- fDrawingMgr->getContext()->resourceProvider())) {
+ if (!renderTargetContext->asSurfaceProxy()->instantiate(resourceProvider)) {
return nullptr;
}
@@ -82,18 +84,20 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
sk_sp<GrBuffer> GrOnFlushResourceProvider::makeBuffer(GrBufferType intendedType, size_t size,
const void* data) {
- GrResourceProvider* rp = fDrawingMgr->getContext()->resourceProvider();
- return sk_sp<GrBuffer>(rp->createBuffer(size, intendedType, kDynamic_GrAccessPattern,
- GrResourceProvider::kNoPendingIO_Flag,
- data));
+ auto resourceProvider = fDrawingMgr->getContext()->contextPriv().resourceProvider();
+ return sk_sp<GrBuffer>(resourceProvider->createBuffer(size, intendedType,
+ kDynamic_GrAccessPattern,
+ GrResourceProvider::kNoPendingIO_Flag,
+ data));
}
sk_sp<const GrBuffer> GrOnFlushResourceProvider::findOrMakeStaticBuffer(GrBufferType intendedType,
size_t size,
const void* data,
const GrUniqueKey& key) {
- GrResourceProvider* rp = fDrawingMgr->getContext()->resourceProvider();
- sk_sp<const GrBuffer> buffer = rp->findOrMakeStaticBuffer(intendedType, size, data, key);
+ auto resourceProvider = fDrawingMgr->getContext()->contextPriv().resourceProvider();
+ sk_sp<const GrBuffer> buffer = resourceProvider->findOrMakeStaticBuffer(intendedType, size,
+ data, key);
// Static buffers should never have pending IO.
SkASSERT(!buffer->resourcePriv().hasPendingIO_debugOnly());
return buffer;
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 393823ca1b..1e1d87a828 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -34,7 +34,7 @@ GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& opti
}
if (options.fGpuPathRenderers & GpuPathRenderers::kStencilAndCover) {
sk_sp<GrPathRenderer> pr(
- GrStencilAndCoverPathRenderer::Create(context->resourceProvider(), caps));
+ GrStencilAndCoverPathRenderer::Create(context->contextPriv().resourceProvider(), caps));
if (pr) {
fChain.push_back(std::move(pr));
}
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 96cbca480c..2b02b8df20 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -18,7 +18,7 @@
#if GR_TEST_UTILS
GrResourceProvider* GrProcessorTestData::resourceProvider() {
- return fContext->resourceProvider();
+ return fContext->contextPriv().resourceProvider();
}
GrProxyProvider* GrProcessorTestData::proxyProvider() {
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 19540ebd7e..42a4fddc52 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1425,9 +1425,11 @@ bool GrRenderTargetContext::waitOnSemaphores(int numSemaphores,
return false;
}
+ auto resourceProvider = fContext->contextPriv().resourceProvider();
+
SkTArray<sk_sp<GrSemaphore>> semaphores(numSemaphores);
for (int i = 0; i < numSemaphores; ++i) {
- sk_sp<GrSemaphore> sema = fContext->resourceProvider()->wrapBackendSemaphore(
+ sk_sp<GrSemaphore> sema = resourceProvider->wrapBackendSemaphore(
waitSemaphores[i], GrResourceProvider::SemaphoreWrapType::kWillWait,
kAdopt_GrWrapOwnership);
std::unique_ptr<GrOp> waitOp(GrSemaphoreOp::MakeWait(sema, fRenderTargetProxy.get()));
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 2ae52b922c..47cd922596 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -11,6 +11,7 @@
#include "../private/GrRenderTargetProxy.h"
#include "GrColor.h"
#include "GrContext.h"
+#include "GrContextPriv.h"
#include "GrPaint.h"
#include "GrSurfaceContext.h"
#include "GrTypesPriv.h"
@@ -349,7 +350,7 @@ public:
GrRenderTarget* accessRenderTarget() {
// TODO: usage of this entry point needs to be reduced and potentially eliminated
// since it ends the deferral of the GrRenderTarget's allocation
- if (!fRenderTargetProxy->instantiate(fContext->resourceProvider())) {
+ if (!fRenderTargetProxy->instantiate(fContext->contextPriv().resourceProvider())) {
return nullptr;
}
return fRenderTargetProxy->priv().peekRenderTarget();
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 09ce76009a..0f62bc6a35 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -26,7 +26,7 @@ static const int kMaxOpLookahead = 10;
GrRenderTargetOpList::GrRenderTargetOpList(GrRenderTargetProxy* proxy, GrGpu* gpu,
GrAuditTrail* auditTrail)
- : INHERITED(gpu->getContext()->resourceProvider(), proxy, auditTrail)
+ : INHERITED(gpu->getContext()->contextPriv().resourceProvider(), proxy, auditTrail)
, fLastClipStackGenID(SK_InvalidUniqueID)
SkDEBUGCODE(, fNumClips(0)) {
}
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 0e6eee46d0..f906773efc 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -9,6 +9,7 @@
#include "GrAutoLocaleSetter.h"
#include "GrContext.h"
+#include "GrContextPriv.h"
#include "GrCoordTransform.h"
#include "GrGLProgramBuilder.h"
#include "GrProgramDesc.h"
@@ -32,7 +33,11 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(const GrPipeline& pipeline,
const GrPrimitiveProcessor& primProc,
GrProgramDesc* desc,
GrGLGpu* gpu) {
- SkASSERT(!pipeline.isBad() && primProc.instantiate(gpu->getContext()->resourceProvider()));
+#ifdef SK_DEBUG
+ GrResourceProvider* resourceProvider = gpu->getContext()->contextPriv().resourceProvider();
+
+ SkASSERT(!pipeline.isBad() && primProc.instantiate(resourceProvider));
+#endif
ATRACE_ANDROID_FRAMEWORK("Shader Compile");
GrAutoLocaleSetter als("C");
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 86e5732eb9..b2dfa6c375 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -560,7 +560,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
SkASSERT(fInstanceData);
if (fInstanceData->count()) {
- sk_sp<GrPathRange> glyphs(this->createGlyphs(ctx->resourceProvider()));
+ sk_sp<GrPathRange> glyphs(this->createGlyphs(ctx->contextPriv().resourceProvider()));
if (fLastDrawnGlyphsID != glyphs->uniqueID()) {
// Either this is the first draw or the glyphs object was purged since last draw.
glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->count());
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index 1dbc4909ce..10e757e3c9 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -8,6 +8,7 @@
#include "GrVkPipelineState.h"
#include "GrContext.h"
+#include "GrContextPriv.h"
#include "GrPipeline.h"
#include "GrTexturePriv.h"
#include "GrVkBufferView.h"
@@ -263,10 +264,12 @@ void GrVkPipelineState::setData(GrVkGpu* gpu,
fXferProcessor->setData(fDataManager, pipeline.getXferProcessor(), dstTexture, offset);
}
+ GrResourceProvider* resourceProvider = gpu->getContext()->contextPriv().resourceProvider();
+
GrResourceIOProcessor::TextureSampler dstTextureSampler;
if (GrTextureProxy* dstTextureProxy = pipeline.dstTextureProxy()) {
dstTextureSampler.reset(sk_ref_sp(dstTextureProxy));
- SkAssertResult(dstTextureSampler.instantiate(gpu->getContext()->resourceProvider()));
+ SkAssertResult(dstTextureSampler.instantiate(resourceProvider));
textureBindings.push_back(&dstTextureSampler);
}
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 20e8349aa2..d08f0a4eeb 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -156,7 +156,7 @@ GrBackendObject SkImage_Gpu::onGetTextureHandle(bool flushPendingGrContextIO,
GrSurfaceOrigin* origin) const {
SkASSERT(fProxy);
- if (!fProxy->instantiate(fContext->resourceProvider())) {
+ if (!fProxy->instantiate(fContext->contextPriv().resourceProvider())) {
return 0;
}
@@ -180,7 +180,7 @@ GrTexture* SkImage_Gpu::onGetTexture() const {
return nullptr;
}
- if (!proxy->instantiate(fContext->resourceProvider())) {
+ if (!proxy->instantiate(fContext->contextPriv().resourceProvider())) {
return nullptr;
}
@@ -284,7 +284,9 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx,
return nullptr;
}
- sk_sp<GrTexture> tex = ctx->resourceProvider()->wrapBackendTexture(backendTex, ownership);
+ GrResourceProvider* resourceProvider = ctx->contextPriv().resourceProvider();
+
+ sk_sp<GrTexture> tex = resourceProvider->wrapBackendTexture(backendTex, ownership);
if (!tex) {
return nullptr;
}
@@ -585,7 +587,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk
return codecImage;
}
- if (!proxy->instantiate(context->resourceProvider())) {
+ if (!proxy->instantiate(context->contextPriv().resourceProvider())) {
return codecImage;
}
sk_sp<GrTexture> texture = sk_ref_sp(proxy->priv().peekTexture());
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
diff --git a/tools/fiddle/fiddle_main.cpp b/tools/fiddle/fiddle_main.cpp
index b22ec55d03..4ba84f38ca 100644
--- a/tools/fiddle/fiddle_main.cpp
+++ b/tools/fiddle/fiddle_main.cpp
@@ -124,6 +124,8 @@ static bool setup_backend_objects(GrContext* context,
return false;
}
+ auto resourceProvider = context->contextPriv().resourceProvider();
+
GrSurfaceDesc backingDesc;
backingDesc.fFlags = kNone_GrSurfaceFlags;
backingDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
@@ -163,10 +165,9 @@ static bool setup_backend_objects(GrContext* context,
texels[i].fRowBytes = 0;
}
- backingTexture = context->resourceProvider()->createTexture(
- backingDesc, SkBudgeted::kNo,
- texels.get(), mipLevelCount,
- SkDestinationSurfaceColorMode::kLegacy);
+ backingTexture = resourceProvider->createTexture(backingDesc, SkBudgeted::kNo,
+ texels.get(), mipLevelCount,
+ SkDestinationSurfaceColorMode::kLegacy);
if (!backingTexture) {
return false;
}
@@ -192,7 +193,7 @@ static bool setup_backend_objects(GrContext* context,
// We use this fact to initialize it with data but don't allow mipmaps
GrMipLevel level0 = { data.get(), backingDesc.fWidth*sizeof(uint32_t) };
- sk_sp<GrTexture> tmp = context->resourceProvider()->createTexture(
+ sk_sp<GrTexture> tmp = resourceProvider->createTexture(
backingDesc, SkBudgeted::kNo,
&level0, 1,
SkDestinationSurfaceColorMode::kLegacy);
@@ -222,7 +223,7 @@ static bool setup_backend_objects(GrContext* context,
texels[i].fRowBytes = 0;
}
- backingTextureRenderTarget = context->resourceProvider()->createTexture(
+ backingTextureRenderTarget = resourceProvider->createTexture(
backingDesc, SkBudgeted::kNo,
texels.get(), mipLevelCount,
SkDestinationSurfaceColorMode::kLegacy);