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>
diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp
index a3f3221..bf8e1f8 100644
--- a/src/core/SkDeferredDisplayListRecorder.cpp
+++ b/src/core/SkDeferredDisplayListRecorder.cpp
@@ -179,7 +179,6 @@
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);
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 57c4aec..907cbf7 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -431,20 +431,6 @@
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) {
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index 8d8afbb..0b927f8 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -485,8 +485,6 @@
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;
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index e6bf834..ee301f9 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -242,7 +242,7 @@
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;
}
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index bfb0344..5c4e04a 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -385,7 +385,6 @@
if (!tempProxy) {
return false;
}
- SkASSERT(tempProxy->textureSwizzle() == tempReadSwizzle);
GrSurfaceProxyView tempView(tempProxy, tempOrigin, tempReadSwizzle);
GrSurfaceContext tempCtx(direct, tempView, colorType, alphaType,
this->colorInfo().refColorSpace());
diff --git a/src/gpu/GrSurfaceProxy.h b/src/gpu/GrSurfaceProxy.h
index 99cc181..5ee5ba8 100644
--- a/src/gpu/GrSurfaceProxy.h
+++ b/src/gpu/GrSurfaceProxy.h
@@ -138,7 +138,9 @@
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; }
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 6d667ba..d6bead7 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -47,7 +47,7 @@
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);
}
}
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index b51ef56..2275179 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -62,7 +62,7 @@
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;
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 078ae34..18728a4 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -250,7 +250,6 @@
}
// 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);
diff --git a/src/image/SkSurface_GpuMtl.mm b/src/image/SkSurface_GpuMtl.mm
index 53786fa..d42fa54 100644
--- a/src/image/SkSurface_GpuMtl.mm
+++ b/src/image/SkSurface_GpuMtl.mm
@@ -92,8 +92,6 @@
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 @@
GrSwizzle outputSwizzle = caps->getOutputSwizzle(backendFormat, grColorType);
- SkASSERT(readSwizzle == proxy->textureSwizzle());
-
GrSurfaceProxyView readView(proxy, origin, readSwizzle);
GrSurfaceProxyView outputView(std::move(proxy), origin, outputSwizzle);