Revert "Store GrSwizzle on proxies for texturing and swizzling."
This reverts commit 23093135d17427ef59385761d2d729ada6d961cf.
Reason for revert: Breaking Google3 :(
Original change's description:
> Store GrSwizzle on proxies for texturing and swizzling.
>
> Bug: skia: 6718
> Change-Id: I023d7507da9334e984ac8209a32323d616b3d79d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214305
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Ie2303ad090f58de07db7b0ac2d42e06e5e5bbcc1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia: 6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221338
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 8551983..bb9ca00 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -154,15 +154,11 @@
SkASSERT(!this->findProxyByUniqueKey(tex->getUniqueKey(), origin));
}
#endif
- GrColorType colorType = GrPixelConfigToColorType(tex->config());
- GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(tex->backendFormat(), colorType);
if (tex->asRenderTarget()) {
- GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(tex->backendFormat(), colorType);
- return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin,
- texSwizzle, outSwizzle));
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin));
} else {
- return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin, texSwizzle));
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin));
}
}
@@ -452,20 +448,15 @@
this->caps()->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig);
}
- 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 = this->caps()->getOutputSwizzle(format, colorType);
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*this->caps(), format, copyDesc,
- origin, mipMapped, texSwizzle,
- outSwizzle, fit, budgeted,
- surfaceFlags));
+ origin, mipMapped,
+ fit, budgeted, surfaceFlags));
}
- return sk_sp<GrTextureProxy>(new GrTextureProxy(format, copyDesc, origin, mipMapped, texSwizzle,
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(format, copyDesc, origin, mipMapped,
fit, budgeted, surfaceFlags));
}
@@ -544,10 +535,7 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
- GrColorType colorType = GrPixelConfigToColorType(tex->config());
- GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(tex->backendFormat(), colorType);
-
- return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin, texSwizzle));
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin));
}
sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
@@ -588,12 +576,7 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
- 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));
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin));
}
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget(
@@ -609,8 +592,8 @@
return nullptr;
}
- GrColorType colorType = GrPixelConfigToColorType(backendRT.config());
#ifdef SK_DEBUG
+ GrColorType colorType = GrPixelConfigToColorType(backendRT.config());
GrPixelConfig testConfig =
this->caps()->validateBackendRenderTarget(backendRT,
GrColorTypeToSkColorType(colorType));
@@ -633,11 +616,7 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
- GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(rt->backendFormat(), colorType);
- GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(rt->backendFormat(), colorType);
-
- return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(rt), origin, texSwizzle,
- outSwizzle));
+ return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(rt), origin));
}
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget(
@@ -667,12 +646,7 @@
// This proxy should be unbudgeted because we're just wrapping an external resource
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
- GrColorType colorType = GrPixelConfigToColorType(rt->config());
- GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(rt->backendFormat(), colorType);
- GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(rt->backendFormat(), colorType);
-
- return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(rt), origin, texSwizzle,
- outSwizzle));
+ return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(rt), origin));
}
sk_sp<GrRenderTargetProxy> GrProxyProvider::wrapVulkanSecondaryCBAsRenderTarget(
@@ -700,14 +674,10 @@
// This proxy should be unbudgeted because we're just wrapping an external resource
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
- GrColorType colorType = GrPixelConfigToColorType(rt->config());
- GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(rt->backendFormat(), colorType);
- GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(rt->backendFormat(), colorType);
-
// All Vulkan surfaces uses top left origins.
return sk_sp<GrRenderTargetProxy>(
new GrRenderTargetProxy(std::move(rt),
- kTopLeft_GrSurfaceOrigin, texSwizzle, outSwizzle,
+ kTopLeft_GrSurfaceOrigin,
GrRenderTargetProxy::WrapsVkSecondaryCB::kYes));
}
@@ -764,17 +734,12 @@
}
#endif
- GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
- GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(format, colorType);
- GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(format, colorType);
-
return sk_sp<GrTextureProxy>(
SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags)
? new GrTextureRenderTargetProxy(std::move(callback), lazyType, format, desc,
- origin, mipMapped, texSwizzle, outSwizzle, fit,
- budgeted, surfaceFlags)
+ origin, mipMapped, fit, budgeted, surfaceFlags)
: new GrTextureProxy(std::move(callback), lazyType, format, desc, origin,
- mipMapped, texSwizzle, fit, budgeted, surfaceFlags));
+ mipMapped, fit, budgeted, surfaceFlags));
}
sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
@@ -804,17 +769,13 @@
LazyInstantiationType lazyType = this->renderingDirectly() ? LazyInstantiationType::kSingleUse
: LazyInstantiationType::kMultipleUse;
- GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
- GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(format, colorType);
- GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(format, colorType);
-
if (textureInfo) {
// Wrapped vulkan secondary command buffers don't support texturing since we won't have an
// actual VkImage to texture from.
SkASSERT(!wrapsVkSecondaryCB);
return sk_sp<GrRenderTargetProxy>(new GrTextureRenderTargetProxy(
std::move(callback), lazyType, format, desc, origin, textureInfo->fMipMapped,
- texSwizzle, outSwizzle, fit, budgeted, surfaceFlags));
+ fit, budgeted, surfaceFlags));
}
GrRenderTargetProxy::WrapsVkSecondaryCB vkSCB =
@@ -822,8 +783,8 @@
: GrRenderTargetProxy::WrapsVkSecondaryCB::kNo;
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(
- std::move(callback), lazyType, format, desc, origin, texSwizzle, outSwizzle, fit,
- budgeted, surfaceFlags, vkSCB));
+ std::move(callback), lazyType, format, desc, origin, fit, budgeted, surfaceFlags,
+ vkSCB));
}
sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(
@@ -843,18 +804,14 @@
desc.fConfig = config;
desc.fSampleCnt = sampleCnt;
- GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
- GrSwizzle texSwizzle = caps.getTextureSwizzle(format, colorType);
- GrSwizzle outSwizzle = caps.getOutputSwizzle(format, colorType);
-
return sk_sp<GrTextureProxy>(
(Renderable::kYes == renderable)
? new GrTextureRenderTargetProxy(
std::move(callback), LazyInstantiationType::kSingleUse, format, desc,
- origin, GrMipMapped::kNo, texSwizzle, outSwizzle,
- SkBackingFit::kApprox, SkBudgeted::kYes, surfaceFlags)
+ origin, GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes,
+ surfaceFlags)
: new GrTextureProxy(std::move(callback), LazyInstantiationType::kSingleUse,
- format, desc, origin, GrMipMapped::kNo, texSwizzle,
+ format, desc, origin, GrMipMapped::kNo,
SkBackingFit::kApprox, SkBudgeted::kYes, surfaceFlags));
}