Revert "Pass GrColorType to the GrGpu::wrapRenderableBackendTexture chain of calls"
This reverts commit 5572737d952421a588c5790d4a8fc05957cb3d50.
Reason for revert: Adreno 4xx bots hitting compatibility assert in InitialTextureClear test
Original change's description:
> Pass GrColorType to the GrGpu::wrapRenderableBackendTexture chain of calls
>
> This is a step towards reducing our reliance-on/use-of the GrPixelConfig stored in the GrBackendTexture.
>
> Bug: skia:6718
> Change-Id: I2170032bfbbb57423c4bb0d901ad014c61d38131
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223701
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,robertphillips@google.com
Change-Id: I24cf6b3aa0dfca2e935a36592860ad91171b21a7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227637
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index daffcef..5bd4044 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -372,43 +372,3 @@
GrColorType dstColorType) const {
return SupportedRead{GrSwizzle::RGBA(), GrPixelConfigToColorType(config)};
}
-
-#ifdef SK_DEBUG
-bool GrCaps::AreConfigsCompatible(GrPixelConfig genericConfig, GrPixelConfig specificConfig) {
- bool compatible = false;
-
- switch (genericConfig) {
- case kAlpha_8_GrPixelConfig:
- compatible = kAlpha_8_GrPixelConfig == specificConfig || // here bc of the mock context
- kAlpha_8_as_Alpha_GrPixelConfig == specificConfig ||
- kAlpha_8_as_Red_GrPixelConfig == specificConfig;
- break;
- case kGray_8_GrPixelConfig:
- compatible = kGray_8_GrPixelConfig == specificConfig || // here bc of the mock context
- kGray_8_as_Lum_GrPixelConfig == specificConfig ||
- kGray_8_as_Red_GrPixelConfig == specificConfig;
- break;
- case kAlpha_half_GrPixelConfig:
- compatible = kAlpha_half_GrPixelConfig == specificConfig || // bc of the mock context
- kAlpha_half_as_Red_GrPixelConfig == specificConfig;
- break;
- case kRGB_888_GrPixelConfig:
- compatible = kRGB_888_GrPixelConfig == specificConfig ||
- kRGB_888X_GrPixelConfig == specificConfig;
- break;
- case kRGBA_8888_GrPixelConfig:
- compatible = kRGBA_8888_GrPixelConfig == specificConfig ||
- kBGRA_8888_GrPixelConfig == specificConfig;
- break;
- default:
- compatible = genericConfig == specificConfig;
- break;
- }
-
- if (!compatible) {
- SkDebugf("Configs are not compatible: %d %d\n", genericConfig, specificConfig);
- }
-
- return compatible;
-}
-#endif
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 4e30936..3ea84b7 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -411,13 +411,6 @@
const GrDriverBugWorkarounds& workarounds() const { return fDriverBugWorkarounds; }
-#ifdef SK_DEBUG
- // This is just a debugging entry point until we're weaned off of GrPixelConfig. It
- // should be used to verify that the pixel config from user-level code (the genericConfig)
- // is compatible with a pixel config we've computed from scratch (the specificConfig).
- static bool AreConfigsCompatible(GrPixelConfig genericConfig, GrPixelConfig specificConfig);
-#endif
-
protected:
/** Subclasses must call this at the end of their constructors in order to apply caps
overrides requested by the client. Note that overrides will only reduce the caps never
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index 476bd08..47e481b 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -128,8 +128,8 @@
SkASSERT(sampleCnt > 0);
sk_sp<GrTextureProxy> proxy(this->proxyProvider()->wrapRenderableBackendTexture(
- tex, origin, sampleCnt, colorType, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
- releaseProc, releaseCtx));
+ tex, origin, sampleCnt, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, releaseProc,
+ releaseCtx));
if (!proxy) {
return nullptr;
}
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index f007304..79cfbf4 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -230,32 +230,23 @@
}
sk_sp<GrTexture> GrGpu::wrapRenderableBackendTexture(const GrBackendTexture& backendTex,
- int sampleCnt, GrColorType colorType,
- GrWrapOwnership ownership,
+ int sampleCnt, GrWrapOwnership ownership,
GrWrapCacheable cacheable) {
this->handleDirtyContext();
if (sampleCnt < 1) {
return nullptr;
}
-
- const GrCaps* caps = this->caps();
-
- SkASSERT(GrCaps::AreConfigsCompatible(backendTex.config(),
- caps->getConfigFromBackendFormat(
- backendTex.getBackendFormat(),
- colorType)));
-
- if (!caps->isFormatTexturable(colorType, backendTex.getBackendFormat()) ||
- !caps->getRenderTargetSampleCount(sampleCnt, colorType, backendTex.getBackendFormat())) {
+ if (!this->caps()->isConfigTexturable(backendTex.config()) ||
+ !this->caps()->getRenderTargetSampleCount(sampleCnt, backendTex.config())) {
return nullptr;
}
- if (backendTex.width() > caps->maxRenderTargetSize() ||
- backendTex.height() > caps->maxRenderTargetSize()) {
+ if (backendTex.width() > this->caps()->maxRenderTargetSize() ||
+ backendTex.height() > this->caps()->maxRenderTargetSize()) {
return nullptr;
}
- sk_sp<GrTexture> tex = this->onWrapRenderableBackendTexture(backendTex, sampleCnt, colorType,
- ownership, cacheable);
+ sk_sp<GrTexture> tex =
+ this->onWrapRenderableBackendTexture(backendTex, sampleCnt, ownership, cacheable);
SkASSERT(!tex || tex->asRenderTarget());
return tex;
}
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 04c411d..fa64036 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -118,7 +118,7 @@
* Implements GrResourceProvider::wrapRenderableBackendTexture
*/
sk_sp<GrTexture> wrapRenderableBackendTexture(const GrBackendTexture&, int sampleCnt,
- GrColorType, GrWrapOwnership, GrWrapCacheable);
+ GrWrapOwnership, GrWrapCacheable);
/**
* Implements GrResourceProvider::wrapBackendRenderTarget
@@ -527,8 +527,7 @@
virtual sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership,
GrWrapCacheable, GrIOType) = 0;
virtual sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&, int sampleCnt,
- GrColorType, GrWrapOwnership,
- GrWrapCacheable) = 0;
+ GrWrapOwnership, GrWrapCacheable) = 0;
virtual sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) = 0;
virtual sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
int sampleCnt) = 0;
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 5e2b1fe..1fc2756 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -422,12 +422,6 @@
return caps->areColorTypeAndFormatCompatible(grCT, format);
}
-
-static bool validate_backend_format_and_colortype(const GrCaps* caps,
- GrColorType colorType,
- const GrBackendFormat& format) {
- return caps->areColorTypeAndFormatCompatible(colorType, format);
-}
#endif
sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format,
@@ -437,17 +431,11 @@
SkBackingFit fit,
SkBudgeted budgeted,
GrInternalSurfaceFlags surfaceFlags) {
+ SkASSERT(validate_backend_format_and_config(this->caps(), format, desc.fConfig));
if (GrPixelConfigIsCompressed(desc.fConfig)) {
// Deferred proxies for compressed textures are not supported.
return nullptr;
}
-
- const GrCaps* caps = this->caps();
- GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
-
- SkASSERT(GrCaps::AreConfigsCompatible(desc.fConfig,
- caps->getConfigFromBackendFormat(format, colorType)));
- SkASSERT(validate_backend_format_and_colortype(caps, colorType, format));
if (GrMipMapped::kYes == mipMapped) {
// SkMipMap doesn't include the base level in the level count so we have to add 1
int mipCount = SkMipMap::ComputeLevelCount(desc.fWidth, desc.fHeight) + 1;
@@ -456,21 +444,23 @@
}
}
- if (!caps->validateSurfaceDesc(desc, mipMapped)) {
+ if (!this->caps()->validateSurfaceDesc(desc, mipMapped)) {
return nullptr;
}
GrSurfaceDesc copyDesc = desc;
if (desc.fFlags & kRenderTarget_GrSurfaceFlag) {
- copyDesc.fSampleCnt = caps->getRenderTargetSampleCount(desc.fSampleCnt, colorType, format);
+ copyDesc.fSampleCnt =
+ this->caps()->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig);
}
- GrSwizzle texSwizzle = caps->getTextureSwizzle(format, colorType);
+ 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 = caps->getOutputSwizzle(format, colorType);
- return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*caps, format, copyDesc,
+ GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(format, colorType);
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*this->caps(), format, copyDesc,
origin, mipMapped, texSwizzle,
outSwizzle, fit, budgeted,
surfaceFlags));
@@ -536,8 +526,10 @@
return nullptr;
}
+#ifdef SK_DEBUG
SkASSERT(validate_backend_format_and_config(this->caps(), backendTex.getBackendFormat(),
backendTex.config()));
+#endif
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
@@ -563,8 +555,8 @@
sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
const GrBackendTexture& backendTex, GrSurfaceOrigin origin, int sampleCnt,
- GrColorType colorType, GrWrapOwnership ownership, GrWrapCacheable cacheable,
- ReleaseProc releaseProc, ReleaseContext releaseCtx) {
+ GrWrapOwnership ownership, GrWrapCacheable cacheable, ReleaseProc releaseProc,
+ ReleaseContext releaseCtx) {
if (this->isAbandoned()) {
return nullptr;
}
@@ -575,25 +567,18 @@
return nullptr;
}
- const GrCaps* caps = this->caps();
-
- SkASSERT(GrCaps::AreConfigsCompatible(backendTex.config(),
- caps->getConfigFromBackendFormat(
- backendTex.getBackendFormat(),
- colorType)));
- SkASSERT(validate_backend_format_and_colortype(caps, colorType, backendTex.getBackendFormat()));
+ SkASSERT(validate_backend_format_and_config(this->caps(), backendTex.getBackendFormat(),
+ backendTex.config()));
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
- sampleCnt = caps->getRenderTargetSampleCount(sampleCnt, colorType,
- backendTex.getBackendFormat());
+ sampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, backendTex.config());
if (!sampleCnt) {
return nullptr;
}
sk_sp<GrTexture> tex = resourceProvider->wrapRenderableBackendTexture(backendTex, sampleCnt,
- colorType, ownership,
- cacheable);
+ ownership, cacheable);
if (!tex) {
return nullptr;
}
@@ -606,8 +591,9 @@
// Make sure we match how we created the proxy with SkBudgeted::kNo
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
- GrSwizzle texSwizzle = caps->getTextureSwizzle(tex->backendFormat(), colorType);
- GrSwizzle outSwizzle = caps->getOutputSwizzle(tex->backendFormat(), colorType);
+ 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));
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index dc4f4f0..435f973 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -118,9 +118,8 @@
* Create a texture proxy that wraps a backend texture and is both texture-able and renderable
*/
sk_sp<GrTextureProxy> wrapRenderableBackendTexture(const GrBackendTexture&, GrSurfaceOrigin,
- int sampleCnt, GrColorType,
- GrWrapOwnership, GrWrapCacheable,
- ReleaseProc = nullptr,
+ int sampleCnt, GrWrapOwnership,
+ GrWrapCacheable, ReleaseProc = nullptr,
ReleaseContext = nullptr);
/*
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index fc3d061..9caaf57 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -315,14 +315,13 @@
sk_sp<GrTexture> GrResourceProvider::wrapRenderableBackendTexture(const GrBackendTexture& tex,
int sampleCnt,
- GrColorType colorType,
GrWrapOwnership ownership,
GrWrapCacheable cacheable) {
ASSERT_SINGLE_OWNER
if (this->isAbandoned()) {
return nullptr;
}
- return fGpu->wrapRenderableBackendTexture(tex, sampleCnt, colorType, ownership, cacheable);
+ return fGpu->wrapRenderableBackendTexture(tex, sampleCnt, ownership, cacheable);
}
sk_sp<GrRenderTarget> GrResourceProvider::wrapBackendRenderTarget(
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index a4931c6..1ac19ec 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -117,7 +117,6 @@
*/
sk_sp<GrTexture> wrapRenderableBackendTexture(const GrBackendTexture& tex,
int sampleCnt,
- GrColorType,
GrWrapOwnership,
GrWrapCacheable);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 28827d8..531c3dd 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -3775,7 +3775,7 @@
}
// A near clone of format_color_type_valid_pair
-static GrPixelConfig validate_sized_format(GrGLenum format, GrColorType ct, GrGLStandard standard) {
+GrPixelConfig validate_sized_format(GrGLenum format, GrColorType ct, GrGLStandard standard) {
switch (ct) {
case GrColorType::kUnknown:
return kUnknown_GrPixelConfig;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 6a82183..44c5816 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -714,7 +714,6 @@
sk_sp<GrTexture> GrGLGpu::onWrapRenderableBackendTexture(const GrBackendTexture& backendTex,
int sampleCnt,
- GrColorType colorType,
GrWrapOwnership ownership,
GrWrapCacheable cacheable) {
GrGLTexture::IDDesc idDesc;
@@ -736,15 +735,12 @@
idDesc.fOwnership = GrBackendObjectOwnership::kOwned;
}
- const GrCaps* caps = this->caps();
-
GrSurfaceDesc surfDesc;
surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
- surfDesc.fSampleCnt = caps->getRenderTargetSampleCount(sampleCnt, colorType,
- backendTex.getBackendFormat());
+ surfDesc.fSampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, backendTex.config());
if (surfDesc.fSampleCnt < 1) {
return nullptr;
}
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 027d571..5834d2c 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -203,8 +203,7 @@
sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership, GrWrapCacheable,
GrIOType) override;
sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&, int sampleCnt,
- GrColorType, GrWrapOwnership,
- GrWrapCacheable) override;
+ GrWrapOwnership, GrWrapCacheable) override;
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
int sampleCnt) override;
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index 898aa7e..aa975cd 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -132,13 +132,11 @@
sk_sp<GrTexture> GrMockGpu::onWrapRenderableBackendTexture(const GrBackendTexture& tex,
int sampleCnt,
- GrColorType colorType,
GrWrapOwnership ownership,
GrWrapCacheable cacheable) {
GrMockTextureInfo texInfo;
SkAssertResult(tex.getMockTextureInfo(&texInfo));
- SkASSERT(colorType == texInfo.fColorType);
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = tex.width();
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index fadbf98..0ea5c1a 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -74,7 +74,6 @@
sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
int sampleCnt,
- GrColorType,
GrWrapOwnership,
GrWrapCacheable) override;
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 42f684d..209f73c 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -146,8 +146,7 @@
GrIOType) override;
sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&, int sampleCnt,
- GrColorType, GrWrapOwnership,
- GrWrapCacheable) override;
+ GrWrapOwnership, GrWrapCacheable) override;
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index a474256..1e869ce 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -524,7 +524,6 @@
sk_sp<GrTexture> GrMtlGpu::onWrapRenderableBackendTexture(const GrBackendTexture& backendTex,
int sampleCnt,
- GrColorType colorType,
GrWrapOwnership,
GrWrapCacheable cacheable) {
id<MTLTexture> mtlTexture = get_texture_from_backend(backendTex);
@@ -534,9 +533,7 @@
GrSurfaceDesc surfDesc;
init_surface_desc(&surfDesc, mtlTexture, true, backendTex.config());
-
- surfDesc.fSampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, colorType,
- backendTex.getBackendFormat());
+ surfDesc.fSampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, surfDesc.fConfig);
if (!surfDesc.fSampleCnt) {
return nullptr;
}
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index ff56ebe..0e0405d 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -1010,7 +1010,7 @@
break;
case GrColorType::kAlpha_F16:
if (VK_FORMAT_R16_SFLOAT == format) {
- return kAlpha_half_as_Red_GrPixelConfig;
+ return kAlpha_half_GrPixelConfig;
}
break;
case GrColorType::kRGBA_F16:
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 7a9811a..89248fc 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1187,7 +1187,6 @@
sk_sp<GrTexture> GrVkGpu::onWrapRenderableBackendTexture(const GrBackendTexture& backendTex,
int sampleCnt,
- GrColorType colorType,
GrWrapOwnership ownership,
GrWrapCacheable cacheable) {
GrVkImageInfo imageInfo;
@@ -1210,19 +1209,13 @@
return nullptr;
}
- SkASSERT(GrCaps::AreConfigsCompatible(backendTex.config(),
- this->caps()->getConfigFromBackendFormat(
- backendTex.getBackendFormat(),
- colorType)));
-
GrSurfaceDesc surfDesc;
surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fIsProtected = backendTex.isProtected() ? GrProtected::kYes : GrProtected::kNo;
surfDesc.fConfig = backendTex.config();
- surfDesc.fSampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, colorType,
- backendTex.getBackendFormat());
+ surfDesc.fSampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, backendTex.config());
sk_sp<GrVkImageLayout> layout = backendTex.getGrVkImageLayout();
SkASSERT(layout);
@@ -1878,7 +1871,7 @@
*config = kRGB_ETC1_GrPixelConfig;
return true;
case VK_FORMAT_R16_SFLOAT:
- *config = kAlpha_half_as_Red_GrPixelConfig;
+ *config = kAlpha_half_GrPixelConfig;
return true;
case VK_FORMAT_R16_UNORM:
*config = kR_16_GrPixelConfig;
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index f961e4f..dfc099a 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -200,7 +200,6 @@
GrIOType) override;
sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
int sampleCnt,
- GrColorType colorType,
GrWrapOwnership,
GrWrapCacheable) override;
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index e95fd47..2829b76 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -58,7 +58,7 @@
SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo, GrProtected::kNo);
sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture(
- backendTex, 1, GrColorType::kRGBA_8888, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
+ backendTex, 1, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget());
REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture());
@@ -119,23 +119,6 @@
for (int c = 0; c <= kLast_GrPixelConfig; ++c) {
GrPixelConfig config = static_cast<GrPixelConfig>(c);
- // We don't round trip correctly going from pixelConfig to colorType to
- // backendFormat with the RGBX config.
- if (config == kRGB_888X_GrPixelConfig) {
- continue;
- }
-
- // The specific kAlpha_* and kGray_8* pixel configs cause difficulties.
- // The mapping from config -> colorType -> format doesn't necessarily
- // resolve back to the expected pixel config. Just test the generic pixel configs.
- if (config == kAlpha_8_as_Alpha_GrPixelConfig ||
- config == kAlpha_8_as_Red_GrPixelConfig ||
- config == kGray_8_as_Lum_GrPixelConfig ||
- config == kGray_8_as_Red_GrPixelConfig ||
- config == kAlpha_half_as_Red_GrPixelConfig) {
- continue;
- }
-
for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
if (config == kUnknown_GrPixelConfig) {
// It is not valid to be calling into GrProxyProvider with an unknown pixel config.
@@ -256,28 +239,6 @@
if (desc.fConfig == kRGB_888X_GrPixelConfig) {
continue;
}
-
- // The specific kAlpha_* pixel configs also cause difficulties with OpenGL.
- // The mapping from config -> colorType -> format doesn't necessarily
- // resolve back to the expected pixel config. In this case we just test
- // the generics.
- if (GrBackendApi::kOpenGL == context->backend() &&
- (desc.fConfig == kAlpha_8_as_Alpha_GrPixelConfig ||
- desc.fConfig == kAlpha_8_as_Red_GrPixelConfig ||
- desc.fConfig == kAlpha_half_as_Red_GrPixelConfig)) {
- continue;
- }
-
- // The specific kGray_8_* pixel configs also cause difficulties with OpenGL.
- // The mapping from config -> colorType -> format doesn't necessarily
- // resolve back to the expected pixel config. In this case we just test
- // the generic.
- if (GrBackendApi::kOpenGL == context->backend() &&
- (desc.fConfig == kGray_8_as_Lum_GrPixelConfig ||
- desc.fConfig == kGray_8_as_Red_GrPixelConfig)) {
- continue;
- }
-
GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
const GrBackendFormat format = caps->getBackendFormatFromColorType(colorType);
@@ -425,8 +386,7 @@
sk_sp<GrTexture> texture;
if (GrRenderable::kYes == renderable) {
texture = context->priv().resourceProvider()->wrapRenderableBackendTexture(
- backendTexture, 1, GrColorType::kRGBA_8888, kBorrow_GrWrapOwnership,
- GrWrapCacheable::kNo);
+ backendTexture, 1, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
} else {
texture = context->priv().resourceProvider()->wrapBackendTexture(
backendTexture, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
index 07151e2..4325d1c 100644
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ b/tests/GrTestingBackendTextureUploadTest.cpp
@@ -68,7 +68,7 @@
sk_sp<GrTextureProxy> wrappedProxy;
if (GrRenderable::kYes == renderable) {
wrappedProxy = context->priv().proxyProvider()->wrapRenderableBackendTexture(
- backendTex, kTopLeft_GrSurfaceOrigin, 1, grCT, kAdopt_GrWrapOwnership,
+ backendTex, kTopLeft_GrSurfaceOrigin, 1, kAdopt_GrWrapOwnership,
GrWrapCacheable::kNo);
} else {
wrappedProxy = context->priv().proxyProvider()->wrapBackendTexture(
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 23022e0..aa0c4c7 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -308,8 +308,7 @@
GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture(
- backendTex, origin, supportedNumSamples,
- grColorType, kBorrow_GrWrapOwnership,
+ backendTex, origin, supportedNumSamples, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, nullptr, nullptr);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp
index 97917c6..a6fb439 100644
--- a/tests/VkWrapTests.cpp
+++ b/tests/VkWrapTests.cpp
@@ -31,7 +31,6 @@
const int kH = 1024;
const GrPixelConfig kPixelConfig = kRGBA_8888_GrPixelConfig;
const SkColorType kColorType = SkColorType::kRGBA_8888_SkColorType;
-const GrColorType kGrColorType = GrColorType::kRGBA_8888;
void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) {
@@ -148,7 +147,7 @@
SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo));
sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(
- origBackendTex, 1, kGrColorType, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
+ origBackendTex, 1, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
REPORTER_ASSERT(reporter, tex);
// image is null
@@ -157,11 +156,11 @@
backendCopy.fImage = VK_NULL_HANDLE;
GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
backendTex.setPixelConfig(kPixelConfig);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kGrColorType,
- kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
+ tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership,
+ GrWrapCacheable::kNo);
REPORTER_ASSERT(reporter, !tex);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kGrColorType,
- kAdopt_GrWrapOwnership, GrWrapCacheable::kNo);
+ tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership,
+ GrWrapCacheable::kNo);
REPORTER_ASSERT(reporter, !tex);
}
@@ -171,11 +170,11 @@
backendCopy.fAlloc = GrVkAlloc();
GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
backendTex.setPixelConfig(kPixelConfig);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kGrColorType,
- kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
+ tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership,
+ GrWrapCacheable::kNo);
REPORTER_ASSERT(reporter, tex);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kGrColorType,
- kAdopt_GrWrapOwnership, GrWrapCacheable::kNo);
+ tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership,
+ GrWrapCacheable::kNo);
REPORTER_ASSERT(reporter, !tex);
}
@@ -184,8 +183,8 @@
GrVkImageInfo backendCopy = imageInfo;
GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
backendTex.setPixelConfig(kPixelConfig);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kGrColorType,
- kAdopt_GrWrapOwnership, GrWrapCacheable::kNo);
+ tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership,
+ GrWrapCacheable::kNo);
REPORTER_ASSERT(reporter, tex);
}
}
diff --git a/tools/gpu/ProxyUtils.cpp b/tools/gpu/ProxyUtils.cpp
index e592b02..428ac7b 100644
--- a/tools/gpu/ProxyUtils.cpp
+++ b/tools/gpu/ProxyUtils.cpp
@@ -46,8 +46,8 @@
// Adopt ownership so our caller doesn't have to worry about deleting the backend texture.
if (GrRenderable::kYes == renderable) {
proxy = context->priv().proxyProvider()->wrapRenderableBackendTexture(
- backendTex, origin, 1, colorType, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo,
- nullptr, nullptr);
+ backendTex, origin, 1, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo, nullptr,
+ nullptr);
} else {
proxy = context->priv().proxyProvider()->wrapBackendTexture(
backendTex, origin, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);