Propagate GrRenderable flag to GrCaps::getBackendFormatFromColorType
This makes calling GrCaps::getBackendFormatFromColorType equivalent to calling GrContext::defaultBackendFormat
Change-Id: Ic402245fa0502920c47c2a29aadc4e559abdc09b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230416
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index b6fd67f..32714b8 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -422,3 +422,19 @@
return compatible;
}
#endif
+
+GrBackendFormat GrCaps::getDefaultBackendFormat(GrColorType grColorType,
+ GrRenderable renderable) const {
+ GrBackendFormat format = this->onGetDefaultBackendFormat(grColorType, renderable);
+ if (!this->isFormatTexturable(grColorType, format)) {
+ return {};
+ }
+
+ if (renderable == GrRenderable::kYes) {
+ if (!this->isFormatRenderable(grColorType, format)) {
+ return {};
+ }
+ }
+
+ return format;
+}
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 492af04..91f0450 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -394,8 +394,7 @@
virtual GrColorType getYUVAColorTypeFromBackendFormat(const GrBackendFormat&) const = 0;
/** These are used when creating a new texture internally. */
- // TODO: also take a GrRenderable parameter.
- virtual GrBackendFormat getBackendFormatFromColorType(GrColorType ct) const = 0;
+ GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const;
virtual GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const = 0;
@@ -529,6 +528,7 @@
virtual bool onSurfaceSupportsWritePixels(const GrSurface*) const = 0;
virtual bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIPoint& dstPoint) const = 0;
+ virtual GrBackendFormat onGetDefaultBackendFormat(GrColorType, GrRenderable) const = 0;
// Backends should implement this if they have any extra requirements for use of window
// rectangles for a specific GrBackendRenderTarget outside of basic support.
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index e5c92c5..c29e63e 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -470,6 +470,7 @@
reducedClip.numAnalyticFPs(), &key);
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+ const GrCaps* caps = context->priv().caps();
sk_sp<GrTextureProxy> proxy(proxyProvider->findOrCreateProxyByUniqueKey(
key, kTopLeft_GrSurfaceOrigin));
@@ -493,8 +494,8 @@
desc.fHeight = maskSpaceIBounds.height();
desc.fConfig = kAlpha_8_GrPixelConfig;
- GrBackendFormat format =
- context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
+ GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
+ GrRenderable::kNo);
// MDB TODO: We're going to fill this proxy with an ASAP upload (which is out of order wrt
// to ops), so it can't have any pending IO.
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index 4747b14..e11d857 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -39,6 +39,10 @@
int height, int plotWidth, int plotHeight,
AllowMultitexturing allowMultitexturing,
GrDrawOpAtlas::EvictionFunc func, void* data) {
+ if (!format.isValid()) {
+ return nullptr;
+ }
+
std::unique_ptr<GrDrawOpAtlas> atlas(new GrDrawOpAtlas(proxyProvider, format, colorType, width,
height, plotWidth, plotHeight,
allowMultitexturing));
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 48a24fe..e70917c 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -216,9 +216,9 @@
SkColorType ct = info.colorType();
GrColorType grCT = SkColorTypeToGrColorType(ct);
- GrBackendFormat format = this->caps()->getBackendFormatFromColorType(grCT);
+ GrBackendFormat format = this->caps()->getDefaultBackendFormat(grCT, renderable);
- if (!format.isValid() || !this->caps()->isFormatTexturable(grCT, format)) {
+ if (!format.isValid()) {
SkBitmap copy8888;
if (!copy8888.tryAllocPixels(info.makeColorType(kRGBA_8888_SkColorType)) ||
!srcImage->readPixels(copy8888.pixmap(), 0, 0)) {
@@ -228,7 +228,7 @@
srcImage = SkMakeImageFromRasterBitmap(copy8888, kNever_SkCopyPixelsMode);
ct = kRGBA_8888_SkColorType;
grCT = GrColorType::kRGBA_8888;
- format = this->caps()->getBackendFormatFromColorType(grCT);
+ format = this->caps()->getDefaultBackendFormat(grCT, renderable);
if (!format.isValid()) {
return nullptr;
}
@@ -337,14 +337,11 @@
SkBudgeted::kYes, SkBackingFit::kExact);
}
- GrColorType grColorType = SkColorTypeToGrColorType(bitmap.info().colorType());
- GrBackendFormat format = this->caps()->getBackendFormatFromColorType(grColorType);
- if (!format.isValid()) {
- return nullptr;
- }
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info());
- if (!this->caps()->isFormatTexturable(grColorType, format)) {
+ GrColorType grColorType = SkColorTypeToGrColorType(bitmap.info().colorType());
+ GrBackendFormat format = this->caps()->getDefaultBackendFormat(grColorType, GrRenderable::kNo);
+ if (!format.isValid()) {
SkBitmap copy8888;
if (!copy8888.tryAllocPixels(bitmap.info().makeColorType(kRGBA_8888_SkColorType)) ||
!bitmap.readPixels(copy8888.pixmap())) {
@@ -354,13 +351,12 @@
baseLevel = SkMakeImageFromRasterBitmap(copy8888, kNever_SkCopyPixelsMode);
desc.fConfig = kRGBA_8888_GrPixelConfig;
grColorType = GrColorType::kRGBA_8888;
- format = this->caps()->getBackendFormatFromColorType(grColorType);
+ format = this->caps()->getDefaultBackendFormat(grColorType, GrRenderable::kNo);
if (!format.isValid()) {
return nullptr;
}
}
-
SkPixmap pixmap;
SkAssertResult(baseLevel->peekPixels(&pixmap));
sk_sp<SkMipMap> mipmaps(SkMipMap::Build(pixmap, nullptr));
@@ -775,6 +771,10 @@
SkASSERT((desc.fWidth <= 0 && desc.fHeight <= 0) ||
(desc.fWidth > 0 && desc.fHeight > 0));
+ if (!format.isValid()) {
+ return nullptr;
+ }
+
if (desc.fWidth > this->caps()->maxTextureSize() ||
desc.fHeight > this->caps()->maxTextureSize()) {
return nullptr;
@@ -844,6 +844,10 @@
LazyInstantiateCallback&& callback, const GrBackendFormat& format, GrRenderable renderable,
int renderTargetSampleCnt, GrProtected isProtected, GrSurfaceOrigin origin,
GrPixelConfig config, const GrCaps& caps) {
+ if (!format.isValid()) {
+ return nullptr;
+ }
+
SkASSERT(renderTargetSampleCnt == 1 || renderable == GrRenderable::kYes);
SkASSERT(validate_backend_format_and_config(&caps, format, config));
GrSurfaceDesc desc;
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 64f4a40..d3a550f 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -176,7 +176,7 @@
GrSurfaceOrigin origin,
SkBudgeted budgeted,
GrProtected isProtected) {
- auto format = this->caps()->getBackendFormatFromColorType(colorType);
+ auto format = this->caps()->getDefaultBackendFormat(colorType, GrRenderable::kNo);
if (!format.isValid()) {
return nullptr;
}
@@ -225,7 +225,7 @@
return nullptr;
}
- auto format = this->caps()->getBackendFormatFromColorType(colorType);
+ auto format = this->caps()->getDefaultBackendFormat(colorType, GrRenderable::kYes);
if (!format.isValid()) {
return nullptr;
}
@@ -409,19 +409,13 @@
GrColorType grColorType = SkColorTypeToGrColorType(skColorType);
- // TODO: pass the 'renderable' parameter into getBackendFormatFromColorType and change
- // the texturabilit and renderability tests below into asserts
- GrBackendFormat format = caps->getBackendFormatFromColorType(grColorType);
- if (!caps->isFormatTexturable(grColorType, format)) {
+ GrBackendFormat format = caps->getDefaultBackendFormat(grColorType, renderable);
+ if (!format.isValid()) {
return GrBackendFormat();
}
- if (renderable == GrRenderable::kYes) {
- if (!caps->isFormatRenderable(grColorType, format)) {
- return GrBackendFormat();
- }
- }
+ SkASSERT(caps->isFormatTexturable(grColorType, format));
+ SkASSERT(renderable == GrRenderable::kNo || caps->isFormatRenderable(grColorType, format));
return format;
}
-
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 90f82b8..5905c72 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1586,7 +1586,8 @@
auto backendFormatOfFinalContext = fRenderTargetProxy->backendFormat();
if (needsRescale) {
colorTypeOfFinalContext = dstCT;
- backendFormatOfFinalContext = this->caps()->getBackendFormatFromColorType(dstCT);
+ backendFormatOfFinalContext = this->caps()->getDefaultBackendFormat(dstCT,
+ GrRenderable::kYes);
}
auto readInfo = this->caps()->supportedReadPixelsColorType(colorTypeOfFinalContext,
backendFormatOfFinalContext, dstCT);
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index febf245..d43775e 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -175,14 +175,15 @@
SkBackingFit fit,
int width, int height) {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+ const GrCaps* caps = context->priv().caps();
GrSurfaceDesc desc;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kAlpha_8_GrPixelConfig;
- const GrBackendFormat format =
- context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
+ const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
+ GrRenderable::kNo);
return proxyProvider->createProxy(format, desc, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
fit, SkBudgeted::kYes, GrProtected::kNo);
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 0b6dd31..15dad7a 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -290,7 +290,7 @@
if (canvas2DFastPath) {
desc.fConfig = kRGBA_8888_GrPixelConfig;
colorType = GrColorType::kRGBA_8888;
- format = caps->getBackendFormatFromColorType(colorType);
+ format = caps->getDefaultBackendFormat(colorType, GrRenderable::kNo);
alphaType = kUnpremul_SkAlphaType;
} else {
desc.fConfig = dstProxy->config();
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index e32036d..c994998 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -76,7 +76,7 @@
break;
}
- const GrBackendFormat format = caps.getBackendFormatFromColorType(colorType);
+ auto format = caps.getDefaultBackendFormat(colorType, GrRenderable::kYes);
sk_sp<GrTextureProxy> proxy = GrProxyProvider::MakeFullyLazyProxy(
std::bind(callback, std::placeholders::_1, pixelConfig, sampleCount), format,
diff --git a/src/gpu/dawn/GrDawnCaps.cpp b/src/gpu/dawn/GrDawnCaps.cpp
index c9381bc..a7aaf91 100644
--- a/src/gpu/dawn/GrDawnCaps.cpp
+++ b/src/gpu/dawn/GrDawnCaps.cpp
@@ -112,7 +112,8 @@
return this->getRenderTargetSampleCount(requestedCount, config);
}
-GrBackendFormat GrDawnCaps::getBackendFormatFromColorType(GrColorType ct) const {
+GrBackendFormat GrDawnCaps::onGetDefaultBackendFormat(GrColorType ct,
+ GrRenderable renderable) const {
GrPixelConfig config = GrColorTypeToPixelConfig(ct);
if (config == kUnknown_GrPixelConfig) {
return GrBackendFormat();
diff --git a/src/gpu/dawn/GrDawnCaps.h b/src/gpu/dawn/GrDawnCaps.h
index f975990..b2c2f89 100644
--- a/src/gpu/dawn/GrDawnCaps.h
+++ b/src/gpu/dawn/GrDawnCaps.h
@@ -29,13 +29,6 @@
return true;
}
- bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
- const SkIRect& srcRect, const SkIPoint& dstPoint) const override {
- return true;
- }
-
- GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
-
SupportedWrite supportedWritePixelsColorType(GrPixelConfig config,
GrColorType srcColorType) const override {
return {GrColorType::kUnknown, 1};
@@ -45,16 +38,6 @@
return SurfaceReadPixelsSupport::kSupported;
}
- SupportedRead onSupportedReadPixelsColorType(GrColorType srcColorType,
- const GrBackendFormat& backendFormat,
- GrColorType dstColorType) const override {
- return {GrSwizzle(), GrColorType::kUnknown, 0};
- }
-
- bool onSurfaceSupportsWritePixels(const GrSurface* surface) const override {
- return true;
- }
-
int getRenderTargetSampleCount(int requestedCount, GrColorType,
const GrBackendFormat&) const override;
@@ -71,8 +54,6 @@
return this->isConfigTexturable(config) ? 1 : 0;
}
- GrBackendFormat getBackendFormatFromColorType(GrColorType ct) const override;
-
GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override;
bool canClearTextureOnCreation() const override;
@@ -81,9 +62,27 @@
GrSwizzle getOutputSwizzle(const GrBackendFormat&, GrColorType) const override;
+ GrColorType getYUVAColorTypeFromBackendFormat(const GrBackendFormat&) const override;
+
+private:
+ bool onSurfaceSupportsWritePixels(const GrSurface* surface) const override {
+ return true;
+ }
+ bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
+ const SkIRect& srcRect, const SkIPoint& dstPoint) const override {
+ return true;
+ }
+ GrBackendFormat onGetDefaultBackendFormat(GrColorType, GrRenderable) const override;
+
+ GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
+
bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
- GrColorType getYUVAColorTypeFromBackendFormat(const GrBackendFormat&) const override;
+ SupportedRead onSupportedReadPixelsColorType(GrColorType srcColorType,
+ const GrBackendFormat& backendFormat,
+ GrColorType dstColorType) const override {
+ return { GrSwizzle(), GrColorType::kUnknown, 0 };
+ }
typedef GrCaps INHERITED;
};
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index d781865..49fb56f 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -4063,11 +4063,13 @@
SkUNREACHABLE;
}
-GrBackendFormat GrGLCaps::getBackendFormatFromColorType(GrColorType ct) const {
+GrBackendFormat GrGLCaps::onGetDefaultBackendFormat(GrColorType ct,
+ GrRenderable renderable) const {
auto format = this->getFormatFromColorType(ct);
if (format == GrGLFormat::kUnknown) {
return GrBackendFormat();
}
+ // TODO: plumb 'renderable' into getSizedInternalFormat (or, at least, make use of it)
return GrBackendFormat::MakeGL(this->getSizedInternalFormat(format), GR_GL_TEXTURE_2D);
}
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index f4fa5e1..c8540ed 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -451,7 +451,6 @@
GrColorType getYUVAColorTypeFromBackendFormat(const GrBackendFormat&) const override;
- GrBackendFormat getBackendFormatFromColorType(GrColorType ct) const override;
GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override;
bool canClearTextureOnCreation() const override;
@@ -503,6 +502,7 @@
bool onSurfaceSupportsWritePixels(const GrSurface*) const override;
bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIPoint& dstPoint) const override;
+ GrBackendFormat onGetDefaultBackendFormat(GrColorType, GrRenderable) const override;
GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index 73f3611..0d43316 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -139,10 +139,6 @@
return *format.getMockColorType();
}
- GrBackendFormat getBackendFormatFromColorType(GrColorType ct) const override {
- return GrBackendFormat::MakeMock(ct);
- }
-
GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override {
return {};
}
@@ -162,6 +158,9 @@
const SkIRect& srcRect, const SkIPoint& dstPoint) const override {
return true;
}
+ GrBackendFormat onGetDefaultBackendFormat(GrColorType ct, GrRenderable) const override {
+ return GrBackendFormat::MakeMock(ct);
+ }
GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat& format,
GrColorType) const override {
diff --git a/src/gpu/mtl/GrMtlCaps.h b/src/gpu/mtl/GrMtlCaps.h
index f982c02..3e9f343 100644
--- a/src/gpu/mtl/GrMtlCaps.h
+++ b/src/gpu/mtl/GrMtlCaps.h
@@ -70,7 +70,6 @@
GrColorType getYUVAColorTypeFromBackendFormat(const GrBackendFormat&) const override;
- GrBackendFormat getBackendFormatFromColorType(GrColorType ct) const override;
GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override;
bool canClearTextureOnCreation() const override { return true; }
@@ -91,6 +90,7 @@
bool onSurfaceSupportsWritePixels(const GrSurface*) const override;
bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIPoint& dstPoint) const override;
+ GrBackendFormat onGetDefaultBackendFormat(GrColorType, GrRenderable) const override;
GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm
index af94b4d..56ad7e8 100644
--- a/src/gpu/mtl/GrMtlCaps.mm
+++ b/src/gpu/mtl/GrMtlCaps.mm
@@ -754,7 +754,8 @@
SkUNREACHABLE;
}
-GrBackendFormat GrMtlCaps::getBackendFormatFromColorType(GrColorType ct) const {
+GrBackendFormat GrMtlCaps::onGetDefaultBackendFormat(GrColorType ct,
+ GrRenderable renderable) const {
GrPixelConfig config = GrColorTypeToPixelConfig(ct);
if (config == kUnknown_GrPixelConfig) {
return GrBackendFormat();
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index d53f8f9..4b9a09a 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -404,10 +404,11 @@
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fWidth = random->nextRangeU(1, 1000);
desc.fHeight = random->nextRangeU(1, 1000);
- GrSurfaceOrigin origin =
- random->nextBool() ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
+ GrSurfaceOrigin origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin
+ : kBottomLeft_GrSurfaceOrigin;
const GrBackendFormat format =
- context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+ context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+ GrRenderable::kNo);
auto proxy = context->priv().proxyProvider()->createProxy(format, desc, GrRenderable::kNo, 1,
origin, SkBackingFit::kExact,
SkBudgeted::kYes, GrProtected::kNo);
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index c9c3d08..f6a3705 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -874,9 +874,8 @@
SkASSERT(!args.fShape->isEmpty());
SkASSERT(args.fShape->hasUnstyledKey());
if (!fAtlas) {
- const GrBackendFormat format =
- args.fContext->priv().caps()->getBackendFormatFromColorType(
- GrColorType::kAlpha_8);
+ const GrBackendFormat format = args.fContext->priv().caps()->getDefaultBackendFormat(
+ GrColorType::kAlpha_8, GrRenderable::kNo);
fAtlas = GrDrawOpAtlas::Make(args.fContext->priv().proxyProvider(),
format,
GrColorType::kAlpha_8,
@@ -965,8 +964,8 @@
if (context->priv().contextID() != gTestStruct.fContextID) {
gTestStruct.fContextID = context->priv().contextID();
gTestStruct.reset();
- const GrBackendFormat format =
- context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
+ const GrBackendFormat format = context->priv().caps()->getDefaultBackendFormat(
+ GrColorType::kAlpha_8, GrRenderable::kNo);
gTestStruct.fAtlas = GrDrawOpAtlas::Make(context->priv().proxyProvider(),
format, GrColorType::kAlpha_8,
ATLAS_TEXTURE_WIDTH, ATLAS_TEXTURE_HEIGHT,
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 8b7d8c1..e7bf602 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -688,9 +688,9 @@
if (mipMapped == GrMipMapped::kNo) {
fit = random->nextBool() ? SkBackingFit::kApprox : SkBackingFit::kExact;
}
-
const GrBackendFormat format =
- context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+ context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+ GrRenderable::kNo);
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index 94082ca..6ae06a4 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -166,7 +166,8 @@
SkISize atlasDimensions = fAtlasConfig.atlasDimensions(format);
SkISize plotDimensions = fAtlasConfig.plotDimensions(format);
- const GrBackendFormat format = fCaps->getBackendFormatFromColorType(grColorType);
+ const GrBackendFormat format = fCaps->getDefaultBackendFormat(grColorType,
+ GrRenderable::kNo);
fAtlases[index] = GrDrawOpAtlas::Make(
fProxyProvider, format, grColorType,
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 3ee070b..563fb65 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -1116,7 +1116,8 @@
SkUNREACHABLE;
}
-GrBackendFormat GrVkCaps::getBackendFormatFromColorType(GrColorType ct) const {
+GrBackendFormat GrVkCaps::onGetDefaultBackendFormat(GrColorType ct,
+ GrRenderable renderable) const {
GrPixelConfig config = GrColorTypeToPixelConfig(ct);
if (config == kUnknown_GrPixelConfig) {
return GrBackendFormat();
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
index af1bfd3..1b20196 100644
--- a/src/gpu/vk/GrVkCaps.h
+++ b/src/gpu/vk/GrVkCaps.h
@@ -165,7 +165,6 @@
GrColorType getYUVAColorTypeFromBackendFormat(const GrBackendFormat&) const override;
- GrBackendFormat getBackendFormatFromColorType(GrColorType ct) const override;
GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override;
bool canClearTextureOnCreation() const override;
@@ -202,6 +201,7 @@
bool onSurfaceSupportsWritePixels(const GrSurface*) const override;
bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIPoint& dstPoint) const override;
+ GrBackendFormat onGetDefaultBackendFormat(GrColorType, GrRenderable) const override;
GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;