Make some GrSurfaceProxy and GrTextureProxy methods easier to access

Move peek[Surface|Texture|RenderTarget]() from GrSurfaceProxyPriv to
to GrSurfaceProxy.

Move proxyMipMapped(), textureType(), and hasRestrictedSampling()
from GrTextureProxyPriv to GrTextureProxy.

Change-Id: I259114d0508c4613d55f7f1faccac362fa6fb281
Reviewed-on: https://skia-review.googlesource.com/144641
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Brian Salomon 2018-07-31 17:25:29 -04:00 committed by Skia Commit-Bot
parent f4bf7fc35d
commit fd98c2c871
62 changed files with 164 additions and 179 deletions

View File

@ -333,6 +333,21 @@ public:
virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; }
virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return nullptr; }
bool isInstantiated() const { return SkToBool(fTarget); }
// If the proxy is already instantiated, return its backing GrTexture; if not, return null.
GrSurface* peekSurface() const { return fTarget; }
// If this is a texture proxy and the proxy is already instantiated, return its backing
// GrTexture; if not, return null.
GrTexture* peekTexture() const { return fTarget ? fTarget->asTexture() : nullptr; }
// If this is a render target proxy and the proxy is already instantiated, return its backing
// GrRenderTarget; if not, return null.
GrRenderTarget* peekRenderTarget() const {
return fTarget ? fTarget->asRenderTarget() : nullptr;
}
/**
* Does the resource count against the resource budget?
*/

View File

@ -36,6 +36,13 @@ public:
// generation later.
GrMipMapped mipMapped() const;
// Returns the GrMipMapped value of the proxy from creation time regardless of whether it has
// been instantiated or not.
GrMipMapped proxyMipMapped() const { return fMipMapped; }
GrTextureType textureType() const { return fTextureType; }
/** If true then the texture does not support MIP maps and only supports clamp wrap mode. */
bool hasRestrictedSampling() const { return GrTextureTypeHasRestrictedSampling(fTextureType); }
/**
* Return the texture proxy's unique key. It will be invalid if the proxy doesn't have one.
*/

View File

@ -128,8 +128,8 @@ bool SkDeferredDisplayListRecorder::init() {
// The proxy backing the destination surface had better have been instantiated
// prior to the proxy backing the DLL's surface. Steal its GrRenderTarget.
SkASSERT(lazyProxyData->fReplayDest->priv().peekSurface());
return sk_ref_sp<GrSurface>(lazyProxyData->fReplayDest->priv().peekSurface());
SkASSERT(lazyProxyData->fReplayDest->peekSurface());
return sk_ref_sp<GrSurface>(lazyProxyData->fReplayDest->peekSurface());
},
desc,
fCharacterization.origin(),

View File

@ -608,7 +608,7 @@ void GrGLDisplacementMapEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& proc) {
const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMapEffect>();
GrSurfaceProxy* proxy = displacementMap.textureSampler(1).proxy();
GrTexture* colorTex = proxy->priv().peekTexture();
GrTexture* colorTex = proxy->peekTexture();
SkScalar scaleX = displacementMap.scale().fX / colorTex->width();
SkScalar scaleY = displacementMap.scale().fY / colorTex->height();

View File

@ -1917,7 +1917,7 @@ void GrGLLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman,
}
GrTextureProxy* proxy = lighting.textureSampler(0).proxy();
GrTexture* texture = proxy->priv().peekTexture();
GrTexture* texture = proxy->peekTexture();
float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f;
pdman.set2f(fImageIncrementUni, 1.0f / texture->width(), ySign / texture->height());

View File

