Remove texture swizzle from GrSurfaceProxy.
Bug: skia:9556
Change-Id: I2c450c51e1a0987aacebdfcf32ef76cd31f0e80b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279656
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp
index 996be4c..a1fb9f7 100644
--- a/src/core/SkDeferredDisplayListRecorder.cpp
+++ b/src/core/SkDeferredDisplayListRecorder.cpp
@@ -162,7 +162,6 @@
},
fCharacterization.backendFormat(),
fCharacterization.dimensions(),
- readSwizzle,
fCharacterization.sampleCount(),
surfaceFlags,
optionalTextureInfo,
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 4062e8f..77c406e 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -139,8 +139,6 @@
AHardwareBuffer* fAhb;
};
- GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, grColorType);
-
sk_sp<GrTextureProxy> texProxy = proxyProvider->createLazyProxy(
[direct, buffer = AutoAHBRelease(hardwareBuffer), width, height, isProtectedContent,
backendFormat, grColorType](
@@ -180,10 +178,12 @@
return tex;
},
- backendFormat, {width, height}, readSwizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
+ backendFormat, {width, height}, GrRenderable::kNo, 1, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
+ GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, grColorType);
+
return GrSurfaceProxyView(std::move(texProxy), fSurfaceOrigin, readSwizzle);
}
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 504bbcb..caee941 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -204,7 +204,7 @@
return {std::move(tex), true,
GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
- backendFormat, fBackendTexture.dimensions(), readSwizzle, GrRenderable::kNo, 1,
+ backendFormat, fBackendTexture.dimensions(), GrRenderable::kNo, 1,
textureIsMipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp
index f6bc4f2..5b29ff7 100644
--- a/src/gpu/GrBitmapTextureMaker.cpp
+++ b/src/gpu/GrBitmapTextureMaker.cpp
@@ -66,8 +66,7 @@
};
if (fKey.isValid()) {
- auto colorType = SkColorTypeToGrColorType(fBitmap.colorType());
- proxy = proxyProvider->findOrCreateProxyByUniqueKey(fKey, colorType);
+ proxy = proxyProvider->findOrCreateProxyByUniqueKey(fKey);
if (proxy) {
swizzle = this->context()->priv().caps()->getReadSwizzle(proxy->backendFormat(),
this->colorType());
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 2d4ba21..4d084f9 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -83,7 +83,7 @@
if (key.isValid()) {
// TODO: this cache look up is duplicated in draw_shape_with_mask_filter for gpu
static const GrSurfaceOrigin kCacheOrigin = kTopLeft_GrSurfaceOrigin;
- auto filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8);
+ auto filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(key);
if (filteredMask) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(
filteredMask->backendFormat(), GrColorType::kAlpha_8);
@@ -400,8 +400,7 @@
if (maskKey.isValid()) {
// TODO: this cache look up is duplicated in sw_draw_with_mask_filter for raster
static const GrSurfaceOrigin kCacheOrigin = kTopLeft_GrSurfaceOrigin;
- auto filteredMask =
- proxyProvider->findOrCreateProxyByUniqueKey(maskKey, GrColorType::kAlpha_8);
+ auto filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(maskKey);
if (filteredMask) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(
filteredMask->backendFormat(), GrColorType::kAlpha_8);
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 66f2de8..8c3a0f2 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -359,8 +359,7 @@
create_clip_mask_key(reducedClip.maskGenID(), reducedClip.scissor(),
reducedClip.numAnalyticFPs(), &key);
- if (sk_sp<GrTextureProxy> proxy =
- proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
@@ -474,8 +473,7 @@
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
const GrCaps* caps = context->priv().caps();
- if (sk_sp<GrTextureProxy> proxy =
- proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
@@ -502,7 +500,6 @@
// to ops), so it can't have any pending IO.
auto proxy = proxyProvider->createProxy(format,
maskSpaceIBounds.size(),
- swizzle,
GrRenderable::kNo,
1,
GrMipMapped::kNo,
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index 863ed56..262c320e 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -571,9 +571,9 @@
for (uint32_t i = 0; i < this->maxPages(); ++i) {
GrSwizzle swizzle = proxyProvider->caps()->getReadSwizzle(fFormat, fColorType);
sk_sp<GrSurfaceProxy> proxy = proxyProvider->createProxy(
- fFormat, dims, swizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
- SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo,
- GrInternalSurfaceFlags::kNone, GrSurfaceProxy::UseAllocator::kNo);
+ fFormat, dims, GrRenderable::kNo, 1, GrMipMapped::kNo, SkBackingFit::kExact,
+ SkBudgeted::kYes, GrProtected::kNo, GrInternalSurfaceFlags::kNone,
+ GrSurfaceProxy::UseAllocator::kNo);
if (!proxy) {
return false;
}
diff --git a/src/gpu/GrDynamicAtlas.cpp b/src/gpu/GrDynamicAtlas.cpp
index 69cf1ca..1ad8c6c 100644
--- a/src/gpu/GrDynamicAtlas.cpp
+++ b/src/gpu/GrDynamicAtlas.cpp
@@ -60,11 +60,9 @@
return cb(rp, format, sampleCount);
};
- GrSwizzle readSwizzle = caps.getReadSwizzle(format, colorType);
-
- sk_sp<GrTextureProxy> proxy = GrProxyProvider::MakeFullyLazyProxy(
- std::move(instantiate), format, readSwizzle, GrRenderable::kYes, sampleCount,
- GrProtected::kNo, caps, useAllocator);
+ sk_sp<GrTextureProxy> proxy =
+ GrProxyProvider::MakeFullyLazyProxy(std::move(instantiate), format, GrRenderable::kYes,
+ sampleCount, GrProtected::kNo, caps, useAllocator);
return proxy;
}
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index 8a48cb5..0ca9f13 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -80,10 +80,9 @@
sk_sp<GrTextureProxy> GrOnFlushResourceProvider::findOrCreateProxyByUniqueKey(
const GrUniqueKey& key,
- GrColorType colorType,
UseAllocator useAllocator) {
auto proxyProvider = fDrawingMgr->getContext()->priv().proxyProvider();
- return proxyProvider->findOrCreateProxyByUniqueKey(key, colorType, useAllocator);
+ return proxyProvider->findOrCreateProxyByUniqueKey(key, useAllocator);
}
bool GrOnFlushResourceProvider::instatiateProxy(GrSurfaceProxy* proxy) {
diff --git a/src/gpu/GrOnFlushResourceProvider.h b/src/gpu/GrOnFlushResourceProvider.h
index 28feefd..0583dbc 100644
--- a/src/gpu/GrOnFlushResourceProvider.h
+++ b/src/gpu/GrOnFlushResourceProvider.h
@@ -76,10 +76,7 @@
bool assignUniqueKeyToProxy(const GrUniqueKey&, GrTextureProxy*);
void removeUniqueKeyFromProxy(GrTextureProxy*);
void processInvalidUniqueKey(const GrUniqueKey&);
- // GrColorType is necessary to set the proxy's texture swizzle.
- sk_sp<GrTextureProxy> findOrCreateProxyByUniqueKey(const GrUniqueKey&,
- GrColorType,
- UseAllocator);
+ sk_sp<GrTextureProxy> findOrCreateProxyByUniqueKey(const GrUniqueKey&, UseAllocator);
bool instatiateProxy(GrSurfaceProxy*);
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index 9a7bc2d..7d79136 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -12,6 +12,7 @@
#include "src/gpu/GrNonAtomicRef.h"
#include "src/gpu/GrProcessor.h"
#include "src/gpu/GrShaderVar.h"
+#include "src/gpu/GrSwizzle.h"
class GrCoordTransform;
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 10cb353..4fb2a64 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -114,7 +114,6 @@
#if GR_TEST_UTILS
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
SkISize dimensions,
- GrColorType colorType,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -150,7 +149,7 @@
return nullptr;
}
- return this->createWrapped(std::move(tex), colorType, UseAllocator::kYes);
+ return this->createWrapped(std::move(tex), UseAllocator::kYes);
}
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
@@ -167,7 +166,6 @@
}
auto format = this->caps()->getDefaultBackendFormat(colorType, renderable);
return this->testingOnly_createInstantiatedProxy(dimensions,
- colorType,
format,
renderable,
renderTargetSampleCnt,
@@ -176,32 +174,27 @@
isProtected);
}
-sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createWrapped(sk_sp<GrTexture> tex,
- GrColorType colorType) {
- return this->createWrapped(std::move(tex), colorType, UseAllocator::kYes);
+sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createWrapped(sk_sp<GrTexture> tex) {
+ return this->createWrapped(std::move(tex), UseAllocator::kYes);
}
#endif
sk_sp<GrTextureProxy> GrProxyProvider::createWrapped(sk_sp<GrTexture> tex,
- GrColorType colorType,
UseAllocator useAllocator) {
#ifdef SK_DEBUG
if (tex->getUniqueKey().isValid()) {
SkASSERT(!this->findProxyByUniqueKey(tex->getUniqueKey()));
}
#endif
- GrSwizzle readSwizzle = this->caps()->getReadSwizzle(tex->backendFormat(), colorType);
if (tex->asRenderTarget()) {
- return sk_sp<GrTextureProxy>(
- new GrTextureRenderTargetProxy(std::move(tex), readSwizzle, useAllocator));
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), useAllocator));
} else {
- return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), readSwizzle, useAllocator));
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), useAllocator));
}
}
sk_sp<GrTextureProxy> GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniqueKey& key,
- GrColorType colorType,
UseAllocator useAllocator) {
ASSERT_SINGLE_OWNER
@@ -229,12 +222,10 @@
sk_sp<GrTexture> texture(static_cast<GrSurface*>(resource)->asTexture());
SkASSERT(texture);
- result = this->createWrapped(std::move(texture), colorType, useAllocator);
+ result = this->createWrapped(std::move(texture), useAllocator);
SkASSERT(result->getUniqueKey() == key);
// createWrapped should've added this for us
SkASSERT(fUniquelyKeyedProxies.find(key));
- SkASSERT(result->textureSwizzleDoNotUse() ==
- this->caps()->getReadSwizzle(result->backendFormat(), colorType));
return result;
}
@@ -269,18 +260,12 @@
copyBitmap.setImmutable();
}
- GrColorType grCT = SkColorTypeToGrColorType(copyBitmap.info().colorType());
- GrBackendFormat format = this->caps()->getDefaultBackendFormat(grCT, GrRenderable::kNo);
- if (!format.isValid()) {
- return nullptr;
- }
-
sk_sp<GrTextureProxy> proxy;
if (mipMapped == GrMipMapped::kNo ||
0 == SkMipMap::ComputeLevelCount(copyBitmap.width(), copyBitmap.height())) {
- proxy = this->createNonMippedProxyFromBitmap(copyBitmap, fit, format, grCT, budgeted);
+ proxy = this->createNonMippedProxyFromBitmap(copyBitmap, fit, budgeted);
} else {
- proxy = this->createMippedProxyFromBitmap(copyBitmap, format, grCT, budgeted);
+ proxy = this->createMippedProxyFromBitmap(copyBitmap, budgeted);
}
if (!proxy) {
@@ -302,12 +287,15 @@
sk_sp<GrTextureProxy> GrProxyProvider::createNonMippedProxyFromBitmap(const SkBitmap& bitmap,
SkBackingFit fit,
- const GrBackendFormat& format,
- GrColorType colorType,
SkBudgeted budgeted) {
- GrSwizzle swizzle = this->caps()->getReadSwizzle(format, colorType);
auto dims = bitmap.dimensions();
+ auto colorType = SkColorTypeToGrColorType(bitmap.colorType());
+ GrBackendFormat format = this->caps()->getDefaultBackendFormat(colorType, GrRenderable::kNo);
+ if (!format.isValid()) {
+ return nullptr;
+ }
+
sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
[dims, format, bitmap, fit, colorType, budgeted](GrResourceProvider* resourceProvider) {
GrMipLevel mipLevel = { bitmap.getPixels(), bitmap.rowBytes() };
@@ -316,9 +304,8 @@
dims, format, colorType, GrRenderable::kNo, 1, budgeted, fit,
GrProtected::kNo, mipLevel));
},
- format, dims, swizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
- GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone, fit, budgeted,
- GrProtected::kNo, UseAllocator::kYes);
+ format, dims, GrRenderable::kNo, 1, GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated,
+ GrInternalSurfaceFlags::kNone, fit, budgeted, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
return nullptr;
@@ -328,18 +315,20 @@
}
sk_sp<GrTextureProxy> GrProxyProvider::createMippedProxyFromBitmap(const SkBitmap& bitmap,
- const GrBackendFormat& format,
- GrColorType colorType,
SkBudgeted budgeted) {
SkASSERT(this->caps()->mipMapSupport());
+ auto colorType = SkColorTypeToGrColorType(bitmap.colorType());
+ GrBackendFormat format = this->caps()->getDefaultBackendFormat(colorType, GrRenderable::kNo);
+ if (!format.isValid()) {
+ return nullptr;
+ }
sk_sp<SkMipMap> mipmaps(SkMipMap::Build(bitmap.pixmap(), nullptr));
if (!mipmaps) {
return nullptr;
}
- GrSwizzle readSwizzle = this->caps()->getReadSwizzle(format, colorType);
auto dims = bitmap.dimensions();
sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
@@ -363,9 +352,9 @@
dims, format, colorType, GrRenderable::kNo, 1, budgeted, GrProtected::kNo,
texels.get(), mipLevelCount));
},
- format, dims, readSwizzle, GrRenderable::kNo, 1, GrMipMapped::kYes,
- GrMipMapsStatus::kValid, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact, budgeted,
- GrProtected::kNo, UseAllocator::kYes);
+ format, dims, GrRenderable::kNo, 1, GrMipMapped::kYes, GrMipMapsStatus::kValid,
+ GrInternalSurfaceFlags::kNone, SkBackingFit::kExact, budgeted, GrProtected::kNo,
+ UseAllocator::kYes);
if (!proxy) {
return nullptr;
@@ -378,7 +367,6 @@
sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format,
SkISize dimensions,
- GrSwizzle readSwizzle,
GrRenderable renderable,
int renderTargetSampleCnt,
GrMipMapped mipMapped,
@@ -421,13 +409,13 @@
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(
- *caps, format, dimensions, renderTargetSampleCnt, mipMapped, mipMapsStatus,
- readSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator));
+ *caps, format, dimensions, renderTargetSampleCnt, mipMapped, mipMapsStatus, fit,
+ budgeted, isProtected, surfaceFlags, useAllocator));
}
return sk_sp<GrTextureProxy>(new GrTextureProxy(format, dimensions, mipMapped, mipMapsStatus,
- readSwizzle, fit, budgeted, isProtected,
- surfaceFlags, useAllocator));
+ fit, budgeted, isProtected, surfaceFlags,
+ useAllocator));
}
sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
@@ -454,7 +442,7 @@
return LazyCallbackResult(resourceProvider->createCompressedTexture(
dimensions, format, budgeted, mipMapped, isProtected, data.get()));
},
- format, dimensions, GrSwizzle(), GrRenderable::kNo, 1, mipMapped, mipMapsStatus,
+ format, dimensions, GrRenderable::kNo, 1, mipMapped, mipMapsStatus,
GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kYes,
GrProtected::kNo, UseAllocator::kYes);
@@ -492,8 +480,6 @@
return nullptr;
}
- const GrCaps* caps = this->caps();
-
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
sk_sp<GrTexture> tex =
@@ -511,10 +497,7 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
- GrSwizzle readSwizzle = caps->getReadSwizzle(tex->backendFormat(), grColorType);
-
- return sk_sp<GrTextureProxy>(
- new GrTextureProxy(std::move(tex), readSwizzle, UseAllocator::kNo));
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), UseAllocator::kNo));
}
sk_sp<GrTextureProxy> GrProxyProvider::wrapCompressedBackendTexture(const GrBackendTexture& beTex,
@@ -532,8 +515,6 @@
return nullptr;
}
- const GrCaps* caps = this->caps();
-
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
sk_sp<GrTexture> tex = resourceProvider->wrapCompressedBackendTexture(beTex, ownership,
@@ -550,12 +531,7 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
- SkImage::CompressionType compressionType = caps->compressionType(beTex.getBackendFormat());
-
- GrSwizzle texSwizzle = SkCompressionTypeIsOpaque(compressionType) ? GrSwizzle::RGB1()
- : GrSwizzle::RGBA();
-
- return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), texSwizzle, UseAllocator::kNo));
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), UseAllocator::kNo));
}
sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
@@ -599,10 +575,7 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
- GrSwizzle readSwizzle = caps->getReadSwizzle(tex->backendFormat(), colorType);
-
- return sk_sp<GrTextureProxy>(
- new GrTextureRenderTargetProxy(std::move(tex), readSwizzle, UseAllocator::kNo));
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), UseAllocator::kNo));
}
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget(
@@ -618,8 +591,6 @@
return nullptr;
}
- const GrCaps* caps = this->caps();
-
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
sk_sp<GrRenderTarget> rt = resourceProvider->wrapBackendRenderTarget(backendRT, grColorType);
@@ -636,10 +607,7 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
- GrSwizzle readSwizzle = caps->getReadSwizzle(rt->backendFormat(), grColorType);
-
- return sk_sp<GrRenderTargetProxy>(
- new GrRenderTargetProxy(std::move(rt), readSwizzle, UseAllocator::kNo));
+ return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(rt), UseAllocator::kNo));
}
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget(
@@ -654,8 +622,6 @@
return nullptr;
}
- const GrCaps* caps = this->caps();
-
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
sk_sp<GrRenderTarget> rt =
@@ -668,10 +634,7 @@
// This proxy should be unbudgeted because we're just wrapping an external resource
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
- GrSwizzle readSwizzle = caps->getReadSwizzle(rt->backendFormat(), grColorType);
-
- return sk_sp<GrSurfaceProxy>(
- new GrRenderTargetProxy(std::move(rt), readSwizzle, UseAllocator::kNo));
+ return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(rt), UseAllocator::kNo));
}
sk_sp<GrRenderTargetProxy> GrProxyProvider::wrapVulkanSecondaryCBAsRenderTarget(
@@ -700,22 +663,19 @@
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
GrColorType colorType = SkColorTypeToGrColorType(imageInfo.colorType());
- GrSwizzle readSwizzle = this->caps()->getReadSwizzle(rt->backendFormat(), colorType);
if (!this->caps()->isFormatAsColorTypeRenderable(colorType, rt->backendFormat(),
rt->numSamples())) {
return nullptr;
}
- return sk_sp<GrRenderTargetProxy>(
- new GrRenderTargetProxy(std::move(rt), readSwizzle, UseAllocator::kNo,
- GrRenderTargetProxy::WrapsVkSecondaryCB::kYes));
+ return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(
+ std::move(rt), UseAllocator::kNo, GrRenderTargetProxy::WrapsVkSecondaryCB::kYes));
}
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
- GrSwizzle readSwizzle,
GrRenderable renderable,
int renderTargetSampleCnt,
GrMipMapped mipMapped,
@@ -749,7 +709,6 @@
renderTargetSampleCnt,
mipMapped,
mipMapsStatus,
- readSwizzle,
fit,
budgeted,
isProtected,
@@ -761,7 +720,6 @@
dimensions,
mipMapped,
mipMapsStatus,
- readSwizzle,
fit,
budgeted,
isProtected,
@@ -774,7 +732,6 @@
LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
- GrSwizzle readSwizzle,
int sampleCnt,
GrInternalSurfaceFlags surfaceFlags,
const TextureInfo* textureInfo,
@@ -802,8 +759,8 @@
SkASSERT(!wrapsVkSecondaryCB);
return sk_sp<GrRenderTargetProxy>(new GrTextureRenderTargetProxy(
*this->caps(), std::move(callback), format, dimensions, sampleCnt,
- textureInfo->fMipMapped, mipMapsStatus, readSwizzle, fit, budgeted, isProtected,
- surfaceFlags, useAllocator));
+ textureInfo->fMipMapped, mipMapsStatus, fit, budgeted, isProtected, surfaceFlags,
+ useAllocator));
}
GrRenderTargetProxy::WrapsVkSecondaryCB vkSCB =
@@ -811,13 +768,12 @@
: GrRenderTargetProxy::WrapsVkSecondaryCB::kNo;
return sk_sp<GrRenderTargetProxy>(
- new GrRenderTargetProxy(std::move(callback), format, dimensions, sampleCnt, readSwizzle,
- fit, budgeted, isProtected, surfaceFlags, useAllocator, vkSCB));
+ new GrRenderTargetProxy(std::move(callback), format, dimensions, sampleCnt, fit,
+ budgeted, isProtected, surfaceFlags, useAllocator, vkSCB));
}
sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
- GrSwizzle readSwizzle,
GrRenderable renderable,
int renderTargetSampleCnt,
GrProtected isProtected,
@@ -834,13 +790,13 @@
if (GrRenderable::kYes == renderable) {
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(
caps, std::move(callback), format, kLazyDims, renderTargetSampleCnt,
- GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, readSwizzle,
- SkBackingFit::kApprox, SkBudgeted::kYes, isProtected, surfaceFlags, useAllocator));
- } else {
- return sk_sp<GrTextureProxy>(new GrTextureProxy(
- std::move(callback), format, kLazyDims, GrMipMapped::kNo,
- GrMipMapsStatus::kNotAllocated, readSwizzle, SkBackingFit::kApprox,
+ GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, SkBackingFit::kApprox,
SkBudgeted::kYes, isProtected, surfaceFlags, useAllocator));
+ } else {
+ return sk_sp<GrTextureProxy>(
+ new GrTextureProxy(std::move(callback), format, kLazyDims, GrMipMapped::kNo,
+ GrMipMapsStatus::kNotAllocated, SkBackingFit::kApprox,
+ SkBudgeted::kYes, isProtected, surfaceFlags, useAllocator));
}
}
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index e4ea2d4..db2dd09 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -54,12 +54,9 @@
/*
* Finds a proxy by unique key or creates a new one that wraps a resource matching the unique
- * key. GrColorType is required to set the proxy's texture swizzle on creation. For any key,
- * each call that might result in a cache hit must provide the same colorType as the call that
- * caused a cache miss and created the proxy.
+ * key.
*/
sk_sp<GrTextureProxy> findOrCreateProxyByUniqueKey(const GrUniqueKey&,
- GrColorType colorType,
UseAllocator = UseAllocator::kYes);
/*
@@ -76,7 +73,6 @@
*/
sk_sp<GrTextureProxy> createProxy(const GrBackendFormat&,
SkISize dimensions,
- GrSwizzle readSwizzle,
GrRenderable,
int renderTargetSampleCnt,
GrMipMapped,
@@ -158,7 +154,6 @@
sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
SkISize dimensions,
- GrSwizzle readSwizzle,
GrRenderable,
int renderTargetSampleCnt,
GrMipMapped,
@@ -173,7 +168,6 @@
sk_sp<GrRenderTargetProxy> createLazyRenderTargetProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
SkISize dimensions,
- GrSwizzle readSwizzle,
int renderTargetSampleCnt,
GrInternalSurfaceFlags,
const TextureInfo*,
@@ -190,7 +184,6 @@
*/
static sk_sp<GrTextureProxy> MakeFullyLazyProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
- GrSwizzle readSwizzle,
GrRenderable,
int renderTargetSampleCnt,
GrProtected,
@@ -235,12 +228,10 @@
bool renderingDirectly() const;
#if GR_TEST_UTILS
- /*
+ /**
* Create a texture proxy that is backed by an instantiated GrSurface.
- * TODO: Remove GrColorType. Currently used to infer a readSwizzle.
*/
sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(SkISize dimensions,
- GrColorType colorType,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -257,7 +248,7 @@
SkBudgeted budgeted,
GrProtected isProtected);
- sk_sp<GrTextureProxy> testingOnly_createWrapped(sk_sp<GrTexture>, GrColorType);
+ sk_sp<GrTextureProxy> testingOnly_createWrapped(sk_sp<GrTexture>);
#endif
private:
@@ -275,19 +266,14 @@
/*
* Create an un-mipmapped texture proxy for the bitmap.
*/
- sk_sp<GrTextureProxy> createNonMippedProxyFromBitmap(
- const SkBitmap&, SkBackingFit, const GrBackendFormat&, GrColorType, SkBudgeted);
+ sk_sp<GrTextureProxy> createNonMippedProxyFromBitmap(const SkBitmap&, SkBackingFit, SkBudgeted);
/*
* Create an mipmapped texture proxy for the bitmap.
*/
sk_sp<GrTextureProxy> createMippedProxyFromBitmap(const SkBitmap&,
- const GrBackendFormat&,
- GrColorType,
SkBudgeted);
- // GrColorType is used to determine the proxy's texture swizzle.
- sk_sp<GrTextureProxy> createWrapped(sk_sp<GrTexture> tex, GrColorType,
- UseAllocator useAllocator);
+ sk_sp<GrTextureProxy> createWrapped(sk_sp<GrTexture> tex, UseAllocator useAllocator);
struct UniquelyKeyedProxyHashTraits {
static const GrUniqueKey& GetKey(const GrTextureProxy& p) { return p.getUniqueKey(); }
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index c9af7f8..9476695 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -181,10 +181,8 @@
return nullptr;
}
- GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
-
sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
- format, dimensions, swizzle, GrRenderable::kYes, sampleCnt, mipMapped, fit, budgeted,
+ format, dimensions, GrRenderable::kYes, sampleCnt, mipMapped, fit, budgeted,
isProtected);
if (!proxy) {
return nullptr;
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index ed693f3..824a599 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -25,14 +25,12 @@
const GrBackendFormat& format,
SkISize dimensions,
int sampleCount,
- const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : INHERITED(format, dimensions, GrRenderable::kYes, textureSwizzle, fit, budgeted,
- isProtected, surfaceFlags, useAllocator)
+ : INHERITED(format, dimensions, fit, budgeted, isProtected, surfaceFlags, useAllocator)
, fSampleCnt(sampleCount)
, fWrapsVkSecondaryCB(WrapsVkSecondaryCB::kNo) {}
@@ -41,24 +39,22 @@
const GrBackendFormat& format,
SkISize dimensions,
int sampleCount,
- const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator,
WrapsVkSecondaryCB wrapsVkSecondaryCB)
- : INHERITED(std::move(callback), format, dimensions, GrRenderable::kYes, textureSwizzle,
- fit, budgeted, isProtected, surfaceFlags, useAllocator)
+ : INHERITED(std::move(callback), format, dimensions, fit, budgeted, isProtected,
+ surfaceFlags, useAllocator)
, fSampleCnt(sampleCount)
, fWrapsVkSecondaryCB(wrapsVkSecondaryCB) {}
// Wrapped version
GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf,
- const GrSwizzle& textureSwizzle,
UseAllocator useAllocator,
WrapsVkSecondaryCB wrapsVkSecondaryCB)
- : INHERITED(std::move(surf), textureSwizzle, SkBackingFit::kExact, useAllocator)
+ : INHERITED(std::move(surf), SkBackingFit::kExact, useAllocator)
, fSampleCnt(fTarget->asRenderTarget()->numSamples())
, fWrapsVkSecondaryCB(wrapsVkSecondaryCB) {
// The kRequiresManualMSAAResolve flag better not be set if we are not multisampled or if
diff --git a/src/gpu/GrRenderTargetProxy.h b/src/gpu/GrRenderTargetProxy.h
index 576d37c..8f58bb4 100644
--- a/src/gpu/GrRenderTargetProxy.h
+++ b/src/gpu/GrRenderTargetProxy.h
@@ -95,7 +95,6 @@
const GrBackendFormat&,
SkISize,
int sampleCount,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
GrProtected,
@@ -118,7 +117,6 @@
const GrBackendFormat&,
SkISize,
int sampleCount,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
GrProtected,
@@ -128,7 +126,6 @@
// Wrapped version
GrRenderTargetProxy(sk_sp<GrSurface>,
- const GrSwizzle& textureSwizzle,
UseAllocator,
WrapsVkSecondaryCB = WrapsVkSecondaryCB::kNo);
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index ece4e5a..98c30bb 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -184,8 +184,8 @@
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kAlpha_8);
auto proxy =
- proxyProvider->createProxy(format, dimensions, swizzle, GrRenderable::kNo, 1,
- GrMipMapped::kNo, fit, SkBudgeted::kYes, GrProtected::kNo);
+ proxyProvider->createProxy(format, dimensions, GrRenderable::kNo, 1, GrMipMapped::kNo,
+ fit, SkBudgeted::kYes, GrProtected::kNo);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
}
@@ -311,7 +311,7 @@
sk_sp<GrTextureProxy> proxy;
GrSurfaceProxyView view;
if (useCache) {
- auto proxy = fProxyProvider->findOrCreateProxyByUniqueKey(maskKey, GrColorType::kAlpha_8);
+ auto proxy = fProxyProvider->findOrCreateProxyByUniqueKey(maskKey);
if (proxy) {
GrSwizzle swizzle = args.fRenderTargetContext->caps()->getReadSwizzle(
proxy->backendFormat(), GrColorType::kAlpha_8);
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 629532b..0b799b9 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -77,8 +77,8 @@
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
- format, dimensions, swizzle, renderable, renderTargetSampleCnt, mipMapped, fit,
- budgeted, isProtected);
+ format, dimensions, renderable, renderTargetSampleCnt, mipMapped, fit, budgeted,
+ isProtected);
if (!proxy) {
return nullptr;
}
@@ -380,8 +380,8 @@
GrSurfaceOrigin tempOrigin =
this->asRenderTargetContext() ? kTopLeft_GrSurfaceOrigin : this->origin();
auto tempProxy = direct->priv().proxyProvider()->createProxy(
- format, srcInfo.dimensions(), tempReadSwizzle, GrRenderable::kNo, 1,
- GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
+ format, srcInfo.dimensions(), GrRenderable::kNo, 1, GrMipMapped::kNo,
+ SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
if (!tempProxy) {
return false;
}
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 12cac52..3733765 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -46,8 +46,6 @@
// Deferred version
GrSurfaceProxy::GrSurfaceProxy(const GrBackendFormat& format,
SkISize dimensions,
- GrRenderable renderable,
- const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
@@ -56,7 +54,6 @@
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
, fDimensions(dimensions)
- , fTextureSwizzle(textureSwizzle)
, fFit(fit)
, fBudgeted(budgeted)
, fUseAllocator(useAllocator)
@@ -70,8 +67,6 @@
GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
- GrRenderable renderable,
- const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
@@ -80,7 +75,6 @@
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
, fDimensions(dimensions)
- , fTextureSwizzle(textureSwizzle)
, fFit(fit)
, fBudgeted(budgeted)
, fUseAllocator(useAllocator)
@@ -94,14 +88,12 @@
// Wrapped version
GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface,
- const GrSwizzle& textureSwizzle,
SkBackingFit fit,
UseAllocator useAllocator)
: fTarget(std::move(surface))
, fSurfaceFlags(fTarget->surfacePriv().flags())
, fFormat(fTarget->backendFormat())
, fDimensions(fTarget->dimensions())
- , fTextureSwizzle(textureSwizzle)
, fFit(fit)
, fBudgeted(fTarget->resourcePriv().budgetedType() == GrBudgetedType::kBudgeted
? SkBudgeted::kYes
diff --git a/src/gpu/GrSurfaceProxy.h b/src/gpu/GrSurfaceProxy.h
index 0b6fe65..064ed91 100644
--- a/src/gpu/GrSurfaceProxy.h
+++ b/src/gpu/GrSurfaceProxy.h
@@ -14,7 +14,6 @@
#include "src/gpu/GrGpuResource.h"
#include "src/gpu/GrNonAtomicRef.h"
#include "src/gpu/GrSurface.h"
-#include "src/gpu/GrSwizzle.h"
#include "src/gpu/GrTexture.h"
class GrCaps;
@@ -133,10 +132,6 @@
return SkRect::Make(this->backingStoreDimensions());
}
- // 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; }
bool isFormatCompressed(const GrCaps*) const;
@@ -325,8 +320,6 @@
// Deferred version - takes a new UniqueID from the shared resource/proxy pool.
GrSurfaceProxy(const GrBackendFormat&,
SkISize,
- GrRenderable,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
GrProtected,
@@ -336,8 +329,6 @@
GrSurfaceProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
SkISize,
- GrRenderable,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
GrProtected,
@@ -349,7 +340,6 @@
// in allocation by having its backing resource recycled to other uninstantiated proxies or
// not depending on UseAllocator.
GrSurfaceProxy(sk_sp<GrSurface>,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
UseAllocator);
@@ -397,7 +387,6 @@
// wrapped resource.
const GrBackendFormat fFormat;
SkISize fDimensions;
- const GrSwizzle fTextureSwizzle;
SkBackingFit fFit; // always kApprox for lazy-callback resources
// always kExact for wrapped resources
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 6867e40..2ce781c 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -32,7 +32,7 @@
}
sk_sp<GrTextureProxy> cachedCopy;
if (mipMappedKey.isValid()) {
- cachedCopy = proxyProvider->findOrCreateProxyByUniqueKey(mipMappedKey, this->colorType());
+ cachedCopy = proxyProvider->findOrCreateProxyByUniqueKey(mipMappedKey);
if (cachedCopy) {
return {std::move(cachedCopy), fOriginal.origin(), fOriginal.swizzle()};
}
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 00c74e1..573d777 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -20,14 +20,12 @@
SkISize dimensions,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
- const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : INHERITED(format, dimensions, GrRenderable::kNo, textureSwizzle, fit, budgeted,
- isProtected, surfaceFlags, useAllocator)
+ : INHERITED(format, dimensions, fit, budgeted, isProtected, surfaceFlags, useAllocator)
, fMipMapped(mipMapped)
, fMipMapsStatus(mipMapsStatus) SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
, fProxyProvider(nullptr)
@@ -41,14 +39,13 @@
SkISize dimensions,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
- const GrSwizzle& texSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : INHERITED(std::move(callback), format, dimensions, GrRenderable::kNo, texSwizzle, fit,
- budgeted, isProtected, surfaceFlags, useAllocator)
+ : INHERITED(std::move(callback), format, dimensions, fit, budgeted, isProtected,
+ surfaceFlags, useAllocator)
, fMipMapped(mipMapped)
, fMipMapsStatus(mipMapsStatus) SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
, fProxyProvider(nullptr)
@@ -57,10 +54,8 @@
}
// Wrapped version
-GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf,
- const GrSwizzle& textureSwizzle,
- UseAllocator useAllocator)
- : INHERITED(std::move(surf), textureSwizzle, SkBackingFit::kExact, useAllocator)
+GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, UseAllocator useAllocator)
+ : INHERITED(std::move(surf), SkBackingFit::kExact, useAllocator)
, fMipMapped(fTarget->asTexture()->texturePriv().mipMapped())
, fMipMapsStatus(fTarget->asTexture()->texturePriv().mipMapsStatus())
SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
diff --git a/src/gpu/GrTextureProxy.h b/src/gpu/GrTextureProxy.h
index fed523d..f951546 100644
--- a/src/gpu/GrTextureProxy.h
+++ b/src/gpu/GrTextureProxy.h
@@ -112,7 +112,6 @@
SkISize,
GrMipMapped,
GrMipMapsStatus,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
GrProtected,
@@ -134,7 +133,6 @@
SkISize,
GrMipMapped,
GrMipMapsStatus,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
GrProtected,
@@ -142,7 +140,7 @@
UseAllocator);
// Wrapped version
- GrTextureProxy(sk_sp<GrSurface>, const GrSwizzle&, UseAllocator);
+ GrTextureProxy(sk_sp<GrSurface>, UseAllocator);
~GrTextureProxy() override;
diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp
index 69b24a5..93e5f17 100644
--- a/src/gpu/GrTextureRenderTargetProxy.cpp
+++ b/src/gpu/GrTextureRenderTargetProxy.cpp
@@ -26,19 +26,17 @@
int sampleCnt,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
- const GrSwizzle& texSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : GrSurfaceProxy(format, dimensions, GrRenderable::kYes, texSwizzle, fit, budgeted,
- isProtected, surfaceFlags, useAllocator)
+ : GrSurfaceProxy(format, dimensions, fit, budgeted, isProtected, surfaceFlags, useAllocator)
// for now textures w/ data are always wrapped
- , GrRenderTargetProxy(caps, format, dimensions, sampleCnt, texSwizzle, fit, budgeted,
- isProtected, surfaceFlags, useAllocator)
- , GrTextureProxy(format, dimensions, mipMapped, mipMapsStatus, texSwizzle, fit, budgeted,
- isProtected, surfaceFlags, useAllocator) {
+ , GrRenderTargetProxy(caps, format, dimensions, sampleCnt, fit, budgeted, isProtected,
+ surfaceFlags, useAllocator)
+ , GrTextureProxy(format, dimensions, mipMapped, mipMapsStatus, fit, budgeted, isProtected,
+ surfaceFlags, useAllocator) {
this->initSurfaceFlags(caps);
}
@@ -50,21 +48,20 @@
int sampleCnt,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
- const GrSwizzle& texSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : GrSurfaceProxy(std::move(callback), format, dimensions, GrRenderable::kYes, texSwizzle,
- fit, budgeted, isProtected, surfaceFlags, useAllocator)
+ : GrSurfaceProxy(std::move(callback), format, dimensions, fit, budgeted, isProtected,
+ surfaceFlags, useAllocator)
// Since we have virtual inheritance, we initialize GrSurfaceProxy directly. Send null
// callbacks to the texture and RT proxies simply to route to the appropriate constructors.
- , GrRenderTargetProxy(LazyInstantiateCallback(), format, dimensions, sampleCnt, texSwizzle,
- fit, budgeted, isProtected, surfaceFlags, useAllocator,
+ , GrRenderTargetProxy(LazyInstantiateCallback(), format, dimensions, sampleCnt, fit,
+ budgeted, isProtected, surfaceFlags, useAllocator,
WrapsVkSecondaryCB::kNo)
, GrTextureProxy(LazyInstantiateCallback(), format, dimensions, mipMapped, mipMapsStatus,
- texSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator) {
+ fit, budgeted, isProtected, surfaceFlags, useAllocator) {
this->initSurfaceFlags(caps);
}
@@ -72,11 +69,10 @@
// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and
// GrRenderTargetProxy) so its constructor must be explicitly called.
GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp<GrSurface> surf,
- const GrSwizzle& texSwizzle,
UseAllocator useAllocator)
- : GrSurfaceProxy(surf, texSwizzle, SkBackingFit::kExact, useAllocator)
- , GrRenderTargetProxy(surf, texSwizzle, useAllocator)
- , GrTextureProxy(surf, texSwizzle, useAllocator) {
+ : GrSurfaceProxy(surf, SkBackingFit::kExact, useAllocator)
+ , GrRenderTargetProxy(surf, useAllocator)
+ , GrTextureProxy(surf, useAllocator) {
SkASSERT(surf->asTexture());
SkASSERT(surf->asRenderTarget());
SkASSERT(fSurfaceFlags == fTarget->surfacePriv().flags());
diff --git a/src/gpu/GrTextureRenderTargetProxy.h b/src/gpu/GrTextureRenderTargetProxy.h
index f096fe2..bd52d80 100644
--- a/src/gpu/GrTextureRenderTargetProxy.h
+++ b/src/gpu/GrTextureRenderTargetProxy.h
@@ -34,7 +34,6 @@
int sampleCnt,
GrMipMapped,
GrMipMapsStatus,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
GrProtected,
@@ -49,7 +48,6 @@
int sampleCnt,
GrMipMapped,
GrMipMapsStatus,
- const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
GrProtected,
@@ -58,7 +56,6 @@
// Wrapped version
GrTextureRenderTargetProxy(sk_sp<GrSurface>,
- const GrSwizzle& textureSwizzle,
UseAllocator);
void initSurfaceFlags(const GrCaps&);
diff --git a/src/gpu/ccpr/GrCCPathCache.cpp b/src/gpu/ccpr/GrCCPathCache.cpp
index d269bcf..4f29c90 100644
--- a/src/gpu/ccpr/GrCCPathCache.cpp
+++ b/src/gpu/ccpr/GrCCPathCache.cpp
@@ -231,10 +231,8 @@
SkASSERT(SkToBool(entry->fCachedAtlas->peekOnFlushRefCnt()) ==
SkToBool(entry->fCachedAtlas->getOnFlushProxy()));
if (!entry->fCachedAtlas->getOnFlushProxy()) {
- auto ct = GrCCAtlas::CoverageTypeToColorType(entry->fCachedAtlas->coverageType());
if (sk_sp<GrTextureProxy> onFlushProxy = onFlushRP->findOrCreateProxyByUniqueKey(
- entry->fCachedAtlas->textureKey(), ct,
- GrSurfaceProxy::UseAllocator::kNo)) {
+ entry->fCachedAtlas->textureKey(), GrSurfaceProxy::UseAllocator::kNo)) {
entry->fCachedAtlas->setOnFlushProxy(std::move(onFlushProxy));
}
}
diff --git a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
index d0e2e78..12eaeb6 100644
--- a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
+++ b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
@@ -231,8 +231,7 @@
builder.finish();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- if (sk_sp<GrTextureProxy> blurProfile = proxyProvider->findOrCreateProxyByUniqueKey(
- key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> blurProfile = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(blurProfile->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(blurProfile), kTopLeft_GrSurfaceOrigin, swizzle};
diff --git a/src/gpu/effects/GrRRectBlurEffect.fp b/src/gpu/effects/GrRRectBlurEffect.fp
index ce40fb2..75412a8 100644
--- a/src/gpu/effects/GrRRectBlurEffect.fp
+++ b/src/gpu/effects/GrRRectBlurEffect.fp
@@ -49,8 +49,7 @@
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- if (sk_sp<GrTextureProxy> mask = proxyProvider->findOrCreateProxyByUniqueKey(
- key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> mask = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(mask->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(mask), kBottomLeft_GrSurfaceOrigin, swizzle};
diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp
index b57556e..ec11611 100644
--- a/src/gpu/effects/GrRectBlurEffect.fp
+++ b/src/gpu/effects/GrRectBlurEffect.fp
@@ -62,8 +62,7 @@
builder.finish();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(
- key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
diff --git a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
index 07e02ee..b917aa9 100644
--- a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
+++ b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
@@ -221,8 +221,7 @@
builder.finish();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- if (sk_sp<GrTextureProxy> blurProfile =
- proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> blurProfile = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(blurProfile->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(blurProfile), kTopLeft_GrSurfaceOrigin, swizzle};
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.h b/src/gpu/effects/generated/GrRRectBlurEffect.h
index f546376..b4620b7 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.h
@@ -51,8 +51,7 @@
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- if (sk_sp<GrTextureProxy> mask =
- proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> mask = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(mask->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(mask), kBottomLeft_GrSurfaceOrigin, swizzle};
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.h b/src/gpu/effects/generated/GrRectBlurEffect.h
index a8de6f8..37727a9 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRectBlurEffect.h
@@ -45,8 +45,7 @@
builder.finish();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- if (sk_sp<GrTextureProxy> proxy =
- proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 5390a91..9d430f0 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -441,11 +441,9 @@
const GrBackendFormat format =
context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
GrRenderable::kNo);
- GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, GrColorType::kRGBA_8888);
auto proxy = context->priv().proxyProvider()->createProxy(format,
dims,
- swizzle,
GrRenderable::kNo,
1,
GrMipMapped::kNo,
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index d735cb1..c47c978 100644
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -669,8 +669,7 @@
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- if (sk_sp<GrTextureProxy> falloffTexture =
- proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
+ if (sk_sp<GrTextureProxy> falloffTexture = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(falloffTexture->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(falloffTexture), kTopLeft_GrSurfaceOrigin, swizzle};
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 7cce0b0..55c4cd9 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -1261,12 +1261,10 @@
const GrBackendFormat format =
context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
GrRenderable::kNo);
- GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, GrColorType::kRGBA_8888);
-
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
- format, dims, swizzle, GrRenderable::kNo, 1, mipMapped, fit, SkBudgeted::kNo,
- GrProtected::kNo, GrInternalSurfaceFlags::kNone);
+ format, dims, GrRenderable::kNo, 1, mipMapped, fit, SkBudgeted::kNo, GrProtected::kNo,
+ GrInternalSurfaceFlags::kNone);
SkRect rect = GrTest::TestRect(random);
SkRect srcRect;
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 0311a91..3a5b10b 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -525,12 +525,10 @@
GrMipMapsStatus mipMapsStatus = (GrMipMapped::kYes == mipMapped)
? GrMipMapsStatus::kValid : GrMipMapsStatus::kNotAllocated;
- GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, colorType);
-
// We pass kReadOnly here since we should treat content of the client's texture as immutable.
// The promise API provides no way for the client to indicated that the texture is protected.
return proxyProvider->createLazyProxy(
- std::move(callback), backendFormat, {width, height}, readSwizzle, GrRenderable::kNo, 1,
- mipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
- SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
+ std::move(callback), backendFormat, {width, height}, GrRenderable::kNo, 1, mipMapped,
+ mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
+ GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
}
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp
index bdfbdc6..fadc334 100644
--- a/src/image/SkImage_Lazy.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -422,7 +422,7 @@
// 1. Check the cache for a pre-existing one.
if (key.isValid()) {
- auto proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, ct);
+ auto proxy = proxyProvider->findOrCreateProxyByUniqueKey(key);
if (proxy) {
SK_HISTOGRAM_ENUMERATION("LockTexturePath", kPreExisting_LockTexturePath,
kLockTexturePathCount);
diff --git a/src/image/SkSurface_GpuMtl.mm b/src/image/SkSurface_GpuMtl.mm
index 1cf6f2a..8b4a139 100644
--- a/src/image/SkSurface_GpuMtl.mm
+++ b/src/image/SkSurface_GpuMtl.mm
@@ -49,8 +49,6 @@
texInfo.fMipMapped = GrMipMapped::kNo;
texInfo.fTextureType = GrTextureType::k2D;
- GrSwizzle readSwizzle = caps->getReadSwizzle(backendFormat, grColorType);
-
sk_sp<GrRenderTargetProxy> proxy = proxyProvider->createLazyRenderTargetProxy(
[layer, drawable, sampleCnt](GrResourceProvider* resourceProvider) {
CAMetalLayer* metalLayer = (__bridge CAMetalLayer*)layer;
@@ -77,7 +75,6 @@
},
backendFormat,
dims,
- readSwizzle,
sampleCnt,
sampleCnt > 1 ? GrInternalSurfaceFlags::kRequiresManualMSAAResolve
: GrInternalSurfaceFlags::kNone,
@@ -89,6 +86,7 @@
false,
GrSurfaceProxy::UseAllocator::kYes);
+ GrSwizzle readSwizzle = caps->getReadSwizzle(backendFormat, grColorType);
GrSwizzle outputSwizzle = caps->getOutputSwizzle(backendFormat, grColorType);
GrSurfaceProxyView readView(proxy, origin, readSwizzle);
@@ -123,8 +121,6 @@
texInfo.fMipMapped = GrMipMapped::kNo;
texInfo.fTextureType = GrTextureType::k2D;
- GrSwizzle readSwizzle = caps->getReadSwizzle(backendFormat, grColorType);
-
sk_sp<GrRenderTargetProxy> proxy = proxyProvider->createLazyRenderTargetProxy(
[view, sampleCnt](GrResourceProvider* resourceProvider) {
MTKView* mtkView = (__bridge MTKView*)view;
@@ -149,7 +145,6 @@
},
backendFormat,
dims,
- readSwizzle,
sampleCnt,
sampleCnt > 1 ? GrInternalSurfaceFlags::kRequiresManualMSAAResolve
: GrInternalSurfaceFlags::kNone,
@@ -161,6 +156,7 @@
false,
GrSurfaceProxy::UseAllocator::kYes);
+ GrSwizzle readSwizzle = caps->getReadSwizzle(backendFormat, grColorType);
GrSwizzle outputSwizzle = caps->getOutputSwizzle(backendFormat, grColorType);
GrSurfaceProxyView readView(proxy, origin, readSwizzle);