Have GrSurfaceProxys and GrGpuResources draw from the same pool of unique ids
The idea here is that, for wrapped Proxy objects, we want the uniqueID to reflect that of the wrapped object. For this to work the IDs for the non-wrapped versions can't conflict with GrGpuResource's pool of IDs.
Split off of: https://codereview.chromium.org/2215323003/ (Start using RenderTargetProxy (omnibus))
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2301523003
Review-Url: https://codereview.chromium.org/2301523003
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index fb7cb8c..9305c16 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -180,7 +180,7 @@
* not change when the content of the GrGpuResource object changes. This will never return
* 0.
*/
- uint32_t getUniqueID() const { return fUniqueID; }
+ uint32_t uniqueID() const { return fUniqueID; }
/** Returns the current unique key for the resource. It will be invalid if the resource has no
associated unique key. */
@@ -217,6 +217,8 @@
**/
virtual void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
+ static uint32_t CreateUniqueID();
+
protected:
// This must be called by every non-wrapped GrGpuObject. It should be called once the object is
// fully initialized (i.e. only from the constructors of the final class).
@@ -279,9 +281,6 @@
#ifdef SK_DEBUG
friend class GrGpu; // for assert in GrGpu to access getGpu
#endif
-
- static uint32_t CreateUniqueID();
-
// An index into a heap when this resource is purgeable or an array when not. This is maintained
// by the cache.
int fCacheArrayIndex;
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 01c5267..ad2ea91 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -41,11 +41,21 @@
virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return nullptr; }
protected:
+ // Deferred version
GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted)
: fDesc(desc)
, fFit(fit)
, fBudgeted(budgeted)
- , fUniqueID(CreateUniqueID()) {
+ , fUniqueID(GrGpuResource::CreateUniqueID()) {
+ }
+
+ // Wrapped version
+ GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit,
+ SkBudgeted budgeted, uint32_t uniqueID)
+ : fDesc(desc)
+ , fFit(fit)
+ , fBudgeted(budgeted)
+ , fUniqueID(uniqueID) {
}
virtual ~GrSurfaceProxy() {}
@@ -54,10 +64,9 @@
const GrSurfaceDesc fDesc;
const SkBackingFit fFit; // always exact for wrapped resources
const SkBudgeted fBudgeted; // set from the backing resource for wrapped resources
- const uint32_t fUniqueID;
+ const uint32_t fUniqueID; // set from the backing resource for wrapped resources
private:
- static uint32_t CreateUniqueID();
// See comment in GrGpuResource.h.
void notifyAllCntsAreZero(CntType) const { delete this; }
diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h
index eb82ca7..63cb3c8 100644
--- a/include/private/GrTextureProxy.h
+++ b/include/private/GrTextureProxy.h
@@ -30,12 +30,9 @@
GrTexture* instantiate(GrTextureProvider* texProvider);
private:
- GrTextureProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted,
- const void* /*srcData*/, size_t /*rowBytes*/)
- : INHERITED(desc, fit, budgeted) {
- // TODO: Handle 'srcData' here
- }
-
+ // Deferred version
+ GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit, SkBudgeted,
+ const void* srcData, size_t srcRowBytes);
// Wrapped version
GrTextureProxy(sk_sp<GrTexture> tex);
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index f568f7e..3b9f1ec 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -116,7 +116,7 @@
#ifdef SK_DEBUG
void GrDrawTarget::dump() const {
SkDebugf("--------------------------------------------------------------\n");
- SkDebugf("node: %d -> RT: %d\n", fDebugID, fRenderTarget ? fRenderTarget->getUniqueID() : -1);
+ SkDebugf("node: %d -> RT: %d\n", fDebugID, fRenderTarget ? fRenderTarget->uniqueID() : -1);
SkDebugf("relies On (%d): ", fDependencies.count());
for (int i = 0; i < fDependencies.count(); ++i) {
SkDebugf("%d, ", fDependencies[i]->fDebugID);
@@ -452,7 +452,7 @@
// remove all the previously recorded batches and change the load op to clear with supplied
// color.
if (fLastFullClearBatch &&
- fLastFullClearBatch->renderTargetUniqueID() == renderTarget->getUniqueID()) {
+ fLastFullClearBatch->renderTargetUniqueID() == renderTarget->uniqueID()) {
// As currently implemented, fLastFullClearBatch should be the last batch because we would
// have cleared it when another batch was recorded.
SkASSERT(fRecordedBatches.back().fBatch.get() == fLastFullClearBatch);
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index 49b9349..e64339b 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -69,7 +69,7 @@
void GrGpuResource::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
// Dump resource as "skia/gpu_resources/resource_#".
SkString dumpName("skia/gpu_resources/resource_");
- dumpName.appendS32(this->getUniqueID());
+ dumpName.appendS32(this->uniqueID());
traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", this->gpuMemorySize());
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 3d6587f..fa6bd26 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -32,7 +32,8 @@
// Wrapped version
GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, sk_sp<GrRenderTarget> rt)
- : INHERITED(rt->desc(), SkBackingFit::kExact, rt->resourcePriv().isBudgeted())
+ : INHERITED(rt->desc(), SkBackingFit::kExact,
+ rt->resourcePriv().isBudgeted(), rt->uniqueID())
, fTarget(std::move(rt))
, fFlags(fTarget->renderTargetPriv().flags())
, fLastDrawTarget(nullptr) {
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index b8b5d75..f5c401f 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -7,13 +7,3 @@
#include "GrSurfaceProxy.h"
-#include "SkAtomics.h"
-
-uint32_t GrSurfaceProxy::CreateUniqueID() {
- static int32_t gUniqueID = SK_InvalidUniqueID;
- uint32_t id;
- do {
- id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
- } while (id == SK_InvalidUniqueID);
- return id;
-}
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index f28b29e..205dfdd 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -10,8 +10,15 @@
#include "GrTextureProvider.h"
#include "GrGpuResourcePriv.h"
+GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted,
+ const void* /*srcData*/, size_t /*rowBytes*/)
+ : INHERITED(srcDesc, fit, budgeted) {
+ // TODO: Handle 'srcData' here
+}
+
GrTextureProxy::GrTextureProxy(sk_sp<GrTexture> tex)
- : INHERITED(tex->desc(), SkBackingFit::kExact, tex->resourcePriv().isBudgeted())
+ : INHERITED(tex->desc(), SkBackingFit::kExact,
+ tex->resourcePriv().isBudgeted(), tex->uniqueID())
, fTexture(std::move(tex)) {
}
diff --git a/src/gpu/batches/GrClearBatch.h b/src/gpu/batches/GrClearBatch.h
index 7d84bc3..27e19fa 100644
--- a/src/gpu/batches/GrClearBatch.h
+++ b/src/gpu/batches/GrClearBatch.h
@@ -29,7 +29,7 @@
const char* name() const override { return "Clear"; }
- uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()->getUniqueID(); }
+ uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()->uniqueID(); }
GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
SkString dumpInfo() const override {
@@ -38,7 +38,7 @@
const SkIRect& r = fClip.scissorRect();
string.appendf("L: %d, T: %d, R: %d, B: %d", r.fLeft, r.fTop, r.fRight, r.fBottom);
}
- string.appendf("], Color: 0x%08x, RT: %d", fColor, fRenderTarget.get()->getUniqueID());
+ string.appendf("], Color: 0x%08x, RT: %d", fColor, fRenderTarget.get()->uniqueID());
string.append(INHERITED::dumpInfo());
return string;
}
diff --git a/src/gpu/batches/GrClearStencilClipBatch.h b/src/gpu/batches/GrClearStencilClipBatch.h
index d13d3dc..e510821 100644
--- a/src/gpu/batches/GrClearStencilClipBatch.h
+++ b/src/gpu/batches/GrClearStencilClipBatch.h
@@ -31,7 +31,7 @@
const char* name() const override { return "ClearStencilClip"; }
- uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()->getUniqueID(); }
+ uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()->uniqueID(); }
GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
SkString dumpInfo() const override {
@@ -40,7 +40,7 @@
const SkIRect& r = fClip.scissorRect();
string.appendf("L: %d, T: %d, R: %d, B: %d", r.fLeft, r.fTop, r.fRight, r.fBottom);
}
- string.appendf("], IC: %d, RT: %d", fInsideStencilMask, fRenderTarget.get()->getUniqueID());
+ string.appendf("], IC: %d, RT: %d", fInsideStencilMask, fRenderTarget.get()->uniqueID());
string.append(INHERITED::dumpInfo());
return string;
}
diff --git a/src/gpu/batches/GrCopySurfaceBatch.h b/src/gpu/batches/GrCopySurfaceBatch.h
index 05b30b2..fea8aae 100644
--- a/src/gpu/batches/GrCopySurfaceBatch.h
+++ b/src/gpu/batches/GrCopySurfaceBatch.h
@@ -34,7 +34,7 @@
uint32_t renderTargetUniqueID() const override {
GrRenderTarget* rt = fDst.get()->asRenderTarget();
- return rt ? rt->getUniqueID() : 0;
+ return rt ? rt->uniqueID() : 0;
}
GrRenderTarget* renderTarget() const override { return nullptr; }
diff --git a/src/gpu/batches/GrDiscardBatch.h b/src/gpu/batches/GrDiscardBatch.h
index 5dafe54..33ffa25 100644
--- a/src/gpu/batches/GrDiscardBatch.h
+++ b/src/gpu/batches/GrDiscardBatch.h
@@ -26,12 +26,12 @@
const char* name() const override { return "Discard"; }
- uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()->getUniqueID(); }
+ uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()->uniqueID(); }
GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
SkString dumpInfo() const override {
SkString string;
- string.printf("RT: %d", fRenderTarget.get()->getUniqueID());
+ string.printf("RT: %d", fRenderTarget.get()->uniqueID());
string.append(INHERITED::dumpInfo());
return string;
}
diff --git a/src/gpu/batches/GrDrawBatch.h b/src/gpu/batches/GrDrawBatch.h
index 0386650..5f37b7b 100644
--- a/src/gpu/batches/GrDrawBatch.h
+++ b/src/gpu/batches/GrDrawBatch.h
@@ -76,7 +76,7 @@
uint32_t renderTargetUniqueID() const final {
SkASSERT(fPipelineInstalled);
- return this->pipeline()->getRenderTarget()->getUniqueID();
+ return this->pipeline()->getRenderTarget()->uniqueID();
}
GrRenderTarget* renderTarget() const final {
diff --git a/src/gpu/batches/GrStencilPathBatch.h b/src/gpu/batches/GrStencilPathBatch.h
index cc55659..f505a53 100644
--- a/src/gpu/batches/GrStencilPathBatch.h
+++ b/src/gpu/batches/GrStencilPathBatch.h
@@ -33,7 +33,7 @@
const char* name() const override { return "StencilPath"; }
- uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()->getUniqueID(); }
+ uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()->uniqueID(); }
GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
SkString dumpInfo() const override {
diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h
index ae7c694..65b515a 100644
--- a/src/gpu/effects/GrSingleTextureEffect.h
+++ b/src/gpu/effects/GrSingleTextureEffect.h
@@ -26,7 +26,7 @@
SkString dumpInfo() const override {
SkString str;
- str.appendf("Texture: %d", fTextureAccess.getTexture()->getUniqueID());
+ str.appendf("Texture: %d", fTextureAccess.getTexture()->uniqueID());
return str;
}
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index a141767..466af6c 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2149,7 +2149,7 @@
SkASSERT(type >= 0 && type <= kLast_GrBufferType);
auto& bufferState = fHWBufferState[type];
- if (buffer->getUniqueID() != bufferState.fBoundBufferUniqueID) {
+ if (buffer->uniqueID() != bufferState.fBoundBufferUniqueID) {
if (buffer->isCPUBacked()) {
if (!bufferState.fBufferZeroKnownBound) {
GL_CALL(BindBuffer(bufferState.fGLTarget, 0));
@@ -2159,7 +2159,7 @@
GL_CALL(BindBuffer(bufferState.fGLTarget, glBuffer->bufferID()));
}
bufferState.fBufferZeroKnownBound = buffer->isCPUBacked();
- bufferState.fBoundBufferUniqueID = buffer->getUniqueID();
+ bufferState.fBoundBufferUniqueID = buffer->uniqueID();
}
return bufferState.fGLTarget;
@@ -2168,7 +2168,7 @@
void GrGLGpu::notifyBufferReleased(const GrGLBuffer* buffer) {
if (buffer->hasAttachedToTexture()) {
// Detach this buffer from any textures to ensure the underlying memory is freed.
- uint32_t uniqueID = buffer->getUniqueID();
+ uint32_t uniqueID = buffer->uniqueID();
for (int i = fHWMaxUsedBufferTextureUnit; i >= 0; --i) {
auto& buffTex = fHWBufferTextures[i];
if (uniqueID != buffTex.fAttachedBufferUniqueID) {
@@ -2656,7 +2656,7 @@
void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bounds, bool disableSRGB) {
SkASSERT(target);
- uint32_t rtID = target->getUniqueID();
+ uint32_t rtID = target->uniqueID();
if (fHWBoundRenderTargetUniqueID != rtID) {
fStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID()));
@@ -3178,7 +3178,7 @@
this->onResolveRenderTarget(texRT);
}
- uint32_t textureID = texture->getUniqueID();
+ uint32_t textureID = texture->uniqueID();
GrGLenum target = texture->target();
if (fHWBoundTextureUniqueIDs[unitIdx] != textureID) {
this->setTextureUnit(unitIdx);
@@ -3296,7 +3296,7 @@
buffTex.fKnownBound = true;
}
- if (buffer->getUniqueID() != buffTex.fAttachedBufferUniqueID ||
+ if (buffer->uniqueID() != buffTex.fAttachedBufferUniqueID ||
buffTex.fTexelConfig != texelConfig) {
this->setTextureUnit(unitIdx);
@@ -3305,7 +3305,7 @@
buffer->bufferID()));
buffTex.fTexelConfig = texelConfig;
- buffTex.fAttachedBufferUniqueID = buffer->getUniqueID();
+ buffTex.fAttachedBufferUniqueID = buffer->uniqueID();
if (this->glCaps().textureSwizzleSupport() &&
this->glCaps().configSwizzle(texelConfig) != buffTex.fSwizzle) {
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index d9bbb73..f6ad3ba 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -190,7 +190,7 @@
// Due to this resource having both a texture and a renderbuffer component, dump as
// skia/gpu_resources/resource_#/renderbuffer
SkString dumpName("skia/gpu_resources/resource_");
- dumpName.appendS32(this->getUniqueID());
+ dumpName.appendS32(this->uniqueID());
dumpName.append("/renderbuffer");
traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", size);
diff --git a/src/gpu/gl/GrGLTextureRenderTarget.cpp b/src/gpu/gl/GrGLTextureRenderTarget.cpp
index 1fa0a21..2ba469a 100644
--- a/src/gpu/gl/GrGLTextureRenderTarget.cpp
+++ b/src/gpu/gl/GrGLTextureRenderTarget.cpp
@@ -18,7 +18,7 @@
// texture and a
// renderbuffer component, dump as skia/gpu_resources/resource_#/texture
SkString dumpName("skia/gpu_resources/resource_");
- dumpName.appendS32(this->getUniqueID());
+ dumpName.appendS32(this->uniqueID());
dumpName.append("/texture");
// Use the texture's gpuMemorySize, not our own, which includes the
diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp
index abf6502..04299d7 100644
--- a/src/gpu/gl/GrGLVertexArray.cpp
+++ b/src/gpu/gl/GrGLVertexArray.cpp
@@ -50,7 +50,7 @@
array->fEnableIsValid = true;
array->fEnabled = true;
}
- if (array->fVertexBufferUniqueID != vertexBuffer->getUniqueID() ||
+ if (array->fVertexBufferUniqueID != vertexBuffer->uniqueID() ||
array->fType != type ||
array->fStride != stride ||
array->fOffset != offset) {
@@ -72,7 +72,7 @@
stride,
offset));
}
- array->fVertexBufferUniqueID = vertexBuffer->getUniqueID();
+ array->fVertexBufferUniqueID = vertexBuffer->uniqueID();
array->fType = type;
array->fStride = stride;
array->fOffset = offset;
@@ -114,7 +114,7 @@
GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(GrGLGpu* gpu, const GrBuffer* ibuff) {
GrGLAttribArrayState* state = this->bind(gpu);
- if (state && fIndexBufferUniqueID != ibuff->getUniqueID()) {
+ if (state && fIndexBufferUniqueID != ibuff->uniqueID()) {
if (ibuff->isCPUBacked()) {
GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, 0));
} else {
@@ -122,7 +122,7 @@
GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER,
glBuffer->bufferID()));
}
- fIndexBufferUniqueID = ibuff->getUniqueID();
+ fIndexBufferUniqueID = ibuff->uniqueID();
}
return state;
}
diff --git a/src/gpu/instanced/GLInstancedRendering.cpp b/src/gpu/instanced/GLInstancedRendering.cpp
index 3af1aa7..3d9058e 100644
--- a/src/gpu/instanced/GLInstancedRendering.cpp
+++ b/src/gpu/instanced/GLInstancedRendering.cpp
@@ -264,7 +264,7 @@
this->glGpu()->bindVertexArray(fVertexArrayID);
SkASSERT(fInstanceBuffer);
- if (fInstanceAttribsBufferUniqueId != fInstanceBuffer->getUniqueID() ||
+ if (fInstanceAttribsBufferUniqueId != fInstanceBuffer->uniqueID() ||
fInstanceAttribsBaseInstance != baseInstance) {
Instance* offsetInBuffer = (Instance*) nullptr + baseInstance;
@@ -298,7 +298,7 @@
sizeof(Instance), &offsetInBuffer->fLocalRect));
GL_CALL(VertexAttribDivisor((int)Attrib::kLocalRect, 1));
- fInstanceAttribsBufferUniqueId = fInstanceBuffer->getUniqueID();
+ fInstanceAttribsBufferUniqueId = fInstanceBuffer->uniqueID();
fInstanceAttribsBaseInstance = baseInstance;
}
}
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 6c5be0a..02b7ffd 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -620,10 +620,10 @@
);
SkAutoTUnref<GrPathRange> glyphs(this->createGlyphs(ctx));
- if (fLastDrawnGlyphsID != glyphs->getUniqueID()) {
+ 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());
- fLastDrawnGlyphsID = glyphs->getUniqueID();
+ fLastDrawnGlyphsID = glyphs->uniqueID();
}
// Don't compute a bounding box. For dst copy texture, we'll opt instead for it to just copy
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index 4dba4bb..b9ece6b 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -40,14 +40,14 @@
static bool reset_dc(sk_sp<GrDrawContext>* dc, GrContext* context, int w, int h) {
SkDEBUGCODE(uint32_t oldID = 0;)
if (*dc) {
- SkDEBUGCODE(oldID = (*dc)->accessRenderTarget()->getUniqueID();)
+ SkDEBUGCODE(oldID = (*dc)->accessRenderTarget()->uniqueID();)
dc->reset(nullptr);
}
context->freeGpuResources();
*dc = context->makeDrawContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig, nullptr);
- SkASSERT((*dc)->accessRenderTarget()->getUniqueID() != oldID);
+ SkASSERT((*dc)->accessRenderTarget()->uniqueID() != oldID);
return *dc != nullptr;
}
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 45d3945..016ce5e 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -15,15 +15,20 @@
#include "GrTextureProxy.h"
#include "GrRenderTargetProxy.h"
+// Check that the surface proxy's member vars are set as expected
static void check_surface(skiatest::Reporter* reporter,
GrSurfaceProxy* proxy,
GrSurfaceOrigin origin,
int width, int height,
- GrPixelConfig config) {
+ GrPixelConfig config,
+ uint32_t uniqueID) {
REPORTER_ASSERT(reporter, proxy->origin() == origin);
REPORTER_ASSERT(reporter, proxy->width() == width);
REPORTER_ASSERT(reporter, proxy->height() == height);
REPORTER_ASSERT(reporter, proxy->config() == config);
+ if (SK_InvalidUniqueID != uniqueID) {
+ REPORTER_ASSERT(reporter, proxy->uniqueID() == uniqueID);
+ }
}
static void check_rendertarget(skiatest::Reporter* reporter,
@@ -77,7 +82,7 @@
}
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
GrTextureProvider* provider = ctxInfo.grContext()->textureProvider();
for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) {
@@ -104,7 +109,7 @@
fit,
budgeted));
check_surface(reporter, rtProxy.get(), origin,
- widthHeight, widthHeight, config);
+ widthHeight, widthHeight, config, SK_InvalidUniqueID);
check_rendertarget(reporter, provider, rtProxy.get(), fit);
}
@@ -114,7 +119,7 @@
fit,
budgeted));
check_surface(reporter, texProxy.get(), origin,
- widthHeight, widthHeight, config);
+ widthHeight, widthHeight, config, SK_InvalidUniqueID);
check_texture(reporter, provider, texProxy.get(), fit);
}
}
@@ -162,7 +167,7 @@
sk_sp<GrRenderTargetProxy> rtProxy(
GrRenderTargetProxy::Make(caps, defaultFBO));
check_surface(reporter, rtProxy.get(), origin,
- kWidthHeight, kWidthHeight, config);
+ kWidthHeight, kWidthHeight, config, defaultFBO->uniqueID());
check_rendertarget(reporter, provider, rtProxy.get(), SkBackingFit::kExact);
}
@@ -178,7 +183,7 @@
sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make(caps, rt));
check_surface(reporter, rtProxy.get(), origin,
- kWidthHeight, kWidthHeight, config);
+ kWidthHeight, kWidthHeight, config, rt->uniqueID());
check_rendertarget(reporter, provider, rtProxy.get(), SkBackingFit::kExact);
}
@@ -190,7 +195,7 @@
sk_sp<GrTextureProxy> texProxy(GrTextureProxy::Make(tex));
check_surface(reporter, texProxy.get(), origin,
- kWidthHeight, kWidthHeight, config);
+ kWidthHeight, kWidthHeight, config, tex->uniqueID());
check_texture(reporter, provider, texProxy.get(), SkBackingFit::kExact);
}
}
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 14705cb..2cbf81c 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -1296,7 +1296,7 @@
// Call all the public methods on resource in the abandoned state. They shouldn't crash.
- resource->getUniqueID();
+ resource->uniqueID();
resource->getUniqueKey();
resource->wasDestroyed();
resource->gpuMemorySize();
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 27b1524..58555d3 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -310,7 +310,7 @@
ERRORF(reporter, "Not texture backed.");
return static_cast<intptr_t>(0);
}
- return static_cast<intptr_t>(texture->getUniqueID());
+ return static_cast<intptr_t>(texture->uniqueID());
};
auto surfaceBackingStore = [reporter](SkSurface* surface) {
@@ -320,7 +320,7 @@
ERRORF(reporter, "Not render target backed.");
return static_cast<intptr_t>(0);
}
- return static_cast<intptr_t>(rt->getUniqueID());
+ return static_cast<intptr_t>(rt->uniqueID());
};
test_unique_image_snap(reporter, surface.get(), false, imageBackingStore,
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 6d5619f..86125b8 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -356,7 +356,7 @@
// get the render target of the top device so we can ignore batches drawn offscreen
SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_testing();
SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd);
- uint32_t rtID = gbd->accessDrawContext()->accessRenderTarget()->getUniqueID();
+ uint32_t rtID = gbd->accessDrawContext()->accessRenderTarget()->uniqueID();
// get the bounding boxes to draw
SkTArray<GrAuditTrail::BatchInfo> childrenBounds;