@ -278,7 +278,7 @@ void GrGLMorphologyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& proc) {
const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>();
GrSurfaceProxy* proxy = m.textureSampler(0).proxy();
GrTexture& texture = *proxy->priv().peekTexture();
GrTexture& texture = *proxy->peekTexture();
float pixelSize = 0.0f;
switch (m.direction()) {

View File

@ -135,7 +135,7 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::onGenerateTexture(
// We need to get the actual GrTexture so force instantiation of the GrTextureProxy
texProxy->instantiate(context->contextPriv().resourceProvider());
GrTexture* texture = texProxy->priv().peekTexture();
GrTexture* texture = texProxy->peekTexture();
SkASSERT(texture);
fOriginalTexture = texture;
}

View File

@ -42,9 +42,9 @@
#include <unordered_map>
#define ASSERT_OWNED_PROXY(P) \
SkASSERT(!(P) || !((P)->priv().peekTexture()) || (P)->priv().peekTexture()->getContext() == this)
SkASSERT(!(P) || !((P)->peekTexture()) || (P)->peekTexture()->getContext() == this)
#define ASSERT_OWNED_PROXY_PRIV(P) \
SkASSERT(!(P) || !((P)->priv().peekTexture()) || (P)->priv().peekTexture()->getContext() == fContext)
SkASSERT(!(P) || !((P)->peekTexture()) || (P)->peekTexture()->getContext() == fContext)
#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this)
#define ASSERT_SINGLE_OWNER \
@ -469,7 +469,7 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst, int left, int top,
}
GrSurfaceProxy* dstProxy = dst->asSurfaceProxy();
GrSurface* dstSurface = dstProxy->priv().peekSurface();
GrSurface* dstSurface = dstProxy->peekSurface();
if (!GrSurfacePriv::AdjustWritePixelParams(dstSurface->width(), dstSurface->height(),
GrColorTypeBytesPerPixel(srcColorType), &left, &top,
@ -640,7 +640,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, int left, int top,
}
GrSurfaceProxy* srcProxy = src->asSurfaceProxy();
GrSurface* srcSurface = srcProxy->priv().peekSurface();
GrSurface* srcSurface = srcProxy->peekSurface();
if (!GrSurfacePriv::AdjustReadPixelParams(srcSurface->width(), srcSurface->height(),
GrColorTypeBytesPerPixel(dstColorType), &left, &top,

View File

@ -116,10 +116,7 @@ public:
// This should only ever be called at flush time after the backing texture has been
// successfully instantiated
GrTexture* peekTexture() const {
SkASSERT(fProxy->priv().peekTexture());
return fProxy->priv().peekTexture();
}
GrTexture* peekTexture() const { return fProxy->peekTexture(); }
private:
// The textures' effect is to optionally normalize the final matrix, so a blind

View File

@ -29,7 +29,7 @@
void GrDrawOpAtlas::instantiate(GrOnFlushResourceProvider* onFlushResourceProvider) {
for (uint32_t i = 0; i < fNumActivePages; ++i) {
// All the atlas pages are now instantiated at flush time in the activeNewPage method.
SkASSERT(fProxies[i] && fProxies[i]->priv().isInstantiated());
SkASSERT(fProxies[i] && fProxies[i]->isInstantiated());
}
}
@ -136,7 +136,7 @@ bool GrDrawOpAtlas::Plot::addSubImage(int width, int height, const void* image,
void GrDrawOpAtlas::Plot::uploadToTexture(GrDeferredTextureUploadWritePixelsFn& writePixels,
GrTextureProxy* proxy) {
// We should only be issuing uploads if we are in fact dirty
SkASSERT(fDirty && fData && proxy && proxy->priv().peekTexture());
SkASSERT(fDirty && fData && proxy && proxy->peekTexture());
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
size_t rowBytes = fBytesPerPixel * fWidth;
const unsigned char* dataPtr = fData;
@ -218,7 +218,7 @@ inline bool GrDrawOpAtlas::updatePlot(GrDeferredUploadTarget* target, AtlasID* i
sk_sp<Plot> plotsp(SkRef(plot));
GrTextureProxy* proxy = fProxies[pageIdx].get();
SkASSERT(proxy->priv().isInstantiated()); // This is occurring at flush time
SkASSERT(proxy->isInstantiated()); // This is occurring at flush time
GrDeferredUploadToken lastUploadToken = target->addASAPUpload(
[plotsp, proxy](GrDeferredTextureUploadWritePixelsFn& writePixels) {
@ -232,7 +232,7 @@ inline bool GrDrawOpAtlas::updatePlot(GrDeferredUploadTarget* target, AtlasID* i
bool GrDrawOpAtlas::uploadToPage(unsigned int pageIdx, AtlasID* id, GrDeferredUploadTarget* target,
int width, int height, const void* image, SkIPoint16* loc) {
SkASSERT(fProxies[pageIdx] && fProxies[pageIdx]->priv().isInstantiated());
SkASSERT(fProxies[pageIdx] && fProxies[pageIdx]->isInstantiated());
// look through all allocated plots for one we can share, in Most Recently Refed order
PlotList::Iter plotIter;
@ -351,7 +351,7 @@ GrDrawOpAtlas::ErrorCode GrDrawOpAtlas::addToAtlas(GrResourceProvider* resourceP
sk_sp<Plot> plotsp(SkRef(newPlot.get()));
GrTextureProxy* proxy = fProxies[pageIdx].get();
SkASSERT(proxy->priv().isInstantiated());
SkASSERT(proxy->isInstantiated());
GrDeferredUploadToken lastUploadToken = target->addInlineUpload(
[plotsp, proxy](GrDeferredTextureUploadWritePixelsFn& writePixels) {

View File

@ -376,7 +376,7 @@ GrSemaphoresSubmitted GrDrawingManager::prepareSurfaceForExternalIO(
return result;
}
GrSurface* surface = proxy->priv().peekSurface();
GrSurface* surface = proxy->peekSurface();
if (auto* rt = surface->asRenderTarget()) {
gpu->resolveRenderTarget(rt);
}

View File

@ -437,8 +437,8 @@ public:
// 'peekTexture' should only ever be called after a successful 'instantiate' call
GrTexture* peekTexture() const {
SkASSERT(fProxyRef.get()->priv().peekTexture());
return fProxyRef.get()->priv().peekTexture();
SkASSERT(fProxyRef.get()->peekTexture());
return fProxyRef.get()->peekTexture();
}
GrTextureProxy* proxy() const { return fProxyRef.get()->asTextureProxy(); }

View File

@ -74,7 +74,7 @@ bool GrGpu::IsACopyNeededForRepeatWrapMode(const GrCaps* caps, GrTextureProxy* t
if (texProxy) {
// If the texture format itself doesn't support repeat wrap mode or mipmapping (and
// those capabilities are required) force a copy.
if (texProxy->texPriv().hasRestrictedSampling()) {
if (texProxy->hasRestrictedSampling()) {
copyParams->fFilter = GrSamplerState::Filter::kNearest;
copyParams->fWidth = texProxy->width();
copyParams->fHeight = texProxy->height();

View File

@ -83,7 +83,7 @@ void GrOpFlushState::doUpload(GrDeferredTextureUploadFn& upload) {
int width, int height,
GrColorType srcColorType, const void* buffer,
size_t rowBytes) {
GrSurface* dstSurface = dstProxy->priv().peekSurface();
GrSurface* dstSurface = dstProxy->peekSurface();
if (!fGpu->caps()->surfaceSupportsWritePixels(dstSurface) &&
fGpu->caps()->supportedWritePixelsColorType(dstSurface->config(), srcColorType) != srcColorType) {
return false;

View File

@ -49,7 +49,7 @@ public:
/** Additional data required on a per-op basis when executing GrOps. */
struct OpArgs {
GrRenderTarget* renderTarget() const { return fProxy->priv().peekRenderTarget(); }
GrRenderTarget* renderTarget() const { return fProxy->peekRenderTarget(); }
GrOp* fOp;
// TODO: do we still need the dst proxy here?

View File

@ -73,7 +73,7 @@ void GrOpList::endFlush() {
void GrOpList::instantiateDeferredProxies(GrResourceProvider* resourceProvider) {
for (int i = 0; i < fDeferredProxies.count(); ++i) {
if (resourceProvider->explicitlyAllocateGPUResources()) {
SkASSERT(fDeferredProxies[i]->priv().isInstantiated());
SkASSERT(fDeferredProxies[i]->isInstantiated());
} else {
fDeferredProxies[i]->instantiate(resourceProvider);
}
@ -135,9 +135,7 @@ bool GrOpList::dependsOn(const GrOpList* dependedOn) const {
return false;
}
bool GrOpList::isInstantiated() const {
return fTarget.get()->priv().isInstantiated();
}
bool GrOpList::isInstantiated() const { return fTarget.get()->isInstantiated(); }
bool GrOpList::isFullyInstantiated() const {
if (!this->isInstantiated()) {
@ -150,7 +148,7 @@ bool GrOpList::isFullyInstantiated() const {
: false;
if (needsStencil) {
GrRenderTarget* rt = proxy->priv().peekRenderTarget();
GrRenderTarget* rt = proxy->peekRenderTarget();
if (!rt->renderTargetPriv().getStencilAttachment()) {
return false;
@ -169,8 +167,9 @@ void GrOpList::dump(bool printDependencies) const {
SkDebugf("--------------------------------------------------------------\n");
SkDebugf("opListID: %d - proxyID: %d - surfaceID: %d\n", fUniqueID,
fTarget.get() ? fTarget.get()->uniqueID().asUInt() : -1,
fTarget.get() && fTarget.get()->priv().peekSurface()
? fTarget.get()->priv().peekSurface()->uniqueID().asUInt() : -1);
fTarget.get() && fTarget.get()->peekSurface()
? fTarget.get()->peekSurface()->uniqueID().asUInt()
: -1);
SkDebugf("ColorLoadOp: %s %x StencilLoadOp: %s\n",
op_to_name(fColorLoadOp),
GrLoadOp::kClear == fColorLoadOp ? fLoadClearColor : 0x0,

View File

@ -93,7 +93,7 @@ void GrPipeline::addDependenciesTo(GrOpList* opList, const GrCaps& caps) const {
GrXferBarrierType GrPipeline::xferBarrierType(const GrCaps& caps) const {
if (fDstTextureProxy.get() &&
fDstTextureProxy.get()->priv().peekTexture() == fProxy.get()->priv().peekTexture()) {
fDstTextureProxy.get()->peekTexture() == fProxy.get()->peekTexture()) {
return kTexture_GrXferBarrierType;
}
return this->getXferProcessor().xferBarrierType(caps);

View File

@ -137,7 +137,7 @@ public:
GrTexture* peekDstTexture(SkIPoint* offset = nullptr) const {
if (GrTextureProxy* dstProxy = this->dstTextureProxy(offset)) {
return dstProxy->priv().peekTexture();
return dstProxy->peekTexture();
}
return nullptr;
@ -165,7 +165,7 @@ public:
* @return The currently set render target.
*/
GrRenderTargetProxy* proxy() const { return fProxy.get(); }
GrRenderTarget* renderTarget() const { return fProxy.get()->priv().peekRenderTarget(); }
GrRenderTarget* renderTarget() const { return fProxy.get()->peekRenderTarget(); }
const GrUserStencilSettings* getUserStencil() const { return fUserStencilSettings; }

View File

@ -212,8 +212,8 @@ public:
// 'peekTexture' should only ever be called after a successful 'instantiate' call
GrTexture* peekTexture() const {
SkASSERT(fProxyRef.get()->priv().peekTexture());
return fProxyRef.get()->priv().peekTexture();
SkASSERT(fProxyRef.get()->peekTexture());
return fProxyRef.get()->peekTexture();
}
GrTextureProxy* proxy() const { return fProxyRef.get()->asTextureProxy(); }

View File

@ -86,8 +86,7 @@ bool GrProxyProvider::assignUniqueKeyToProxy(const GrUniqueKey& key, GrTexturePr
// same resource (rather than re-wrapping). When a wrapped resource is no longer referenced,
// it will always be released - it is never converted to a scratch resource.
if (SkBudgeted::kNo == proxy->isBudgeted() &&
(!proxy->priv().isInstantiated() ||
!proxy->priv().peekSurface()->resourcePriv().refsWrappedObjects())) {
(!proxy->isInstantiated() || !proxy->peekSurface()->resourcePriv().refsWrappedObjects())) {
return false;
}
@ -667,7 +666,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallbac
}
bool GrProxyProvider::IsFunctionallyExact(GrSurfaceProxy* proxy) {
const bool isInstantiated = proxy->priv().isInstantiated();
const bool isInstantiated = proxy->isInstantiated();
// A proxy is functionally exact if:
// it is exact (obvs)
// when it is instantiated it will be exact (i.e., power of two dimensions)
@ -696,8 +695,8 @@ void GrProxyProvider::processInvalidProxyUniqueKey(const GrUniqueKey& key, GrTex
fUniquelyKeyedProxies.remove(key);
proxy->cacheAccess().clearUniqueKey();
if (invalidateSurface && proxy->priv().isInstantiated()) {
GrSurface* surface = proxy->priv().peekSurface();
if (invalidateSurface && proxy->isInstantiated()) {
GrSurface* surface = proxy->peekSurface();
if (surface) {
surface->resourcePriv().removeUniqueKey();
}

View File

@ -354,7 +354,7 @@ public:
if (!fRenderTargetProxy->instantiate(fContext->contextPriv().resourceProvider())) {
return nullptr;
}
return fRenderTargetProxy->priv().peekRenderTarget();
return fRenderTargetProxy->peekRenderTarget();
}
GrSurfaceProxy* asSurfaceProxy() override { return fRenderTargetProxy.get(); }

View File

@ -81,7 +81,7 @@ void GrRenderTargetOpList::visitProxies_debugOnly(const GrOp::VisitProxyFunc& fu
#endif
void GrRenderTargetOpList::onPrepare(GrOpFlushState* flushState) {
SkASSERT(fTarget.get()->priv().peekRenderTarget());
SkASSERT(fTarget.get()->peekRenderTarget());
SkASSERT(this->isClosed());
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
TRACE_EVENT0("skia", TRACE_FUNC);
@ -160,16 +160,17 @@ bool GrRenderTargetOpList::onExecute(GrOpFlushState* flushState) {
return false;
}
SkASSERT(fTarget.get()->priv().peekRenderTarget());
SkASSERT(fTarget.get()->peekRenderTarget());
TRACE_EVENT0("skia", TRACE_FUNC);
// TODO: at the very least, we want the stencil store op to always be discard (at this
// level). In Vulkan, sub-command buffers would still need to load & store the stencil buffer.
std::unique_ptr<GrGpuRTCommandBuffer> commandBuffer = create_command_buffer(
flushState->gpu(),
fTarget.get()->priv().peekRenderTarget(),
fTarget.get()->peekRenderTarget(),
fTarget.get()->origin(),
fColorLoadOp, fLoadClearColor,
fColorLoadOp,
fLoadClearColor,
fStencilLoadOp);
flushState->setCommandBuffer(commandBuffer.get());
commandBuffer->begin();
@ -262,8 +263,8 @@ bool GrRenderTargetOpList::copySurface(GrContext* context,
void GrRenderTargetOpList::purgeOpsWithUninstantiatedProxies() {
bool hasUninstantiatedProxy = false;
auto checkInstantiation = [ &hasUninstantiatedProxy ] (GrSurfaceProxy* p) {
if (!p->priv().isInstantiated()) {
auto checkInstantiation = [&hasUninstantiatedProxy](GrSurfaceProxy* p) {
if (!p->isInstantiated()) {
hasUninstantiatedProxy = true;
}
};
@ -283,7 +284,7 @@ void GrRenderTargetOpList::gatherProxyIntervals(GrResourceAllocator* alloc) cons
unsigned int cur = alloc->numOps();
for (int i = 0; i < fDeferredProxies.count(); ++i) {
SkASSERT(!fDeferredProxies[i]->priv().isInstantiated());
SkASSERT(!fDeferredProxies[i]->isInstantiated());
// We give all the deferred proxies a write usage at the very start of flushing. This
// locks them out of being reused for the entire flush until they are read - and then
// they can be recycled. This is a bit unfortunate because a flush can proceed in waves

View File

@ -261,10 +261,9 @@ bool GrResourceAllocator::assign(int* startIndex, int* stopIndex,
? cur->proxy()->asRenderTargetProxy()->needsStencil()
: false;
if (cur->proxy()->priv().isInstantiated()) {
if (!GrSurfaceProxyPriv::AttachStencilIfNeeded(fResourceProvider,
cur->proxy()->priv().peekSurface(),
needsStencil)) {
if (cur->proxy()->isInstantiated()) {
if (!GrSurfaceProxyPriv::AttachStencilIfNeeded(
fResourceProvider, cur->proxy()->peekSurface(), needsStencil)) {
*outError = AssignError::kFailedProxyInstantiation;
}
@ -307,7 +306,7 @@ bool GrResourceAllocator::assign(int* startIndex, int* stopIndex,
cur->assign(std::move(surface));
} else {
SkASSERT(!cur->proxy()->priv().isInstantiated());
SkASSERT(!cur->proxy()->isInstantiated());
*outError = AssignError::kFailedProxyInstantiation;
}
@ -337,8 +336,7 @@ void GrResourceAllocator::dumpIntervals() {
for(const Interval* cur = fIntvlList.peekHead(); cur; cur = cur->next()) {
SkDebugf("{ %3d,%3d }: [%2d, %2d] - proxyRefs:%d surfaceRefs:%d R:%d W:%d\n",
cur->proxy()->uniqueID().asUInt(),
cur->proxy()->priv().isInstantiated() ? cur->proxy()->underlyingUniqueID().asUInt()
: -1,
cur->proxy()->isInstantiated() ? cur->proxy()->underlyingUniqueID().asUInt() : -1,
cur->start(),
cur->end(),
cur->proxy()->priv().getProxyRefCnt(),
@ -353,8 +351,7 @@ void GrResourceAllocator::dumpIntervals() {
for(const Interval* cur = fIntvlList.peekHead(); cur; cur = cur->next()) {
SkDebugf("{ %3d,%3d }: ",
cur->proxy()->uniqueID().asUInt(),
cur->proxy()->priv().isInstantiated() ? cur->proxy()->underlyingUniqueID().asUInt()
: -1);
cur->proxy()->isInstantiated() ? cur->proxy()->underlyingUniqueID().asUInt() : -1);
for (unsigned int i = min; i <= max; ++i) {
if (i >= cur->start() && i <= cur->end()) {
SkDebugf("x");

View File

@ -127,7 +127,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
return nullptr;
}
SkAssertResult(sContext->writePixels(srcInfo, mipLevel.fPixels, mipLevel.fRowBytes, 0, 0));
return sk_ref_sp(sContext->asTextureProxy()->priv().peekTexture());
return sk_ref_sp(sContext->asTextureProxy()->peekTexture());
} else {
return fGpu->createTexture(desc, budgeted, &mipLevel, 1);
}

View File

@ -231,7 +231,7 @@ bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int s
}
void GrSurfaceProxy::deInstantiate() {
SkASSERT(this->priv().isInstantiated());
SkASSERT(this->isInstantiated());
this->release();
}

View File

@ -17,26 +17,6 @@
data members or virtual methods. */
class GrSurfaceProxyPriv {
public:
bool isInstantiated() const { return SkToBool(fProxy->fTarget); }
// This should only be called after a successful call to instantiate
GrSurface* peekSurface() const {
SkASSERT(fProxy->fTarget);
return fProxy->fTarget;
}
// If the proxy is already instantiated, return its backing GrTexture; if not,
// return null
GrTexture* peekTexture() const {
return fProxy->fTarget ? fProxy->fTarget->asTexture() : nullptr;
}
// This should only be called after a successful call to instantiate
GrRenderTarget* peekRenderTarget() const {
SkASSERT(fProxy->fTarget && fProxy->fTarget->asRenderTarget());
return fProxy->fTarget ? fProxy->fTarget->asRenderTarget() : nullptr;
}
// Beware! Woe betide anyone whosoever calls this method.
// The refs on proxies and their backing GrSurfaces shift around based on whether the proxy
// is instantiated or not. Additionally, the lifetime of a proxy (and a GrSurface) also

View File

@ -72,7 +72,7 @@ void GrTextureOpList::dump(bool printDependencies) const {
#endif
void GrTextureOpList::onPrepare(GrOpFlushState* flushState) {
SkASSERT(fTarget.get()->priv().peekTexture());
SkASSERT(fTarget.get()->peekTexture());
SkASSERT(this->isClosed());
// Loop over the ops that haven't yet generated their geometry
@ -96,10 +96,10 @@ bool GrTextureOpList::onExecute(GrOpFlushState* flushState) {
return false;
}
SkASSERT(fTarget.get()->priv().peekTexture());
SkASSERT(fTarget.get()->peekTexture());
std::unique_ptr<GrGpuTextureCommandBuffer> commandBuffer(
flushState->gpu()->createCommandBuffer(fTarget.get()->priv().peekTexture(),
flushState->gpu()->createCommandBuffer(fTarget.get()->peekTexture(),
fTarget.get()->origin()));
flushState->setCommandBuffer(commandBuffer.get());
@ -158,8 +158,8 @@ bool GrTextureOpList::copySurface(GrContext* context,
void GrTextureOpList::purgeOpsWithUninstantiatedProxies() {
bool hasUninstantiatedProxy = false;
auto checkInstantiation = [ &hasUninstantiatedProxy ] (GrSurfaceProxy* p) {
if (!p->priv().isInstantiated()) {
auto checkInstantiation = [&hasUninstantiatedProxy](GrSurfaceProxy* p) {
if (!p->isInstantiated()) {
hasUninstantiatedProxy = true;
}
};

View File

@ -132,15 +132,15 @@ GrSamplerState::Filter GrTextureProxy::highestFilterMode() const {
}
GrMipMapped GrTextureProxy::mipMapped() const {
if (this->priv().isInstantiated()) {
return this->priv().peekTexture()->texturePriv().mipMapped();
if (this->isInstantiated()) {
return this->peekTexture()->texturePriv().mipMapped();
}
return fMipMapped;
}
size_t GrTextureProxy::onUninstantiatedGpuMemorySize() const {
return GrSurface::ComputeSize(this->config(), this->width(), this->height(), 1,
this->texPriv().proxyMipMapped(), !this->priv().isExact());
this->proxyMipMapped(), !this->priv().isExact());
}
void GrTextureProxy::setUniqueKey(GrProxyProvider* proxyProvider, const GrUniqueKey& key) {
@ -169,7 +169,7 @@ void GrTextureProxy::onValidateSurface(const GrSurface* surface) {
// Anything that is checked here should be duplicated in GrTextureRenderTargetProxy's version
SkASSERT(surface->asTexture());
SkASSERT(GrMipMapped::kNo == this->texPriv().proxyMipMapped() ||
SkASSERT(GrMipMapped::kNo == this->proxyMipMapped() ||
GrMipMapped::kYes == surface->asTexture()->texturePriv().mipMapped());
SkASSERT(surface->asTexture()->texturePriv().textureType() == fTextureType);
}

View File

@ -27,14 +27,6 @@ public:
// Clears any deferred uploader object on the proxy. Used to free the CPU data after the
// contents have been uploaded.
void resetDeferredUploader();
// Returns the GrMipMapped value of the proxy from creation time regardless of whether it has
// been instantiated or not.
GrMipMapped proxyMipMapped() const { return fTextureProxy->fMipMapped; }
GrTextureType textureType() const { return fTextureProxy->fTextureType; }
bool hasRestrictedSampling() const {
return GrTextureTypeHasRestrictedSampling(this->textureType());
}
private:
explicit GrTextureProxyPriv(GrTextureProxy* textureProxy) : fTextureProxy(textureProxy) {}

View File

@ -70,7 +70,7 @@ size_t GrTextureRenderTargetProxy::onUninstantiatedGpuMemorySize() const {
// TODO: do we have enough information to improve this worst case estimate?
return GrSurface::ComputeSize(this->config(), this->width(), this->height(),
colorSamplesPerPixel, this->texPriv().proxyMipMapped(),
colorSamplesPerPixel, this->proxyMipMapped(),
!this->priv().isExact());
}
@ -116,7 +116,7 @@ sk_sp<GrSurface> GrTextureRenderTargetProxy::createSurface(
void GrTextureRenderTargetProxy::onValidateSurface(const GrSurface* surface) {
// Anything checked here should also be checking the GrTextureProxy version
SkASSERT(surface->asTexture());
SkASSERT(GrMipMapped::kNo == this->texPriv().proxyMipMapped() ||
SkASSERT(GrMipMapped::kNo == this->proxyMipMapped() ||
GrMipMapped::kYes == surface->asTexture()->texturePriv().mipMapped());
// Anything checked here should also be checking the GrRenderTargetProxy version
@ -127,7 +127,7 @@ void GrTextureRenderTargetProxy::onValidateSurface(const GrSurface* surface) {
GrInternalSurfaceFlags surfaceFlags = surface->surfacePriv().flags();
SkASSERT((proxyFlags & GrInternalSurfaceFlags::kRenderTargetMask) ==
(surfaceFlags & GrInternalSurfaceFlags::kRenderTargetMask));
SkASSERT(surface->asTexture()->texturePriv().textureType() == this->texPriv().textureType());
SkASSERT(surface->asTexture()->texturePriv().textureType() == this->textureType());
}
#endif

View File

@ -95,7 +95,7 @@ GrCCAtlas::~GrCCAtlas() {
bool GrCCAtlas::addRect(const SkIRect& devIBounds, SkIVector* offset) {
// This can't be called anymore once makeRenderTargetContext() has been called.
SkASSERT(!fTextureProxy->priv().isInstantiated());
SkASSERT(!fTextureProxy->isInstantiated());
SkIPoint16 location;
if (!this->internalPlaceRect(devIBounds.width(), devIBounds.height(), &location)) {
@ -136,7 +136,7 @@ bool GrCCAtlas::internalPlaceRect(int w, int h, SkIPoint16* loc) {
void GrCCAtlas::setUserBatchID(int id) {
// This can't be called anymore once makeRenderTargetContext() has been called.
SkASSERT(!fTextureProxy->priv().isInstantiated());
SkASSERT(!fTextureProxy->isInstantiated());
fUserBatchID = id;
}
@ -153,7 +153,7 @@ const GrUniqueKey& GrCCAtlas::getOrAssignUniqueKey(GrOnFlushResourceProvider* on
builder[0] = next_atlas_unique_id();
builder.finish();
if (fTextureProxy->priv().isInstantiated()) {
if (fTextureProxy->isInstantiated()) {
onFlushRP->assignUniqueKeyToProxy(fUniqueKey, fTextureProxy.get());
}
}
@ -169,7 +169,7 @@ sk_sp<GrCCAtlas::CachedAtlasInfo> GrCCAtlas::refOrMakeCachedAtlasInfo() {
sk_sp<GrRenderTargetContext> GrCCAtlas::makeRenderTargetContext(
GrOnFlushResourceProvider* onFlushRP, sk_sp<GrTexture> backingTexture) {
SkASSERT(!fTextureProxy->priv().isInstantiated()); // This method should only be called once.
SkASSERT(!fTextureProxy->isInstantiated()); // This method should only be called once.
// Caller should have cropped any paths to the destination render target instead of asking for
// an atlas larger than maxRenderTargetSize.
SkASSERT(SkTMax(fHeight, fWidth) <= fMaxTextureSize);

View File

@ -38,7 +38,7 @@ void GrCCClipPath::init(const SkPath& deviceSpacePath, const SkIRect& accessRect
fDevToAtlasOffset.fY * fAtlasScale.y());
SkDEBUGCODE(fHasAtlasTransform = true);
return sk_ref_sp(textureProxy->priv().peekTexture());
return sk_ref_sp(textureProxy->peekTexture());
},
GrProxyProvider::Renderable::kYes, kTopLeft_GrSurfaceOrigin, kAlpha_half_GrPixelConfig,
caps);

View File

@ -287,7 +287,7 @@ bool GrCCPerFlushResources::finalize(GrOnFlushResourceProvider* onFlushRP,
sk_sp<GrTexture> backingTexture;
if (stashedAtlasProxy && atlas->currentWidth() == stashedAtlasProxy->width() &&
atlas->currentHeight() == stashedAtlasProxy->height()) {
backingTexture = sk_ref_sp(stashedAtlasProxy->priv().peekTexture());
backingTexture = sk_ref_sp(stashedAtlasProxy->peekTexture());
stashedAtlasProxy = nullptr;
}

View File

@ -107,7 +107,7 @@ void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
GrSurfaceProxy* proxy = processor.textureSampler(0).proxy();
GrTexture* texture = proxy->priv().peekTexture();
GrTexture* texture = proxy->peekTexture();
float imageIncrement[2];
imageIncrement[0] = 1.0f / texture->width();

View File

@ -299,7 +299,7 @@ private:
auto solidRadius = _outer.solidRadius();
(void)solidRadius;
GrSurfaceProxy& blurProfileSamplerProxy = *_outer.textureSampler(0).proxy();
GrTexture& blurProfileSampler = *blurProfileSamplerProxy.priv().peekTexture();
GrTexture& blurProfileSampler = *blurProfileSamplerProxy.peekTexture();
(void)blurProfileSampler;
UniformHandle& circleData = fCircleDataVar;
(void)circleData;

View File

@ -121,7 +121,7 @@ void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrGaussianConvolutionFragmentProcessor& conv =
processor.cast<GrGaussianConvolutionFragmentProcessor>();
GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
GrTexture& texture = *proxy->priv().peekTexture();
GrTexture& texture = *proxy->peekTexture();
float imageIncrement[2] = {0};
float ySign = proxy->origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;

View File

@ -83,7 +83,7 @@ private:
pdman.set1f(fYInvInsetVar, _outer.yInvInset());
}
GrSurfaceProxy& srcProxy = *_outer.textureSampler(0).proxy();
GrTexture& src = *srcProxy.priv().peekTexture();
GrTexture& src = *srcProxy.peekTexture();
(void)src;
auto bounds = _outer.bounds();
(void)bounds;

View File

@ -126,7 +126,7 @@ void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdma
const GrFragmentProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
GrTexture* texture = proxy->priv().peekTexture();
GrTexture* texture = proxy->peekTexture();
float imageIncrement[2];
float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;

View File

@ -108,7 +108,7 @@ private:
UniformHandle& cornerRadius = fCornerRadiusVar;
(void)cornerRadius;
GrSurfaceProxy& ninePatchSamplerProxy = *_outer.textureSampler(0).proxy();
GrTexture& ninePatchSampler = *ninePatchSamplerProxy.priv().peekTexture();
GrTexture& ninePatchSampler = *ninePatchSamplerProxy.peekTexture();
(void)ninePatchSampler;
UniformHandle& proxyRect = fProxyRectVar;
(void)proxyRect;

View File

@ -114,7 +114,7 @@ private:
auto sigma = _outer.sigma();
(void)sigma;
GrSurfaceProxy& blurProfileProxy = *_outer.textureSampler(0).proxy();
GrTexture& blurProfile = *blurProfileProxy.priv().peekTexture();
GrTexture& blurProfile = *blurProfileProxy.peekTexture();
(void)blurProfile;
UniformHandle& proxyRectHalf = fProxyRectHalfVar;
(void)proxyRectHalf;

View File

@ -162,7 +162,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
GrSurfaceProxy* proxy) {
GrTexture* tex = proxy->priv().peekTexture();
GrTexture* tex = proxy->peekTexture();
SkASSERT(fHasMode && textureDomain.mode() == fMode);
if (kIgnore_Mode != textureDomain.mode()) {
SkScalar wInv = SK_Scalar1 / tex->width();
@ -383,7 +383,7 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
GrSurfaceProxy* proxy = dstdfp.textureSampler(0).proxy();
GrTexture* texture = proxy->priv().peekTexture();
GrTexture* texture = proxy->peekTexture();
fGLDomain.setData(pdman, dstdfp.fTextureDomain, proxy);
float iw = 1.f / texture->width();

View File

@ -2185,8 +2185,8 @@ bool GrGLCaps::canCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* s
const GrTextureProxy* dstTex = dst->asTextureProxy();
const GrTextureProxy* srcTex = src->asTextureProxy();
bool dstIsTex2D = dstTex ? (dstTex->texPriv().textureType() == GrTextureType::k2D) : false;
bool srcIsTex2D = srcTex ? (srcTex->texPriv().textureType() == GrTextureType::k2D) : false;
bool dstIsTex2D = dstTex ? (dstTex->textureType() == GrTextureType::k2D) : false;
bool srcIsTex2D = srcTex ? (srcTex->textureType() == GrTextureType::k2D) : false;
// One of the possible requirements for copy as blit is that the srcRect must match the bounds
// of the src surface. If we have a approx fit surface we can't know for sure what the src
@ -2234,7 +2234,7 @@ bool GrGLCaps::initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc*
{
// The only way we could see a non-GR_GL_TEXTURE_2D texture would be if it were
// wrapped. In that case the proxy would already be instantiated.
const GrTexture* srcTexture = src->priv().peekTexture();
const GrTexture* srcTexture = src->peekTexture();
const GrGLTexture* glSrcTexture = static_cast<const GrGLTexture*>(srcTexture);
if (glSrcTexture && glSrcTexture->target() != GR_GL_TEXTURE_2D) {
// Not supported for FBO blit or CopyTexSubImage

View File

@ -87,7 +87,7 @@ void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath*
SkASSERT(gpu->caps()->shaderCaps()->pathRenderingSupport());
gpu->flushColorWrite(false);
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fProxy->priv().peekRenderTarget());
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fProxy->peekRenderTarget());
SkISize size = SkISize::Make(rt->width(), rt->height());
this->setProjectionMatrix(*args.fViewMatrix, size, args.fProxy->origin());
gpu->flushScissor(*args.fScissor, rt->getViewport(), args.fProxy->origin());

View File

@ -149,7 +149,7 @@ void GrGLProgram::setFragmentData(const GrPipeline& pipeline, int* nextTexSample
void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
const GrRenderTargetProxy* proxy) {
GrRenderTarget* rt = proxy->priv().peekRenderTarget();
GrRenderTarget* rt = proxy->peekRenderTarget();
// Load the RT height uniform if it is needed to y-flip gl_FragCoord.
if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
fRenderTargetState.fRenderTargetSize.fHeight != rt->height()) {

View File

@ -88,6 +88,6 @@ void GrCopySurfaceOp::onExecute(GrOpFlushState* state) {
return;
}
state->commandBuffer()->copy(fSrc.get()->priv().peekSurface(), fSrc.get()->origin(),
fSrcRect, fDstPoint);
state->commandBuffer()->copy(fSrc.get()->peekSurface(), fSrc.get()->origin(), fSrcRect,
fDstPoint);
}

View File

@ -842,7 +842,7 @@ __attribute__((no_sanitize("float-cast-overflow")))
float iw[kMaxTextures];
float ih[kMaxTextures];
for (int t = 0; t < fProxyCnt; ++t) {
const auto* texture = proxies[t]->priv().peekTexture();
const auto* texture = proxies[t]->peekTexture();
iw[t] = 1.f / texture->width();
ih[t] = 1.f / texture->height();
}
@ -986,7 +986,7 @@ __attribute__((no_sanitize("float-cast-overflow")))
if (thatProxies[j]->config() != config) {
return -1;
}
if (GrTexture* tex = thatProxies[j]->priv().peekTexture()) {
if (GrTexture* tex = thatProxies[j]->peekTexture()) {
if (tex->texturePriv().textureType() != GrTextureType::k2D) {
return -1;
}

View File

@ -209,9 +209,9 @@ void GrVkPipelineState::setData(GrVkGpu* gpu,
}
if (GrTextureProxy* dstTextureProxy = pipeline.dstTextureProxy()) {
samplerBindings[currTextureBinding++] =
{GrSamplerState::ClampNearest(),
static_cast<GrVkTexture*>(dstTextureProxy->priv().peekTexture())};
samplerBindings[currTextureBinding++] = {
GrSamplerState::ClampNearest(),
static_cast<GrVkTexture*>(dstTextureProxy->peekTexture())};
}
// Get new descriptor sets
@ -345,7 +345,7 @@ void GrVkPipelineState::writeSamplers(GrVkGpu* gpu, const SamplerBindings bindin
}
void GrVkPipelineState::setRenderTargetState(const GrRenderTargetProxy* proxy) {
GrRenderTarget* rt = proxy->priv().peekRenderTarget();
GrRenderTarget* rt = proxy->peekRenderTarget();
// Load the RT height uniform if it is needed to y-flip gl_FragCoord.
if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&

View File

@ -160,7 +160,7 @@ GrBackendTexture SkImage_Gpu::onGetBackendTexture(bool flushPendingGrContextIO,
GrSurfaceOrigin* origin) const {
SkASSERT(fProxy);
if (!fContext->contextPriv().resourceProvider() && !fProxy->priv().isInstantiated()) {
if (!fContext->contextPriv().resourceProvider() && !fProxy->isInstantiated()) {
// This image was created with a DDL context and cannot be instantiated.
return GrBackendTexture();
}
@ -169,7 +169,7 @@ GrBackendTexture SkImage_Gpu::onGetBackendTexture(bool flushPendingGrContextIO,
return GrBackendTexture(); // invalid
}
GrTexture* texture = fProxy->priv().peekTexture();
GrTexture* texture = fProxy->peekTexture();
if (texture) {
if (flushPendingGrContextIO) {
@ -189,7 +189,7 @@ GrTexture* SkImage_Gpu::onGetTexture() const {
return nullptr;
}
if (!fContext->contextPriv().resourceProvider() && !fProxy->priv().isInstantiated()) {
if (!fContext->contextPriv().resourceProvider() && !fProxy->isInstantiated()) {
// This image was created with a DDL context and cannot be instantiated.
return nullptr;
}
@ -198,7 +198,7 @@ GrTexture* SkImage_Gpu::onGetTexture() const {
return nullptr;
}
return proxy->priv().peekTexture();
return proxy->peekTexture();
}
bool SkImage_Gpu::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
@ -776,7 +776,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk
if (!proxy->instantiate(context->contextPriv().resourceProvider())) {
return codecImage;
}
sk_sp<GrTexture> texture = sk_ref_sp(proxy->priv().peekTexture());
sk_sp<GrTexture> texture = sk_ref_sp(proxy->peekTexture());
// Flush any writes or uploads
context->contextPriv().prepareSurfaceForExternalIO(proxy.get());
@ -845,7 +845,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromPixmap(GrContext* context,
return SkImage::MakeRasterCopy(*pixmap);
}
sk_sp<GrTexture> texture = sk_ref_sp(proxy->priv().peekTexture());
sk_sp<GrTexture> texture = sk_ref_sp(proxy->peekTexture());
// Flush any writes or uploads
context->contextPriv().prepareSurfaceForExternalIO(proxy.get());

View File

@ -610,7 +610,7 @@ void CPPCodeGenerator::writeSetData(std::vector<const Variable*>& uniforms) {
this->writef(" GrSurfaceProxy& %sProxy = "
"*_outer.textureSampler(%d).proxy();\n",
name, samplerIndex);
this->writef(" GrTexture& %s = *%sProxy.priv().peekTexture();\n",
this->writef(" GrTexture& %s = *%sProxy.peekTexture();\n",
name, name);
this->writef(" (void) %s;\n", name);
++samplerIndex;

View File

@ -1511,7 +1511,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ClipMaskCache, reporter, ctxInfo) {
stack.clipPath(path, m, SkClipOp::kIntersect, true);
sk_sp<GrTextureProxy> mask = GrClipStackClip(&stack).testingOnly_createClipMask(context);
mask->instantiate(context->contextPriv().resourceProvider());
GrTexture* tex = mask->priv().peekTexture();
GrTexture* tex = mask->peekTexture();
REPORTER_ASSERT(reporter, 0 == strcmp(tex->getUniqueKey().tag(), kTag));
// Make sure mask isn't pinned in cache.
mask.reset(nullptr);

View File

@ -873,9 +873,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLTextureFlagsTest, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, backingProxy->mipMapped() == mipMapped);
if (GR_GL_TEXTURE_2D == target) {
REPORTER_ASSERT(reporter, !backingProxy->texPriv().hasRestrictedSampling());
REPORTER_ASSERT(reporter, !backingProxy->hasRestrictedSampling());
} else {
REPORTER_ASSERT(reporter, backingProxy->texPriv().hasRestrictedSampling());
REPORTER_ASSERT(reporter, backingProxy->hasRestrictedSampling());
}
}
}

View File

@ -47,7 +47,7 @@ static const int kAtlasSize = kNumPlots * kPlotSize;
int GrDrawOpAtlas::numAllocated_TestingOnly() const {
int count = 0;
for (uint32_t i = 0; i < this->maxPages(); ++i) {
if (fProxies[i]->priv().isInstantiated()) {
if (fProxies[i]->isInstantiated()) {
++count;
}
}

View File

@ -169,15 +169,13 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
GrTextureProxy* proxy = surfaceContext->asTextureProxy();
REPORTER_ASSERT(reporter, proxy->mipMapped() == GrMipMapped::kNo);
REPORTER_ASSERT(reporter,
proxy->priv().peekTexture()->texturePriv().mipMapped() == GrMipMapped::kNo);
REPORTER_ASSERT(reporter, proxy->peekTexture()->texturePriv().mipMapped() == GrMipMapped::kNo);
REPORTER_ASSERT(reporter, proxy->texPriv().textureType() == GrTextureType::kExternal);
REPORTER_ASSERT(
reporter,
proxy->priv().peekTexture()->texturePriv().textureType() == GrTextureType::kExternal);
REPORTER_ASSERT(reporter, proxy->texPriv().hasRestrictedSampling());
REPORTER_ASSERT(reporter, proxy->priv().peekTexture()->texturePriv().hasRestrictedSampling());
REPORTER_ASSERT(reporter, proxy->textureType() == GrTextureType::kExternal);
REPORTER_ASSERT(reporter,
proxy->peekTexture()->texturePriv().textureType() == GrTextureType::kExternal);
REPORTER_ASSERT(reporter, proxy->hasRestrictedSampling());
REPORTER_ASSERT(reporter, proxy->peekTexture()->texturePriv().hasRestrictedSampling());
// Should not be able to wrap as a RT
{

View File

@ -73,9 +73,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) {
return;
}
REPORTER_ASSERT(reporter, proxy->priv().isInstantiated());
REPORTER_ASSERT(reporter, proxy->isInstantiated());
GrTexture* texture = proxy->priv().peekTexture();
GrTexture* texture = proxy->peekTexture();
REPORTER_ASSERT(reporter, texture);
if (!texture) {
gpu->deleteTestingOnlyBackendTexture(backendTex);
@ -124,9 +124,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
return;
}
REPORTER_ASSERT(reporter, proxy->priv().isInstantiated());
REPORTER_ASSERT(reporter, proxy->isInstantiated());
sk_sp<GrTexture> texture = sk_ref_sp(proxy->priv().peekTexture());
sk_sp<GrTexture> texture = sk_ref_sp(proxy->peekTexture());
REPORTER_ASSERT(reporter, texture);
if (!texture) {
gpu->deleteTestingOnlyBackendTexture(backendTex);
@ -156,17 +156,17 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
if (GrSurfaceProxy::LazyState::kNot != genProxy->lazyInstantiationState()) {
genProxy->priv().doLazyInstantiation(context->contextPriv().resourceProvider());
} else if (!genProxy->priv().isInstantiated()) {
} else if (!genProxy->isInstantiated()) {
genProxy->instantiate(context->contextPriv().resourceProvider());
}
REPORTER_ASSERT(reporter, genProxy->priv().isInstantiated());
if (!genProxy->priv().isInstantiated()) {
REPORTER_ASSERT(reporter, genProxy->isInstantiated());
if (!genProxy->isInstantiated()) {
gpu->deleteTestingOnlyBackendTexture(backendTex);
return;
}
GrTexture* genTexture = genProxy->priv().peekTexture();
GrTexture* genTexture = genProxy->peekTexture();
REPORTER_ASSERT(reporter, genTexture);
if (!genTexture) {
gpu->deleteTestingOnlyBackendTexture(backendTex);
@ -260,7 +260,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped());
texProxy->instantiate(resourceProvider);
GrTexture* texture = texProxy->priv().peekTexture();
GrTexture* texture = texProxy->peekTexture();
REPORTER_ASSERT(reporter, mipMapped == texture->texturePriv().mipMapped());
sk_sp<SkImage> image = surface->makeImageSnapshot();
@ -272,7 +272,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped());
texProxy->instantiate(resourceProvider);
texture = texProxy->priv().peekTexture();
texture = texProxy->peekTexture();
REPORTER_ASSERT(reporter, mipMapped == texture->texturePriv().mipMapped());
// Must flush the context to make sure all the cmds (copies, etc.) from above are sent

View File

@ -224,7 +224,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ct
if (!srcProxy->instantiate(context->contextPriv().resourceProvider())) {
return;
}
GrTexture* tex = srcProxy->priv().peekTexture();
GrTexture* tex = srcProxy->peekTexture();
GrBackendTexture backendTex = tex->getBackendTexture();

View File

@ -131,7 +131,7 @@ public:
REPORTER_ASSERT(fTest->fReporter, !fTest->fHasClipTexture);
fTest->fHasClipTexture = true;
fAtlas->instantiate(rp);
return sk_ref_sp(fAtlas->priv().peekTexture());
return sk_ref_sp(fAtlas->peekTexture());
},
GrProxyProvider::Renderable::kYes,
kBottomLeft_GrSurfaceOrigin,

View File

@ -35,8 +35,8 @@ static sk_sp<GrSurfaceProxy> make_wrapped_rt(GrProxyProvider* provider,
void clean_up_wrapped_rt(GrGpu* gpu, sk_sp<GrSurfaceProxy> proxy) {
SkASSERT(proxy->isUnique_debugOnly());
SkASSERT(proxy->priv().peekRenderTarget());
GrBackendRenderTarget rt = proxy->priv().peekRenderTarget()->getBackendRenderTarget();
SkASSERT(proxy->peekRenderTarget());
GrBackendRenderTarget rt = proxy->peekRenderTarget()->getBackendRenderTarget();
proxy.reset();
gpu->deleteTestingOnlyBackendRenderTarget(rt);
}

View File

@ -47,9 +47,9 @@ static void check_rendertarget(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, rtProxy->numStencilSamples() == numSamples);
GrSurfaceProxy::UniqueID idBefore = rtProxy->uniqueID();
bool preinstantiated = rtProxy->priv().isInstantiated();
bool preinstantiated = rtProxy->isInstantiated();
REPORTER_ASSERT(reporter, rtProxy->instantiate(provider));
GrRenderTarget* rt = rtProxy->priv().peekRenderTarget();
GrRenderTarget* rt = rtProxy->peekRenderTarget();
REPORTER_ASSERT(reporter, rtProxy->uniqueID() == idBefore);
// Deferred resources should always have a different ID from their instantiated rendertarget
@ -80,9 +80,9 @@ static void check_texture(skiatest::Reporter* reporter,
SkBackingFit fit) {
GrSurfaceProxy::UniqueID idBefore = texProxy->uniqueID();
bool preinstantiated = texProxy->priv().isInstantiated();
bool preinstantiated = texProxy->isInstantiated();
REPORTER_ASSERT(reporter, texProxy->instantiate(provider));
GrTexture* tex = texProxy->priv().peekTexture();
GrTexture* tex = texProxy->peekTexture();
REPORTER_ASSERT(reporter, texProxy->uniqueID() == idBefore);
// Deferred resources should always have a different ID from their instantiated texture

View File

@ -139,13 +139,13 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
}
SkASSERT(rectProxy->mipMapped() == GrMipMapped::kNo);
SkASSERT(rectProxy->priv().peekTexture()->texturePriv().mipMapped() == GrMipMapped::kNo);
SkASSERT(rectProxy->peekTexture()->texturePriv().mipMapped() == GrMipMapped::kNo);
SkASSERT(rectProxy->texPriv().textureType() == GrTextureType::kRectangle);
SkASSERT(rectProxy->priv().peekTexture()->texturePriv().textureType() ==
SkASSERT(rectProxy->textureType() == GrTextureType::kRectangle);
SkASSERT(rectProxy->peekTexture()->texturePriv().textureType() ==
GrTextureType::kRectangle);
SkASSERT(rectProxy->texPriv().hasRestrictedSampling());
SkASSERT(rectProxy->priv().peekTexture()->texturePriv().hasRestrictedSampling());
SkASSERT(rectProxy->hasRestrictedSampling());
SkASSERT(rectProxy->peekTexture()->texturePriv().hasRestrictedSampling());
test_basic_draw_as_src(reporter, context, rectProxy, refPixels);

View File

@ -91,8 +91,8 @@ static void overlap_test(skiatest::Reporter* reporter, GrResourceProvider* resou
alloc.assign(&startIndex, &stopIndex, &uninstantiateTracker, &error);
REPORTER_ASSERT(reporter, GrResourceAllocator::AssignError::kNoError == error);
REPORTER_ASSERT(reporter, p1->priv().peekSurface());
REPORTER_ASSERT(reporter, p2->priv().peekSurface());
REPORTER_ASSERT(reporter, p1->peekSurface());
REPORTER_ASSERT(reporter, p2->peekSurface());
bool doTheBackingStoresMatch = p1->underlyingUniqueID() == p2->underlyingUniqueID();
REPORTER_ASSERT(reporter, expectedResult == doTheBackingStoresMatch);
}
@ -114,8 +114,8 @@ static void non_overlap_test(skiatest::Reporter* reporter, GrResourceProvider* r
alloc.assign(&startIndex, &stopIndex, &uninstantiateTracker, &error);
REPORTER_ASSERT(reporter, GrResourceAllocator::AssignError::kNoError == error);
REPORTER_ASSERT(reporter, p1->priv().peekSurface());
REPORTER_ASSERT(reporter, p2->priv().peekSurface());
REPORTER_ASSERT(reporter, p1->peekSurface());
REPORTER_ASSERT(reporter, p2->peekSurface());
bool doTheBackingStoresMatch = p1->underlyingUniqueID() == p2->underlyingUniqueID();
REPORTER_ASSERT(reporter, expectedResult == doTheBackingStoresMatch);
}

View File

@ -150,7 +150,7 @@ static void basic_test(GrContext* context,
// Once instantiated, the backing resource should have the same key
SkAssertResult(proxy->instantiate(resourceProvider));
const GrUniqueKey& texKey = proxy->priv().peekSurface()->getUniqueKey();
const GrUniqueKey& texKey = proxy->peekSurface()->getUniqueKey();
REPORTER_ASSERT(reporter, texKey.isValid());
REPORTER_ASSERT(reporter, key == texKey);
if (proxyIsCached) {
@ -266,7 +266,7 @@ static void invalidation_and_instantiation_test(GrContext* context, skiatest::Re
SkAssertResult(proxy->instantiate(resourceProvider));
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
REPORTER_ASSERT(reporter, !proxy->priv().peekTexture()->getUniqueKey().isValid());
REPORTER_ASSERT(reporter, !proxy->peekTexture()->getUniqueKey().isValid());
REPORTER_ASSERT(reporter, 0 == proxyProvider->numUniqueKeyProxies_TestOnly());
REPORTER_ASSERT(reporter, 1 == cache->getResourceCount());

View File

@ -64,8 +64,8 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkImageLayoutTest, reporter, ctxInfo) {
sk_sp<GrTextureProxy> texProxy = as_IB(wrappedImage)->asTextureProxyRef();
REPORTER_ASSERT(reporter, texProxy.get());
REPORTER_ASSERT(reporter, texProxy->priv().isInstantiated());
GrTexture* texture = texProxy->priv().peekTexture();
REPORTER_ASSERT(reporter, texProxy->isInstantiated());
GrTexture* texture = texProxy->peekTexture();
REPORTER_ASSERT(reporter, texture);
// Verify that modifying the layout via the GrVkTexture is reflected in the GrBackendTexture