Remove GrPixelConfigIsCompressed call.
Bug: skia:6718
Change-Id: Ia6363d74f016b076fa5e19a57d223f7c47b723c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248999
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index eca0a2d..1727607 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -814,20 +814,6 @@
}
/**
- * Returns true if the pixel config is a GPU-specific compressed format
- * representation.
- */
-static constexpr bool GrPixelConfigIsCompressed(GrPixelConfig config) {
- switch (config) {
- case kRGB_ETC1_GrPixelConfig:
- return true;
- default:
- return false;
- }
- SkUNREACHABLE;
-}
-
-/**
* Returns the data size for the given SkImage::CompressionType
*/
static inline size_t GrCompressedFormatDataSize(SkImage::CompressionType compressionType,
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 2c7153a..6abdc24 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -507,7 +507,7 @@
width, height, format, compressionType, budgeted, data.get()));
},
format, desc, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
- GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact,
+ GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 9ba9505..92b71ae 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -173,14 +173,15 @@
return nullptr;
}
- // Compressed textures are read-only so they don't support re-use for scratch.
+ // Currently we don't recycle compressed textures as scratch. Additionally all compressed
+ // textures should be created through the createCompressedTexture function.
+ SkASSERT(!this->caps()->isFormatCompressed(format));
+
// TODO: Support GrMipMapped::kYes in scratch texture lookup here.
- if (!GrPixelConfigIsCompressed(desc.fConfig)) {
- sk_sp<GrTexture> tex = this->getExactScratch(
- desc, format, renderable, renderTargetSampleCnt, budgeted, mipMapped, isProtected);
- if (tex) {
- return tex;
- }
+ sk_sp<GrTexture> tex = this->getExactScratch(
+ desc, format, renderable, renderTargetSampleCnt, budgeted, mipMapped, isProtected);
+ if (tex) {
+ return tex;
}
return fGpu->createTexture(desc, format, renderable, renderTargetSampleCnt, mipMapped, budgeted,
@@ -224,10 +225,9 @@
return nullptr;
}
- // Currently we don't recycle compressed textures as scratch.
- if (GrPixelConfigIsCompressed(desc.fConfig)) {
- return nullptr;
- }
+ // Currently we don't recycle compressed textures as scratch. Additionally all compressed
+ // textures should be created through the createCompressedTexture function.
+ SkASSERT(!this->caps()->isFormatCompressed(format));
if (!fCaps->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, desc.fConfig, renderable,
renderTargetSampleCnt, GrMipMapped::kNo)) {
@@ -256,7 +256,7 @@
GrProtected isProtected) {
ASSERT_SINGLE_OWNER
SkASSERT(!this->isAbandoned());
- SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig));
+ SkASSERT(!this->caps()->isFormatCompressed(format));
SkASSERT(fCaps->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, desc.fConfig,
renderable, renderTargetSampleCnt, GrMipMapped::kNo));
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index a487847..baa2040 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -69,10 +69,6 @@
, fGpuMemorySize(kInvalidGpuMemorySize) {
SkASSERT(fFormat.isValid());
SkASSERT(is_valid_non_lazy(desc));
- if (GrPixelConfigIsCompressed(desc.fConfig)) {
- SkASSERT(renderable == GrRenderable::kNo);
- fSurfaceFlags |= GrInternalSurfaceFlags::kReadOnly;
- }
}
// Lazy-callback version
@@ -103,10 +99,6 @@
SkASSERT(fFormat.isValid());
SkASSERT(fLazyInstantiateCallback);
SkASSERT(is_valid_lazy(desc, fit));
- if (GrPixelConfigIsCompressed(desc.fConfig)) {
- SkASSERT(renderable == GrRenderable::kNo);
- fSurfaceFlags |= GrInternalSurfaceFlags::kReadOnly;
- }
}
// Wrapped version