Implement onSetLabel method.
In this CL, the GrSurfaceProxy's and GrDrawOpAtlas's label strings are plumbed so that it can be stored in the label string of GrGpuResource. onSetLabel method, which is called from setLabel method of GrGpuResource, will pass labels to Skia OpenGL backend using ANGLE's labeling API. Bug: chromium:1164111 Change-Id: I516c06f0ebbf6bbe6d31ea5a4a64b2baeedd1560 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545717 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
9eacc01a7f
commit
fd86891407
@ -36,6 +36,7 @@ public:
|
||||
|
||||
private:
|
||||
size_t onGpuMemorySize() const override { return 100; }
|
||||
void onSetLabel() override{}
|
||||
const char* getResourceType() const override { return "bench"; }
|
||||
using INHERITED = GrGpuResource;
|
||||
};
|
||||
|
@ -86,7 +86,8 @@ bool BaseDevice::replaceBackingProxy(SkSurface::ContentChangeMode mode) {
|
||||
oldView.mipmapped(),
|
||||
SkBackingFit::kExact,
|
||||
oldRTP->isBudgeted(),
|
||||
GrProtected::kNo);
|
||||
GrProtected::kNo,
|
||||
/*label=*/{});
|
||||
if (!proxy) {
|
||||
return false;
|
||||
}
|
||||
|
@ -81,6 +81,8 @@ protected:
|
||||
private:
|
||||
size_t onGpuMemorySize() const final;
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
void computeScratchKey(skgpu::ScratchKey*) const final;
|
||||
|
||||
const char* getResourceType() const override {
|
||||
|
@ -477,10 +477,17 @@ bool GrDrawOpAtlas::createPages(
|
||||
if (GrColorTypeIsAlphaOnly(grColorType)) {
|
||||
swizzle = skgpu::Swizzle::Concat(swizzle, skgpu::Swizzle("aaaa"));
|
||||
}
|
||||
sk_sp<GrSurfaceProxy> proxy = proxyProvider->createProxy(
|
||||
fFormat, dims, GrRenderable::kNo, 1, GrMipmapped::kNo, SkBackingFit::kExact,
|
||||
SkBudgeted::kYes, GrProtected::kNo, GrInternalSurfaceFlags::kNone,
|
||||
GrSurfaceProxy::UseAllocator::kNo);
|
||||
sk_sp<GrSurfaceProxy> proxy = proxyProvider->createProxy(fFormat,
|
||||
dims,
|
||||
GrRenderable::kNo,
|
||||
1,
|
||||
GrMipmapped::kNo,
|
||||
SkBackingFit::kExact,
|
||||
SkBudgeted::kYes,
|
||||
GrProtected::kNo,
|
||||
fLabel,
|
||||
GrInternalSurfaceFlags::kNone,
|
||||
GrSurfaceProxy::UseAllocator::kNo);
|
||||
if (!proxy) {
|
||||
return false;
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ private:
|
||||
virtual bool onUpdateData(const void* src, size_t srcSizeInBytes) = 0;
|
||||
|
||||
size_t onGpuMemorySize() const override { return fSizeInBytes; }
|
||||
void onSetLabel() override{}
|
||||
const char* getResourceType() const override { return "Buffer Object"; }
|
||||
void computeScratchKey(skgpu::ScratchKey* key) const override;
|
||||
|
||||
|
@ -174,9 +174,12 @@ public:
|
||||
associated unique key. */
|
||||
const skgpu::UniqueKey& getUniqueKey() const { return fUniqueKey; }
|
||||
|
||||
std::string_view getLabel() const { return fLabel; }
|
||||
std::string getLabel() const { return fLabel; }
|
||||
|
||||
void setLabel(std::string_view label) { fLabel = label; }
|
||||
void setLabel(std::string_view label) {
|
||||
fLabel = label;
|
||||
this->onSetLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal-only helper class used for manipulations of the resource by the cache.
|
||||
@ -283,6 +286,8 @@ private:
|
||||
|
||||
virtual size_t onGpuMemorySize() const = 0;
|
||||
|
||||
virtual void onSetLabel() = 0;
|
||||
|
||||
// See comments in CacheAccess and ResourcePriv.
|
||||
void setUniqueKey(const skgpu::UniqueKey&);
|
||||
void removeUniqueKey();
|
||||
|
@ -443,6 +443,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
GrProtected isProtected,
|
||||
std::string_view label,
|
||||
GrInternalSurfaceFlags surfaceFlags,
|
||||
GrSurfaceProxy::UseAllocator useAllocator) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
@ -494,7 +495,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
surfaceFlags | extraFlags,
|
||||
useAllocator,
|
||||
this->isDDLProvider(),
|
||||
{}));
|
||||
label));
|
||||
}
|
||||
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(format,
|
||||
@ -507,7 +508,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
surfaceFlags,
|
||||
useAllocator,
|
||||
this->isDDLProvider(),
|
||||
{}));
|
||||
label));
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
|
||||
|
@ -91,6 +91,7 @@ public:
|
||||
SkBackingFit,
|
||||
SkBudgeted,
|
||||
GrProtected,
|
||||
std::string_view label,
|
||||
GrInternalSurfaceFlags = GrInternalSurfaceFlags::kNone,
|
||||
UseAllocator useAllocator = UseAllocator::kYes);
|
||||
|
||||
|
@ -135,7 +135,8 @@ std::unique_ptr<skgpu::SurfaceContext> GrRecordingContextPriv::makeSC(const GrIm
|
||||
mipmapped,
|
||||
fit,
|
||||
budgeted,
|
||||
isProtected);
|
||||
isProtected,
|
||||
/*label=*/{});
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -181,7 +182,8 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(GrIma
|
||||
mipmapped,
|
||||
fit,
|
||||
budgeted,
|
||||
isProtected);
|
||||
isProtected,
|
||||
/*label=*/{});
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -243,7 +245,8 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(
|
||||
mipmapped,
|
||||
fit,
|
||||
budgeted,
|
||||
isProtected);
|
||||
isProtected,
|
||||
/*label=*/{});
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -83,7 +83,8 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
|
||||
renderTargetSampleCnt,
|
||||
budgeted,
|
||||
mipmapped,
|
||||
isProtected);
|
||||
isProtected,
|
||||
label);
|
||||
if (scratch) {
|
||||
if (!hasPixels) {
|
||||
return scratch;
|
||||
@ -111,7 +112,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
|
||||
tempColorType,
|
||||
tmpTexels.get(),
|
||||
numMipLevels,
|
||||
/*label=*/{});
|
||||
label);
|
||||
}
|
||||
|
||||
sk_sp<GrTexture> GrResourceProvider::getExactScratch(SkISize dimensions,
|
||||
@ -121,14 +122,16 @@ sk_sp<GrTexture> GrResourceProvider::getExactScratch(SkISize dimensions,
|
||||
int renderTargetSampleCnt,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
GrProtected isProtected,
|
||||
std::string_view label) {
|
||||
sk_sp<GrTexture> tex(this->findAndRefScratchTexture(dimensions,
|
||||
format,
|
||||
textureType,
|
||||
renderable,
|
||||
renderTargetSampleCnt,
|
||||
mipmapped,
|
||||
isProtected));
|
||||
isProtected,
|
||||
label));
|
||||
if (tex && SkBudgeted::kNo == budgeted) {
|
||||
tex->resourcePriv().makeUnbudgeted();
|
||||
}
|
||||
@ -168,7 +171,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
|
||||
renderable,
|
||||
renderTargetSampleCnt,
|
||||
isProtected,
|
||||
/*label=*/{});
|
||||
label);
|
||||
if (!tex) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -184,7 +187,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
|
||||
GrMipmapped::kNo,
|
||||
isProtected,
|
||||
&mipLevel,
|
||||
/*label=*/{});
|
||||
label);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +243,8 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
|
||||
renderTargetSampleCnt,
|
||||
budgeted,
|
||||
mipmapped,
|
||||
isProtected);
|
||||
isProtected,
|
||||
label);
|
||||
if (tex) {
|
||||
return tex;
|
||||
}
|
||||
@ -253,7 +257,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
|
||||
mipmapped,
|
||||
budgeted,
|
||||
isProtected,
|
||||
/*label=*/{});
|
||||
label);
|
||||
}
|
||||
|
||||
// Map 'value' to a larger multiple of 2. Values <= 'kMagicTol' will pop up to
|
||||
@ -311,7 +315,7 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(SkISize dimensions,
|
||||
|
||||
if (auto tex = this->findAndRefScratchTexture(copyDimensions, format, textureType, renderable,
|
||||
renderTargetSampleCnt, GrMipmapped::kNo,
|
||||
isProtected)) {
|
||||
isProtected, label)) {
|
||||
return tex;
|
||||
}
|
||||
|
||||
@ -323,7 +327,7 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(SkISize dimensions,
|
||||
GrMipmapped::kNo,
|
||||
SkBudgeted::kYes,
|
||||
isProtected,
|
||||
/*label=*/{});
|
||||
label);
|
||||
}
|
||||
|
||||
sk_sp<GrTexture> GrResourceProvider::findAndRefScratchTexture(const skgpu::ScratchKey& key,
|
||||
@ -347,7 +351,8 @@ sk_sp<GrTexture> GrResourceProvider::findAndRefScratchTexture(SkISize dimensions
|
||||
GrRenderable renderable,
|
||||
int renderTargetSampleCnt,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
GrProtected isProtected,
|
||||
std::string_view label) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
SkASSERT(!this->isAbandoned());
|
||||
SkASSERT(!this->caps()->isFormatCompressed(format));
|
||||
@ -360,7 +365,7 @@ sk_sp<GrTexture> GrResourceProvider::findAndRefScratchTexture(SkISize dimensions
|
||||
skgpu::ScratchKey key;
|
||||
GrTexture::ComputeScratchKey(*this->caps(), format, dimensions, renderable,
|
||||
renderTargetSampleCnt, mipmapped, isProtected, &key);
|
||||
return this->findAndRefScratchTexture(key, /*label=*/{});
|
||||
return this->findAndRefScratchTexture(key, label);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -127,7 +127,8 @@ public:
|
||||
GrRenderable,
|
||||
int renderTargetSampleCnt,
|
||||
GrMipmapped,
|
||||
GrProtected);
|
||||
GrProtected,
|
||||
std::string_view label);
|
||||
|
||||
/**
|
||||
* Creates a compressed texture. The GrGpu must support the SkImageImage::Compression type.
|
||||
@ -367,7 +368,8 @@ private:
|
||||
int renderTargetSampleCnt,
|
||||
SkBudgeted,
|
||||
GrMipmapped,
|
||||
GrProtected);
|
||||
GrProtected,
|
||||
std::string_view label);
|
||||
|
||||
// Attempts to find a resource in the cache that exactly matches the SkISize. Failing that
|
||||
// it returns null. If non-null, the resulting msaa attachment is always budgeted.
|
||||
|
@ -124,7 +124,7 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(GrResourceProvider* resourceP
|
||||
renderable,
|
||||
sampleCnt,
|
||||
fIsProtected,
|
||||
/*label=*/{});
|
||||
fLabel);
|
||||
} else {
|
||||
surface = resourceProvider->createTexture(fDimensions,
|
||||
fFormat,
|
||||
@ -134,7 +134,7 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(GrResourceProvider* resourceP
|
||||
mipmapped,
|
||||
fBudgeted,
|
||||
fIsProtected,
|
||||
/*label=*/{});
|
||||
fLabel);
|
||||
}
|
||||
if (!surface) {
|
||||
return nullptr;
|
||||
|
@ -425,7 +425,8 @@ bool SurfaceContext::internalWritePixels(GrDirectContext* dContext,
|
||||
GrMipmapped::kNo,
|
||||
SkBackingFit::kApprox,
|
||||
SkBudgeted::kYes,
|
||||
GrProtected::kNo);
|
||||
GrProtected::kNo,
|
||||
/*label=*/{});
|
||||
if (!tempProxy) {
|
||||
return false;
|
||||
}
|
||||
|
@ -111,6 +111,8 @@ private:
|
||||
|
||||
GrD3DGpu* getD3DGpu() const;
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
bool completeStencilAttachment(GrAttachment* stencil, bool useMSAASurface) override {
|
||||
SkASSERT(useMSAASurface == (this->numSamples() > 1));
|
||||
return true;
|
||||
|
@ -84,6 +84,8 @@ private:
|
||||
this->setResourceRelease(std::move(releaseHelper));
|
||||
}
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
struct SamplerHash {
|
||||
uint32_t operator()(GrSamplerState state) const {
|
||||
// In D3D anisotropic filtering uses the same field (D3D12_SAMPLER_DESC::Filter) as
|
||||
|
@ -106,6 +106,8 @@ private:
|
||||
// GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuffer's memory.
|
||||
size_t onGpuMemorySize() const override;
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
// In Vulkan we call the release proc after we are finished with the underlying
|
||||
// GrD3DImage::Resource object (which occurs after the GPU has finished all work on it).
|
||||
void onSetRelease(sk_sp<skgpu::RefCntedCallback> releaseHelper) override {
|
||||
|
@ -45,6 +45,8 @@ protected:
|
||||
// This accounts for the texture's memory and any MSAA renderbuffer's memory.
|
||||
size_t onGpuMemorySize() const override;
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
bool completeStencilAttachment(GrAttachment* stencil, bool useMSAASurface) override;
|
||||
GrDawnRenderTargetInfo fInfo;
|
||||
using INHERITED = GrRenderTarget;
|
||||
|
@ -57,6 +57,8 @@ protected:
|
||||
private:
|
||||
GrDawnTextureInfo fInfo;
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
using INHERITED = GrTexture;
|
||||
};
|
||||
|
||||
|
@ -45,6 +45,8 @@ protected:
|
||||
|
||||
private:
|
||||
size_t onGpuMemorySize() const override;
|
||||
|
||||
void onSetLabel() override{}
|
||||
};
|
||||
|
||||
#ifdef SK_BUILD_FOR_WIN
|
||||
|
@ -145,3 +145,12 @@ void GrGLAttachment::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
|
||||
renderbuffer_id.appendU32(this->renderbufferID());
|
||||
traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_renderbuffer", renderbuffer_id.c_str());
|
||||
}
|
||||
|
||||
void GrGLAttachment::onSetLabel() {
|
||||
SkASSERT(fRenderbufferID);
|
||||
GrGLGpu* glGpu = static_cast<GrGLGpu*>(this->getGpu());
|
||||
if (glGpu->glCaps().debugSupport()) {
|
||||
GR_GL_CALL(glGpu->glInterface(),
|
||||
ObjectLabel(GR_GL_TEXTURE, fRenderbufferID, -1, this->getLabel().c_str()));
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ private:
|
||||
this->registerWithCache(SkBudgeted::kYes);
|
||||
}
|
||||
|
||||
void onSetLabel() override;
|
||||
|
||||
GrGLFormat fFormat;
|
||||
|
||||
// may be zero for external SBs associated with external RTs
|
||||
|
@ -319,6 +319,15 @@ bool GrGLBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void GrGLBuffer::onSetLabel() {
|
||||
SkASSERT(fBufferID);
|
||||
GrGLGpu* glGpu = static_cast<GrGLGpu*>(this->getGpu());
|
||||
if (glGpu->glCaps().debugSupport()) {
|
||||
GR_GL_CALL(glGpu->glInterface(),
|
||||
ObjectLabel(GR_GL_BUFFER, fBufferID, -1, this->getLabel().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
void GrGLBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
|
||||
const SkString& dumpName) const {
|
||||
SkString buffer_id;
|
||||
|
@ -57,6 +57,7 @@ private:
|
||||
void onUnmap() override;
|
||||
bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
|
||||
|
||||
void onSetLabel() override;
|
||||
#ifdef SK_DEBUG
|
||||
void validate() const;
|
||||
#endif
|
||||
|
@ -133,6 +133,11 @@ size_t GrGLRenderTarget::onGpuMemorySize() const {
|
||||
fTotalMemorySamplesPerPixel, GrMipmapped::kNo);
|
||||
}
|
||||
|
||||
void GrGLRenderTarget::onSetLabel() {
|
||||
SkASSERT(fMSColorRenderbufferID);
|
||||
SkASSERT(fRTFBOOwnership == GrBackendObjectOwnership::kOwned);
|
||||
}
|
||||
|
||||
bool GrGLRenderTarget::completeStencilAttachment(GrAttachment* stencil, bool useMultisampleFBO) {
|
||||
// We defer attaching the new stencil buffer until the next time our framebuffer is bound.
|
||||
if (this->getStencilAttachment(useMultisampleFBO) != stencil) {
|
||||
|
@ -128,6 +128,8 @@ private:
|
||||
|
||||
size_t onGpuMemorySize() const override;
|
||||
|
||||
void onSetLabel() override;
|
||||
|
||||
sk_sp<GrGLAttachment> fDynamicMSAAAttachment;
|
||||
|
||||
GrGLuint fMultisampleFBOID;
|
||||
|
@ -164,6 +164,16 @@ bool GrGLTexture::onStealBackendTexture(GrBackendTexture* backendTexture,
|
||||
return true;
|
||||
}
|
||||
|
||||
void GrGLTexture::onSetLabel() {
|
||||
SkASSERT(fID);
|
||||
SkASSERT(fTextureIDOwnership == GrBackendObjectOwnership::kOwned);
|
||||
GrGLGpu* glGpu = static_cast<GrGLGpu*>(this->getGpu());
|
||||
if (glGpu->glCaps().debugSupport()) {
|
||||
GR_GL_CALL(glGpu->glInterface(),
|
||||
ObjectLabel(GR_GL_TEXTURE, fID, -1, this->getLabel().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
void GrGLTexture::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
|
||||
// Don't check this->fRefsWrappedObjects, as we might be the base of a GrGLTextureRenderTarget
|
||||
// which is multiply inherited from both ourselves and a texture. In these cases, one part
|
||||
|
@ -82,6 +82,8 @@ protected:
|
||||
|
||||
bool onStealBackendTexture(GrBackendTexture*, SkImage::BackendTextureReleaseProc*) override;
|
||||
|
||||
void onSetLabel() override;
|
||||
|
||||
private:
|
||||
sk_sp<GrGLTextureParameters> fParameters;
|
||||
GrGLuint fID;
|
||||
|
@ -83,3 +83,7 @@ size_t GrGLTextureRenderTarget::onGpuMemorySize() const {
|
||||
return GrSurface::ComputeSize(this->backendFormat(), this->dimensions(),
|
||||
this->totalMemorySamplesPerPixel(), this->mipmapped());
|
||||
}
|
||||
|
||||
void GrGLTextureRenderTarget::onSetLabel() {
|
||||
GrGLTexture::onSetLabel();
|
||||
}
|
||||
|
@ -72,6 +72,8 @@ private:
|
||||
std::string_view label);
|
||||
|
||||
size_t onGpuMemorySize() const override;
|
||||
|
||||
void onSetLabel() override;
|
||||
};
|
||||
|
||||
#ifdef SK_BUILD_FOR_WIN
|
||||
|
@ -76,6 +76,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
void onSetLabel() override{}
|
||||
|
||||
GrMockTextureInfo fInfo;
|
||||
|
||||
using INHERITED = GrTexture;
|
||||
@ -152,6 +154,8 @@ protected:
|
||||
, fInfo(info) {}
|
||||
|
||||
private:
|
||||
void onSetLabel() override{}
|
||||
|
||||
GrMockRenderTargetInfo fInfo;
|
||||
|
||||
using INHERITED = GrRenderTarget;
|
||||
@ -221,6 +225,8 @@ private:
|
||||
numColorSamples, this->mipmapped());
|
||||
}
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
// This avoids an inherits via dominance warning on MSVC.
|
||||
void computeScratchKey(skgpu::ScratchKey* key) const override {
|
||||
GrTexture::computeScratchKey(key);
|
||||
|
@ -87,6 +87,8 @@ private:
|
||||
|
||||
bool completeStencilAttachment(GrAttachment* stencil, bool useMSAASurface) override;
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
// We can have a renderpass with and without resolve attachment or stencil attachment,
|
||||
// both of these being completely orthogonal. Thus we have a total of 4 types of render passes.
|
||||
// We then cache a framebuffer for each type of these render passes.
|
||||
|
@ -84,6 +84,8 @@ private:
|
||||
GrIOType,
|
||||
std::string_view label);
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
sk_sp<GrMtlAttachment> fTexture;
|
||||
|
||||
using INHERITED = GrTexture;
|
||||
|
@ -62,6 +62,8 @@ private:
|
||||
std::string_view label);
|
||||
|
||||
size_t onGpuMemorySize() const override;
|
||||
|
||||
void onSetLabel() override{}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -477,7 +477,8 @@ GR_DRAW_OP_TEST_DEFINE(NonAALatticeOp) {
|
||||
GrMipmapped::kNo,
|
||||
SkBackingFit::kExact,
|
||||
SkBudgeted::kYes,
|
||||
GrProtected::kNo);
|
||||
GrProtected::kNo,
|
||||
/*label=*/{});
|
||||
|
||||
do {
|
||||
if (random->nextBool()) {
|
||||
|
@ -94,7 +94,7 @@ GrSurfaceProxyView make_deferred_mask_texture_view(GrRecordingContext* rContext,
|
||||
|
||||
auto proxy =
|
||||
proxyProvider->createProxy(format, dimensions, GrRenderable::kNo, 1, GrMipmapped::kNo,
|
||||
fit, SkBudgeted::kYes, GrProtected::kNo);
|
||||
fit, SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
|
||||
}
|
||||
|
||||
|
@ -1402,9 +1402,16 @@ GR_DRAW_OP_TEST_DEFINE(TextureOpImpl) {
|
||||
context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
|
||||
GrRenderable::kNo);
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
|
||||
format, dims, GrRenderable::kNo, 1, mipmapped, fit, SkBudgeted::kNo, GrProtected::kNo,
|
||||
GrInternalSurfaceFlags::kNone);
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(format,
|
||||
dims,
|
||||
GrRenderable::kNo,
|
||||
1,
|
||||
mipmapped,
|
||||
fit,
|
||||
SkBudgeted::kNo,
|
||||
GrProtected::kNo,
|
||||
/*label=*/{},
|
||||
GrInternalSurfaceFlags::kNone);
|
||||
|
||||
SkRect rect = GrTest::TestRect(random);
|
||||
SkRect srcRect;
|
||||
|
@ -328,7 +328,7 @@ GrSurfaceProxyView render_sw_mask(GrRecordingContext* context,
|
||||
GrColorType::kAlpha_8);
|
||||
auto proxy = proxyProvider->createProxy(format, bounds.size(), GrRenderable::kNo, 1,
|
||||
GrMipmapped::kNo, SkBackingFit::kApprox,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
|
||||
// Since this will be rendered on another thread, make a copy of the elements in case
|
||||
// the clip stack is modified on the main thread
|
||||
|
@ -181,7 +181,8 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
|
||||
mipmapped,
|
||||
fit,
|
||||
budgeted,
|
||||
isProtected);
|
||||
isProtected,
|
||||
/*label=*/{});
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -226,7 +227,8 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
|
||||
mipmapped,
|
||||
fit,
|
||||
budgeted,
|
||||
isProtected);
|
||||
isProtected,
|
||||
/*label=*/{});
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -132,6 +132,8 @@ protected:
|
||||
// This returns zero since the memory should all be handled by the attachments
|
||||
size_t onGpuMemorySize() const override { return 0; }
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
private:
|
||||
// For external framebuffers that wrap a secondary command buffer
|
||||
GrVkRenderTarget(GrVkGpu* gpu,
|
||||
|
@ -94,6 +94,8 @@ private:
|
||||
bool isExternal,
|
||||
std::string_view label);
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
sk_sp<GrVkImage> fTexture;
|
||||
|
||||
struct SamplerHash {
|
||||
|
@ -82,6 +82,8 @@ private:
|
||||
|
||||
size_t onGpuMemorySize() const override;
|
||||
|
||||
void onSetLabel() override{}
|
||||
|
||||
// In Vulkan we call the release proc after we are finished with the underlying
|
||||
// GrVkImage::Resource object (which occurs after the GPU has finished all work on it).
|
||||
void onSetRelease(sk_sp<skgpu::RefCntedCallback> releaseHelper) override {
|
||||
|
@ -31,7 +31,7 @@ static sk_sp<GrSurfaceProxy> create_proxy(GrRecordingContext* rContext) {
|
||||
GrRenderable::kYes);
|
||||
return rContext->priv().proxyProvider()->createProxy(
|
||||
format, kDimensions, GrRenderable::kYes, 1, GrMipmapped::kNo, SkBackingFit::kExact,
|
||||
SkBudgeted::kNo, GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
SkBudgeted::kNo, GrProtected::kNo, /*label=*/{}, GrInternalSurfaceFlags::kNone);
|
||||
}
|
||||
|
||||
typedef GrQuadAAFlags (*PerQuadAAFunc)(int i);
|
||||
|
@ -383,7 +383,8 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> draw_mipmap_into_new_rende
|
||||
GrMipmapped::kNo,
|
||||
SkBackingFit::kApprox,
|
||||
SkBudgeted::kYes,
|
||||
GrProtected::kNo);
|
||||
GrProtected::kNo,
|
||||
/*label=*/{});
|
||||
|
||||
auto sdc = skgpu::v1::SurfaceDrawContext::Make(rContext,
|
||||
colorType,
|
||||
@ -439,7 +440,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
|
||||
sk_sp<GrTextureProxy> mipmapProxy = proxyProvider->createProxy(
|
||||
format, {4, 4}, GrRenderable::kYes, 1, GrMipmapped::kYes, SkBackingFit::kExact,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo,/*label=*/{});
|
||||
|
||||
// Mark the mipmaps clean to ensure things still work properly when they won't be marked
|
||||
// dirty again until GrRenderTask::makeClosed().
|
||||
|
@ -167,7 +167,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
|
||||
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
|
||||
combo.fFormat, kDims, GrRenderable::kNo, 1, GrMipmapped::kYes,
|
||||
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo);
|
||||
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo, /*label=*/{});
|
||||
REPORTER_ASSERT(reporter, SkToBool(proxy.get()) == expectedMipMapability,
|
||||
"ct:%s format:%s, tex:%d, expectedMipMapability:%d",
|
||||
GrColorTypeToStr(combo.fColorType), combo.fFormat.toStr().c_str(),
|
||||
|
@ -183,7 +183,7 @@ DEF_GPUTEST(OpChainTest, reporter, /*ctxInfo*/) {
|
||||
static const GrSurfaceOrigin kOrigin = kTopLeft_GrSurfaceOrigin;
|
||||
auto proxy = dContext->priv().proxyProvider()->createProxy(
|
||||
format, kDims, GrRenderable::kYes, 1, GrMipmapped::kNo, SkBackingFit::kExact,
|
||||
SkBudgeted::kNo, GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
SkBudgeted::kNo, GrProtected::kNo, /*label=*/{}, GrInternalSurfaceFlags::kNone);
|
||||
SkASSERT(proxy);
|
||||
proxy->instantiate(dContext->priv().resourceProvider());
|
||||
|
||||
|
@ -163,7 +163,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
|
||||
{
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
|
||||
format, kDims, GrRenderable::kNo, 1, GrMipmapped::kNo, SkBackingFit::kExact,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
|
||||
{
|
||||
SkTArray<GrSurfaceProxyView> views;
|
||||
|
@ -254,7 +254,7 @@ bool GrDrawingManager::ProgramUnitTest(GrDirectContext* direct, int maxStages, i
|
||||
GrRenderable::kYes);
|
||||
auto proxy = proxyProvider->createProxy(format, kDims, GrRenderable::kYes, 1,
|
||||
mipmapped, SkBackingFit::kExact, SkBudgeted::kNo,
|
||||
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
GrProtected::kNo, /*label=*/{}, GrInternalSurfaceFlags::kNone);
|
||||
skgpu::Swizzle swizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
|
||||
views[0] = {{std::move(proxy), kBottomLeft_GrSurfaceOrigin, swizzle},
|
||||
GrColorType::kRGBA_8888, kPremul_SkAlphaType};
|
||||
@ -265,7 +265,7 @@ bool GrDrawingManager::ProgramUnitTest(GrDirectContext* direct, int maxStages, i
|
||||
GrRenderable::kNo);
|
||||
auto proxy = proxyProvider->createProxy(format, kDims, GrRenderable::kNo, 1, mipmapped,
|
||||
SkBackingFit::kExact, SkBudgeted::kNo,
|
||||
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
GrProtected::kNo, /*label=*/{}, GrInternalSurfaceFlags::kNone);
|
||||
skgpu::Swizzle swizzle = caps->getReadSwizzle(format, GrColorType::kAlpha_8);
|
||||
views[1] = {{std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle},
|
||||
GrColorType::kAlpha_8, kPremul_SkAlphaType};
|
||||
|
@ -134,7 +134,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
|
||||
{
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
|
||||
format, kDims, GrRenderable::kYes, 1, GrMipmapped::kNo, SkBackingFit::kApprox,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
|
||||
// Both RenderTarget and Texture
|
||||
GrRenderTargetProxy* rtProxy = proxy->asRenderTargetProxy();
|
||||
@ -148,7 +148,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
|
||||
{
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
|
||||
format, kDims, GrRenderable::kYes, 1, GrMipmapped::kNo, SkBackingFit::kApprox,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
|
||||
// Both RenderTarget and Texture - but via GrTextureProxy
|
||||
GrTextureProxy* tProxy = proxy->asTextureProxy();
|
||||
@ -162,7 +162,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
|
||||
{
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
|
||||
format, kDims, GrRenderable::kNo, 1, GrMipmapped::kNo, SkBackingFit::kApprox,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
// Texture-only
|
||||
GrTextureProxy* tProxy = proxy->asTextureProxy();
|
||||
REPORTER_ASSERT(reporter, tProxy);
|
||||
|
@ -30,7 +30,7 @@ static sk_sp<GrTextureProxy> make_deferred(GrRecordingContext* rContext) {
|
||||
GrRenderable::kYes);
|
||||
return proxyProvider->createProxy(format, {kWidthHeight, kWidthHeight}, GrRenderable::kYes, 1,
|
||||
GrMipmapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes,
|
||||
GrProtected::kNo);
|
||||
GrProtected::kNo, /*label=*/{});
|
||||
}
|
||||
|
||||
static sk_sp<GrTextureProxy> make_wrapped(GrRecordingContext* rContext) {
|
||||
|
@ -155,7 +155,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
|
||||
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
|
||||
format, dims, GrRenderable::kYes, numSamples, GrMipmapped::kNo,
|
||||
fit, budgeted, GrProtected::kNo);
|
||||
fit, budgeted, GrProtected::kNo, /*label=*/{});
|
||||
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
|
||||
if (proxy) {
|
||||
REPORTER_ASSERT(reporter, proxy->asRenderTargetProxy());
|
||||
@ -201,7 +201,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
|
||||
|
||||
sk_sp<GrTextureProxy> proxy(proxyProvider->createProxy(
|
||||
format, dims, GrRenderable::kNo, numSamples, GrMipmapped::kNo,
|
||||
fit, budgeted, GrProtected::kNo));
|
||||
fit, budgeted, GrProtected::kNo, /*label=*/{}));
|
||||
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
|
||||
if (proxy) {
|
||||
// This forces the proxy to compute and cache its
|
||||
@ -357,7 +357,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
|
||||
|
||||
sk_sp<GrTextureProxy> proxy = provider->createProxy(
|
||||
format, {width, height}, renderable, 1, GrMipmapped::kNo, fit,
|
||||
SkBudgeted::kNo, GrProtected::kNo);
|
||||
SkBudgeted::kNo, GrProtected::kNo, /*label=*/{});
|
||||
REPORTER_ASSERT(reporter, !proxy);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,8 @@ static sk_sp<GrSurfaceProxy> make_deferred(GrProxyProvider* proxyProvider, const
|
||||
const ProxyParams& p) {
|
||||
const GrBackendFormat format = caps->getDefaultBackendFormat(p.fColorType, p.fRenderable);
|
||||
return proxyProvider->createProxy(format, {p.fSize, p.fSize}, p.fRenderable, p.fSampleCnt,
|
||||
GrMipmapped::kNo, p.fFit, p.fBudgeted, GrProtected::kNo);
|
||||
GrMipmapped::kNo, p.fFit, p.fBudgeted, GrProtected::kNo,
|
||||
/*label=*/{});
|
||||
}
|
||||
|
||||
static sk_sp<GrSurfaceProxy> make_backend(GrDirectContext* dContext, const ProxyParams& p) {
|
||||
|
@ -330,6 +330,7 @@ private:
|
||||
}
|
||||
|
||||
size_t onGpuMemorySize() const override { return fSize; }
|
||||
void onSetLabel() override{}
|
||||
const char* getResourceType() const override { return "Test"; }
|
||||
|
||||
sk_sp<TestResource> fToDelete;
|
||||
@ -1705,7 +1706,8 @@ static sk_sp<GrTextureProxy> make_mipmap_proxy(GrRecordingContext* rContext,
|
||||
GrRenderable::kNo);
|
||||
|
||||
return proxyProvider->createProxy(format, dims, renderable, sampleCnt, GrMipmapped::kYes,
|
||||
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo,
|
||||
/*label=*/{});
|
||||
}
|
||||
|
||||
// Exercise GrSurface::gpuMemorySize for different combos of MSAA, RT-only,
|
||||
|
@ -46,7 +46,7 @@ static sk_sp<GrSurfaceProxy> create_proxy(GrRecordingContext* rContext) {
|
||||
GrRenderable::kYes);
|
||||
return rContext->priv().proxyProvider()->createProxy(
|
||||
format, kDimensions, GrRenderable::kYes, 1, GrMipmapped::kNo, SkBackingFit::kExact,
|
||||
SkBudgeted::kNo, GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
SkBudgeted::kNo, GrProtected::kNo, /*label=*/{},GrInternalSurfaceFlags::kNone);
|
||||
}
|
||||
|
||||
static GrOp::Owner create_op(GrDirectContext* dContext, SkRect rect,
|
||||
|
@ -47,7 +47,7 @@ static sk_sp<GrTextureProxy> deferred_tex(skiatest::Reporter* reporter,
|
||||
|
||||
sk_sp<GrTextureProxy> proxy =
|
||||
proxyProvider->createProxy(format, kSize, GrRenderable::kNo, 1, GrMipmapped::kNo, fit,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
// Only budgeted & wrapped external proxies get to carry uniqueKeys
|
||||
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
|
||||
return proxy;
|
||||
@ -63,7 +63,7 @@ static sk_sp<GrTextureProxy> deferred_texRT(skiatest::Reporter* reporter,
|
||||
|
||||
sk_sp<GrTextureProxy> proxy =
|
||||
proxyProvider->createProxy(format, kSize, GrRenderable::kYes, 1, GrMipmapped::kNo, fit,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
// Only budgeted & wrapped external proxies get to carry uniqueKeys
|
||||
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
|
||||
return proxy;
|
||||
|
@ -535,7 +535,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsPendingIO, reporter, ctxInfo) {
|
||||
|
||||
sk_sp<GrTextureProxy> temp = proxyProvider->createProxy(
|
||||
format, kDims, GrRenderable::kNo, 1, GrMipmapped::kNo, SkBackingFit::kApprox,
|
||||
SkBudgeted::kYes, GrProtected::kNo);
|
||||
SkBudgeted::kYes, GrProtected::kNo, /*label=*/{});
|
||||
temp->instantiate(context->priv().resourceProvider());
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,8 @@ GrSurfaceProxyView MakeTextureProxyViewFromData(GrDirectContext* dContext,
|
||||
GrMipmapped::kNo,
|
||||
SkBackingFit::kExact,
|
||||
SkBudgeted::kYes,
|
||||
GrProtected::kNo);
|
||||
GrProtected::kNo,
|
||||
/*label=*/{});
|
||||
if (!proxy) {
|
||||
return {};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user