Revert "Pass GrColorType to the GrGpu::wrapRenderableBackendTexture chain of calls"
This reverts commit 5572737d952421a588c5790d4a8fc05957cb3d50.
Reason for revert: Adreno 4xx bots hitting compatibility assert in InitialTextureClear test
Original change's description:
> Pass GrColorType to the GrGpu::wrapRenderableBackendTexture chain of calls
>
> This is a step towards reducing our reliance-on/use-of the GrPixelConfig stored in the GrBackendTexture.
>
> Bug: skia:6718
> Change-Id: I2170032bfbbb57423c4bb0d901ad014c61d38131
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223701
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,robertphillips@google.com
Change-Id: I24cf6b3aa0dfca2e935a36592860ad91171b21a7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227637
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 5e2b1fe..1fc2756 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -422,12 +422,6 @@
return caps->areColorTypeAndFormatCompatible(grCT, format);
}
-
-static bool validate_backend_format_and_colortype(const GrCaps* caps,
- GrColorType colorType,
- const GrBackendFormat& format) {
- return caps->areColorTypeAndFormatCompatible(colorType, format);
-}
#endif
sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format,
@@ -437,17 +431,11 @@
SkBackingFit fit,
SkBudgeted budgeted,
GrInternalSurfaceFlags surfaceFlags) {
+ SkASSERT(validate_backend_format_and_config(this->caps(), format, desc.fConfig));
if (GrPixelConfigIsCompressed(desc.fConfig)) {
// Deferred proxies for compressed textures are not supported.
return nullptr;
}
-
- const GrCaps* caps = this->caps();
- GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
-
- SkASSERT(GrCaps::AreConfigsCompatible(desc.fConfig,
- caps->getConfigFromBackendFormat(format, colorType)));
- SkASSERT(validate_backend_format_and_colortype(caps, colorType, format));
if (GrMipMapped::kYes == mipMapped) {
// SkMipMap doesn't include the base level in the level count so we have to add 1
int mipCount = SkMipMap::ComputeLevelCount(desc.fWidth, desc.fHeight) + 1;
@@ -456,21 +444,23 @@
}
}
- if (!caps->validateSurfaceDesc(desc, mipMapped)) {
+ if (!this->caps()->validateSurfaceDesc(desc, mipMapped)) {
return nullptr;
}
GrSurfaceDesc copyDesc = desc;
if (desc.fFlags & kRenderTarget_GrSurfaceFlag) {
- copyDesc.fSampleCnt = caps->getRenderTargetSampleCount(desc.fSampleCnt, colorType, format);
+ copyDesc.fSampleCnt =
+ this->caps()->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig);
}
- GrSwizzle texSwizzle = caps->getTextureSwizzle(format, colorType);
+ GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
+ GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(format, colorType);
if (copyDesc.fFlags & kRenderTarget_GrSurfaceFlag) {
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
- GrSwizzle outSwizzle = caps->getOutputSwizzle(format, colorType);
- return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*caps, format, copyDesc,
+ GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(format, colorType);
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*this->caps(), format, copyDesc,
origin, mipMapped, texSwizzle,
outSwizzle, fit, budgeted,
surfaceFlags));
@@ -536,8 +526,10 @@
return nullptr;
}
+#ifdef SK_DEBUG
SkASSERT(validate_backend_format_and_config(this->caps(), backendTex.getBackendFormat(),
backendTex.config()));
+#endif
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
@@ -563,8 +555,8 @@
sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
const GrBackendTexture& backendTex, GrSurfaceOrigin origin, int sampleCnt,
- GrColorType colorType, GrWrapOwnership ownership, GrWrapCacheable cacheable,
- ReleaseProc releaseProc, ReleaseContext releaseCtx) {
+ GrWrapOwnership ownership, GrWrapCacheable cacheable, ReleaseProc releaseProc,
+ ReleaseContext releaseCtx) {
if (this->isAbandoned()) {
return nullptr;
}
@@ -575,25 +567,18 @@
return nullptr;
}
- const GrCaps* caps = this->caps();
-
- SkASSERT(GrCaps::AreConfigsCompatible(backendTex.config(),
- caps->getConfigFromBackendFormat(
- backendTex.getBackendFormat(),
- colorType)));
- SkASSERT(validate_backend_format_and_colortype(caps, colorType, backendTex.getBackendFormat()));
+ SkASSERT(validate_backend_format_and_config(this->caps(), backendTex.getBackendFormat(),
+ backendTex.config()));
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
- sampleCnt = caps->getRenderTargetSampleCount(sampleCnt, colorType,
- backendTex.getBackendFormat());
+ sampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, backendTex.config());
if (!sampleCnt) {
return nullptr;
}
sk_sp<GrTexture> tex = resourceProvider->wrapRenderableBackendTexture(backendTex, sampleCnt,
- colorType, ownership,
- cacheable);
+ ownership, cacheable);
if (!tex) {
return nullptr;
}
@@ -606,8 +591,9 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
- GrSwizzle texSwizzle = caps->getTextureSwizzle(tex->backendFormat(), colorType);
- GrSwizzle outSwizzle = caps->getOutputSwizzle(tex->backendFormat(), colorType);
+ GrColorType colorType = GrPixelConfigToColorType(tex->config());
+ GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(tex->backendFormat(), colorType);
+ GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(tex->backendFormat(), colorType);
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin, texSwizzle,
outSwizzle));