Revert "Have a GrBackendFormat be stored on gpu proxies."
This reverts commit 51b1c12bbc2fa3f8d4faa29ad19c6f3cb34837ce.
Reason for revert: reverting till flutter gets to 1.1 to fix build issues.
Original change's description:
> Have a GrBackendFormat be stored on gpu proxies.
>
> Bug: skia:
> Change-Id: Iaf1fb24ab29a61d44e5fa59a5e0867ed02dcda90
> Reviewed-on: https://skia-review.googlesource.com/c/168021
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com
Change-Id: I574fdc084ef5994596c51fb0d60423b5dc01b885
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:903701 chromium:903756
Reviewed-on: https://skia-review.googlesource.com/c/169835
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 02a6d72..a941b50 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -496,8 +496,7 @@
fContext->contextPriv().caps()->isConfigTexturable(kRGBA_8888_GrPixelConfig) &&
fContext->validPMUPMConversionExists();
- const GrCaps* caps = this->caps();
- if (!caps->surfaceSupportsWritePixels(dstSurface) ||
+ if (!fContext->contextPriv().caps()->surfaceSupportsWritePixels(dstSurface) ||
canvas2DFastPath) {
// We don't expect callers that are skipping flushes to require an intermediate draw.
SkASSERT(!(pixelOpsFlags & kDontFlush_PixelOpsFlag));
@@ -506,25 +505,12 @@
}
GrSurfaceDesc desc;
+ desc.fConfig = canvas2DFastPath ? kRGBA_8888_GrPixelConfig : dstProxy->config();
desc.fWidth = width;
desc.fHeight = height;
desc.fSampleCnt = 1;
-
- GrBackendFormat format;
- if (canvas2DFastPath) {
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- format =
- fContext->contextPriv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
- } else {
- desc.fConfig = dstProxy->config();
- format = dstProxy->backendFormat().makeTexture2D();
- if (!format.isValid()) {
- return false;
- }
- }
-
auto tempProxy = this->proxyProvider()->createProxy(
- format, desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
+ desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
if (!tempProxy) {
return false;
}
@@ -697,23 +683,8 @@
desc.fWidth = width;
desc.fHeight = height;
desc.fSampleCnt = 1;
-
- GrBackendFormat format;
- if (canvas2DFastPath) {
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- format = this->caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
- } else {
- desc.fFlags = kNone_GrSurfaceFlags;
- desc.fConfig = srcProxy->config();
- format = srcProxy->backendFormat().makeTexture2D();
- if (!format.isValid()) {
- return false;
- }
- }
-
auto tempProxy = this->proxyProvider()->createProxy(
- format, desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
+ desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
if (!tempProxy) {
return false;
}
@@ -893,8 +864,7 @@
}
}
-sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrBackendFormat& format,
- const GrSurfaceDesc& dstDesc,
+sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrSurfaceDesc& dstDesc,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
SkBackingFit fit,
@@ -903,10 +873,10 @@
const SkSurfaceProps* props) {
sk_sp<GrTextureProxy> proxy;
if (GrMipMapped::kNo == mipMapped) {
- proxy = this->proxyProvider()->createProxy(format, dstDesc, origin, fit, isDstBudgeted);
+ proxy = this->proxyProvider()->createProxy(dstDesc, origin, fit, isDstBudgeted);
} else {
SkASSERT(SkBackingFit::kExact == fit);
- proxy = this->proxyProvider()->createMipMapProxy(format, dstDesc, origin, isDstBudgeted);
+ proxy = this->proxyProvider()->createMipMapProxy(dstDesc, origin, isDstBudgeted);
}
if (!proxy) {
return nullptr;
@@ -1029,7 +999,6 @@
}
sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContextWithFallback(
- const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
@@ -1039,26 +1008,17 @@
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
- GrBackendFormat localFormat = format;
SkASSERT(sampleCnt > 0);
if (0 == fContext->contextPriv().caps()->getRenderTargetSampleCount(sampleCnt, config)) {
config = GrPixelConfigFallback(config);
- // TODO: First we should be checking the getRenderTargetSampleCount from the GrBackendFormat
- // and not GrPixelConfig. Besides that, we should implement the fallback in the caps, but
- // for now we just convert the fallback pixel config to an SkColorType and then get the
- // GrBackendFormat from that.
- SkColorType colorType;
- SkAssertResult(GrPixelConfigToColorType(config, &colorType));
- localFormat = fContext->fCaps->getBackendFormatFromColorType(colorType);
}
- return this->makeDeferredRenderTargetContext(localFormat, fit, width, height, config,
- std::move(colorSpace), sampleCnt, mipMapped,
- origin, surfaceProps, budgeted);
+ return this->makeDeferredRenderTargetContext(fit, width, height, config, std::move(colorSpace),
+ sampleCnt, mipMapped, origin, surfaceProps,
+ budgeted);
}
sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext(
- const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
@@ -1082,9 +1042,9 @@
sk_sp<GrTextureProxy> rtp;
if (GrMipMapped::kNo == mipMapped) {
- rtp = fContext->fProxyProvider->createProxy(format, desc, origin, fit, budgeted);
+ rtp = fContext->fProxyProvider->createProxy(desc, origin, fit, budgeted);
} else {
- rtp = fContext->fProxyProvider->createMipMapProxy(format, desc, origin, budgeted);
+ rtp = fContext->fProxyProvider->createMipMapProxy(desc, origin, budgeted);
}
if (!rtp) {
return nullptr;