Remove (mostly) getting swizzle from GrSurfaceProxy.

Bug: skia:9556
Change-Id: I1905e4e47005ecacf3dede5d32e17bddaf270b04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270200
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Greg Daniel 2020-02-12 13:05:42 -05:00 committed by Skia Commit-Bot
parent ea25fcf027
commit 87506ab405
10 changed files with 6 additions and 27 deletions

View File

@ -179,7 +179,6 @@ bool SkDeferredDisplayListRecorder::init() {
GrSwizzle outputSwizzle = caps->getOutputSwizzle(fCharacterization.backendFormat(),
grColorType);
SkASSERT(readSwizzle == proxy->textureSwizzle());
GrSurfaceProxyView readView(proxy, fCharacterization.origin(), readSwizzle);
GrSurfaceProxyView outputView(std::move(proxy), fCharacterization.origin(), outputSwizzle);

View File

@ -431,20 +431,6 @@ GrFragmentProcessor::TextureSampler::TextureSampler(GrSurfaceProxyView view,
GrTextureProxy::HighestFilterMode(proxy->backendFormat().textureType())));
}
GrFragmentProcessor::TextureSampler::TextureSampler(sk_sp<GrSurfaceProxy> proxy,
GrSamplerState samplerState) {
SkASSERT(proxy->asTextureProxy());
GrSurfaceOrigin origin = proxy->origin();
GrSwizzle swizzle = proxy->textureSwizzle();
fView = GrSurfaceProxyView(std::move(proxy), origin, swizzle);
fSamplerState = samplerState;
GrSurfaceProxy* surfProxy = this->proxy();
fSamplerState.setFilterMode(
std::min(samplerState.filter(),
GrTextureProxy::HighestFilterMode(surfProxy->backendFormat().textureType())));
}
#if GR_TEST_UTILS
void GrFragmentProcessor::TextureSampler::set(GrSurfaceProxyView view,
GrSamplerState samplerState) {

View File

@ -485,8 +485,6 @@ public:
explicit TextureSampler(const TextureSampler&) = default;
TextureSampler(GrSurfaceProxyView, GrSamplerState = {});
// TODO: Remove this ctor once all uses have been updated to pass in a GrSurfaceProxyView
TextureSampler(sk_sp<GrSurfaceProxy>, GrSamplerState = {});
TextureSampler& operator=(const TextureSampler&) = delete;

View File

@ -242,7 +242,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniq
SkASSERT(result->getUniqueKey() == key);
// createWrapped should've added this for us
SkASSERT(fUniquelyKeyedProxies.find(key));
SkASSERT(result->textureSwizzle() ==
SkASSERT(result->textureSwizzleDoNotUse() ==
this->caps()->getReadSwizzle(result->backendFormat(), colorType));
return result;
}

View File

@ -385,7 +385,6 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
if (!tempProxy) {
return false;
}
SkASSERT(tempProxy->textureSwizzle() == tempReadSwizzle);
GrSurfaceProxyView tempView(tempProxy, tempOrigin, tempReadSwizzle);
GrSurfaceContext tempCtx(direct, tempView, colorType, alphaType,
this->colorInfo().refColorSpace());

View File

@ -138,7 +138,9 @@ public:
return fOrigin;
}
const GrSwizzle& textureSwizzle() const { return fTextureSwizzle; }
// Do not call this. It will shortly be removed and is just needed for a couple cases where we
// are getting a proxy from the cache and cannot be certain what the GrColorType of the proxy.
const GrSwizzle& textureSwizzleDoNotUse() const { return fTextureSwizzle; }
const GrBackendFormat& backendFormat() const { return fFormat; }

View File

@ -47,7 +47,7 @@ GrSurfaceProxyView GrTextureAdjuster::copy(const CopyParams& copyParams, bool wi
if (cachedCopy && (!willBeMipped || GrMipMapped::kYes == cachedCopy->mipMapped())) {
// TODO: Once we no longer use CopyOnGpu which can fallback to arbitrary formats and
// colorTypes, we can use the swizzle of the originalView.
GrSwizzle swizzle = cachedCopy->textureSwizzle();
GrSwizzle swizzle = cachedCopy->textureSwizzleDoNotUse();
return GrSurfaceProxyView(std::move(cachedCopy), originalView.origin(), swizzle);
}
}

View File

@ -62,7 +62,7 @@ GrSurfaceProxyView GrTextureMaker::onRefTextureProxyViewForParams(GrSamplerState
GrMipMapped mipped = cachedProxy->mipMapped();
// TODO: Once we no longer use CopyOnGpu which can fallback to arbitrary formats and
// colorTypes, we can use the swizzle of the originalView.
GrSwizzle swizzle = cachedProxy->textureSwizzle();
GrSwizzle swizzle = cachedProxy->textureSwizzleDoNotUse();
cachedView = GrSurfaceProxyView(std::move(cachedProxy), origOrigin, swizzle);
if (!willBeMipped || GrMipMapped::kYes == mipped) {
return cachedView;

View File

@ -250,7 +250,6 @@ sk_sp<SkImage> SkImage::MakeTextureFromCompressed(GrContext* context, sk_sp<SkDa
}
// TODO: remove asserts when proxy doesn't hold origin or swizzle
SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
SkASSERT(proxy->textureSwizzle() == GrSwizzle());
GrSurfaceProxyView view(std::move(proxy));
SkColorType colorType = GrCompressionTypeToSkColorType(type);

View File

@ -92,8 +92,6 @@ sk_sp<SkSurface> SkSurface::MakeFromCAMetalLayer(GrContext* context,
GrSwizzle outputSwizzle = caps->getOutputSwizzle(backendFormat, grColorType);
SkASSERT(readSwizzle == proxy->textureSwizzle());
GrSurfaceProxyView readView(proxy, origin, readSwizzle);
GrSurfaceProxyView outputView(std::move(proxy), origin, outputSwizzle);
@ -167,8 +165,6 @@ sk_sp<SkSurface> SkSurface::MakeFromMTKView(GrContext* context,
GrSwizzle outputSwizzle = caps->getOutputSwizzle(backendFormat, grColorType);
SkASSERT(readSwizzle == proxy->textureSwizzle());
GrSurfaceProxyView readView(proxy, origin, readSwizzle);
GrSurfaceProxyView outputView(std::move(proxy), origin, outputSwizzle);