Remove renderable flag from texture createLazyProxy.

Besides some tests, we always set the renderable flag to kNo for this
function. No need to keep supporting a code path we don't actually use.
Tests that use to pass in kYes here have been converted to calling
createLazyRenderTargetProxy instead.

Change-Id: I91efe6cc51fd7ba04b711509ca26f18eba2af333
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313425
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Greg Daniel 2020-08-26 13:28:22 -04:00 committed by Skia Commit-Bot
parent 9e506eeb7e
commit c113f004de
8 changed files with 60 additions and 63 deletions

View File

@ -178,9 +178,9 @@ GrSurfaceProxyView GrAHardwareBufferImageGenerator::makeView(GrRecordingContext*
return tex;
},
backendFormat, {width, height}, GrRenderable::kNo, 1, GrMipmapped::kNo,
GrMipmapStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
SkBudgeted::kNo, GrProtected(fIsProtectedContent), GrSurfaceProxy::UseAllocator::kYes);
backendFormat, {width, height}, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected(fIsProtectedContent), GrSurfaceProxy::UseAllocator::kYes);
GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, grColorType);

View File

@ -200,8 +200,8 @@ GrSurfaceProxyView GrBackendTextureImageGenerator::onGenerateTexture(
// proxy.
return {std::move(tex), true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
backendFormat, fBackendTexture.dimensions(), GrRenderable::kNo, 1, textureIsMipMapped,
mipmapStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
backendFormat, fBackendTexture.dimensions(), textureIsMipMapped, mipmapStatus,
GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
if (!proxy) {
return {};

View File

@ -329,7 +329,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createNonMippedProxyFromBitmap(const SkBi
desc.fDimensions, desc.fFormat, colorType, desc.fRenderable,
desc.fSampleCnt, desc.fBudgeted, desc.fFit, desc.fProtected, mipLevel));
},
format, dims, GrRenderable::kNo, 1, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
format, dims, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
GrInternalSurfaceFlags::kNone, fit, budgeted, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
@ -377,9 +377,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createMippedProxyFromBitmap(const SkBitma
desc.fDimensions, desc.fFormat, colorType, GrRenderable::kNo, 1,
desc.fBudgeted, GrProtected::kNo, texels.get(), mipLevelCount));
},
format, dims, GrRenderable::kNo, 1, GrMipmapped::kYes, GrMipmapStatus::kValid,
GrInternalSurfaceFlags::kNone, SkBackingFit::kExact, budgeted, GrProtected::kNo,
UseAllocator::kYes);
format, dims, GrMipmapped::kYes, GrMipmapStatus::kValid, GrInternalSurfaceFlags::kNone,
SkBackingFit::kExact, budgeted, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
return nullptr;
@ -465,9 +464,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
desc.fDimensions, desc.fFormat, desc.fBudgeted, desc.fMipmapped,
desc.fProtected, data.get()));
},
format, dimensions, GrRenderable::kNo, 1, mipMapped, mipmapStatus,
GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kYes,
GrProtected::kNo, UseAllocator::kYes);
format, dimensions, mipMapped, mipmapStatus,GrInternalSurfaceFlags::kReadOnly,
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
return nullptr;
@ -696,8 +694,6 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::wrapVulkanSecondaryCBAsRenderTarget(
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
GrRenderable renderable,
int renderTargetSampleCnt,
GrMipmapped mipMapped,
GrMipmapStatus mipmapStatus,
GrInternalSurfaceFlags surfaceFlags,
@ -721,33 +717,17 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
return nullptr;
}
if (renderable == GrRenderable::kYes) {
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*this->caps(),
std::move(callback),
format,
dimensions,
renderTargetSampleCnt,
mipMapped,
mipmapStatus,
fit,
budgeted,
isProtected,
surfaceFlags,
useAllocator,
this->isDDLProvider()));
} else {
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
format,
dimensions,
mipMapped,
mipmapStatus,
fit,
budgeted,
isProtected,
surfaceFlags,
useAllocator,
this->isDDLProvider()));
}
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
format,
dimensions,
mipMapped,
mipmapStatus,
fit,
budgeted,
isProtected,
surfaceFlags,
useAllocator,
this->isDDLProvider()));
}
sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(

View File

@ -157,9 +157,9 @@ public:
/**
* Creates a texture proxy that will be instantiated by a user-supplied callback during flush.
* (Stencil is not supported by this method.) The width and height must either both be greater
* than 0 or both less than or equal to zero. A non-positive value is a signal that the width
* and height are currently unknown.
* The width and height must either both be greater than 0 or both less than or equal to zero. A
* non-positive value is a signal that the width height are currently unknown. The texture will
* not be renderable.
*
* When called, the callback must be able to cleanup any resources that it captured at creation.
* It also must support being passed in a null GrResourceProvider. When this happens, the
@ -168,8 +168,6 @@ public:
sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
SkISize dimensions,
GrRenderable,
int renderTargetSampleCnt,
GrMipmapped,
GrMipmapStatus,
GrInternalSurfaceFlags,

View File

@ -501,7 +501,7 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
// We pass kReadOnly here since we should treat content of the client's texture as immutable.
// The promise API provides no way for the client to indicated that the texture is protected.
return proxyProvider->createLazyProxy(
std::move(callback), backendFormat, {width, height}, GrRenderable::kNo, 1, mipMapped,
mipmapStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
std::move(callback), backendFormat, {width, height}, mipMapped, mipmapStatus,
GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
}

View File

@ -568,11 +568,23 @@ DEF_GPUTEST(TextureIdleProcTest, reporter, options) {
} else {
budgeted = SkBudgeted::kNo;
}
auto proxy = dContext->priv().proxyProvider()->createLazyProxy(
singleUseLazyCB, backendFormat, desc, renderable, 1, GrMipmapped::kNo,
GrMipmapStatus::kNotAllocated, GrInternalSurfaceFlags ::kNone,
SkBackingFit::kExact, budgeted, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
sk_sp<GrSurfaceProxy> proxy;
if (renderable == GrRenderable::kYes) {
static const GrProxyProvider::TextureInfo kTexInfo = {GrMipMapped::kNo,
GrTextureType::k2D};
proxy = dContext->priv().proxyProvider()->createLazyRenderTargetProxy(
singleUseLazyCB, backendFormat, desc, 1,
GrInternalSurfaceFlags ::kNone, &kTexInfo,
GrMipmapStatus::kNotAllocated,
SkBackingFit::kExact, budgeted, GrProtected::kNo, false,
GrSurfaceProxy::UseAllocator::kYes);
} else {
proxy = dContext->priv().proxyProvider()->createLazyProxy(
singleUseLazyCB, backendFormat, desc, GrMipmapped::kNo,
GrMipmapStatus::kNotAllocated, GrInternalSurfaceFlags ::kNone,
SkBackingFit::kExact, budgeted, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
}
GrSwizzle readSwizzle = dContext->priv().caps()->getReadSwizzle(
backendFormat, GrColorType::kRGBA_8888);
GrSurfaceProxyView view(std::move(proxy), kTopLeft_GrSurfaceOrigin, readSwizzle);

View File

@ -273,9 +273,9 @@ DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) {
};
sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
TestCallback(&testCount, releaseCallback, tex), format, {kSize, kSize},
GrRenderable::kNo, 1, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
GrInternalSurfaceFlags::kNone, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
GrMipmapped::kNo, GrMipmapStatus::kNotAllocated, GrInternalSurfaceFlags::kNone,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
REPORTER_ASSERT(reporter, proxy.get());
REPORTER_ASSERT(reporter, 0 == testCount);
@ -343,9 +343,9 @@ private:
desc.fProtected),
true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
format, dims, GrRenderable::kNo, 1, GrMipmapped::kNo,
GrMipmapStatus::kNotAllocated, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact,
SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
format, dims, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
GrInternalSurfaceFlags::kNone, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
SkASSERT(fLazyProxy.get());

View File

@ -275,10 +275,17 @@ sk_sp<GrSurfaceProxy> make_lazy(GrProxyProvider* proxyProvider, const GrCaps* ca
};
GrInternalSurfaceFlags flags = GrInternalSurfaceFlags::kNone;
SkISize dims = {p.fSize, p.fSize};
return proxyProvider->createLazyProxy(callback, format, dims, p.fRenderable, p.fSampleCnt,
GrMipmapped::kNo, GrMipmapStatus::kNotAllocated, flags,
p.fFit, p.fBudgeted, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
if (p.fRenderable == GrRenderable::kYes) {
static const GrProxyProvider::TextureInfo kTexInfo = {GrMipMapped::kNo, GrTextureType::k2D};
return proxyProvider->createLazyRenderTargetProxy(
callback, format, dims, p.fSampleCnt, flags, &kTexInfo,
GrMipmapStatus::kNotAllocated,
p.fFit, p.fBudgeted, GrProtected::kNo, false, GrSurfaceProxy::UseAllocator::kYes);
} else {
return proxyProvider->createLazyProxy(
callback, format, dims, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated, flags,
p.fFit, p.fBudgeted, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
}
}
// Set up so there are two opsTasks that need to be flushed but the resource allocator thinks