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>
This commit is contained in:
Robert Phillips 2018-01-16 15:07:54 -05:00 committed by Skia Commit-Bot
parent 1ea485fd56
commit 6be756b673
41 changed files with 166 additions and 121 deletions

View File

@ -9,10 +9,11 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
#include "GrGpuResource.h"
#include "GrGpuResourcePriv.h"
#include "GrContext.h"
#include "GrGpu.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) {

View File

@ -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 ;

View File

@ -136,7 +136,7 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::onGenerateTexture(
this->clear();
// We need to get the actual GrTexture so force instantiation of the GrTextureProxy
texProxy->instantiate(context->resourceProvider());
texProxy->instantiate(context->contextPriv().resourceProvider());
GrTexture* texture = texProxy->priv().peekTexture();
SkASSERT(texture);
fOriginalTexture = texture;
@ -218,8 +218,8 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrContext* cont
eglDestroyImageKHR(display, image);
return nullptr;
}
sk_sp<GrTexture> tex = context->resourceProvider()->wrapBackendTexture(backendTex,
kAdopt_GrWrapOwnership);
sk_sp<GrTexture> tex = context->contextPriv().resourceProvider()->wrapBackendTexture(
backendTex, kAdopt_GrWrapOwnership);
if (!tex) {
glDeleteTextures(1, &texID);
eglDestroyImageKHR(display, image);
@ -240,7 +240,7 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrContext* cont
// makeProxy when it is invoked with a different context.
//TODO: GrResourceCache should delete GrTexture, when GrContext is deleted. Currently
//TODO: SkMessageBus ignores messages for deleted contexts and GrTexture will leak.
context->getResourceCache()->insertCrossContextGpuResource(fOriginalTexture);
context->contextPriv().getResourceCache()->insertCrossContextGpuResource(fOriginalTexture);
return GrSurfaceProxy::MakeWrapped(std::move(tex), kTopLeft_GrSurfaceOrigin);
}

View File

@ -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;
}

View File

@ -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);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -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;
}

View File

@ -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

View File

@ -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();

View File

@ -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()));

View File

@ -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();

View File

@ -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);

View File

@ -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;
}

View File

@ -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)

View File

@ -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;

View File

@ -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));
}

View File

@ -18,7 +18,7 @@
#if GR_TEST_UTILS
GrResourceProvider* GrProcessorTestData::resourceProvider() {
return fContext->resourceProvider();
return fContext->contextPriv().resourceProvider();
}
GrProxyProvider* GrProcessorTestData::proxyProvider() {

View File

@ -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()));

View File

@ -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();

View File

@ -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)) {
}

View File

@ -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");

View File

@ -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());

View File

@ -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);
}

View File

@ -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());

View File

@ -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;
}

View File

@ -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.

View File

@ -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());

View File

@ -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,

View File

@ -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[] = {

View File

@ -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();

View File

@ -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);
}
}

View File

@ -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,

View File

@ -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()));

View File

@ -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

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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());

View File

@ -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

View File

@ -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

View File

@ -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);