Remove kRenderTarget_GrSurfaceFlag, instead pass GrRenderable.
This is the last surface desc flag, so remove flags from GrSurfaceDesc.
Bug: skia:6718
Change-Id: Id3ed66b161289927b62f40bfb1f6482cf544deda
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227858
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index 07a552f..dc67244 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -100,7 +100,7 @@
sk_sp<GrTextureProxy> proxies[3];
for (int i = 0; i < 3; ++i) {
- proxies[i] = proxyProvider->createTextureProxy(fImage[i], kNone_GrSurfaceFlags, 1,
+ proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
if (!proxies[i]) {
*errorMsg = "Failed to create proxy";
@@ -219,7 +219,7 @@
sk_sp<GrTextureProxy> proxies[2];
for (int i = 0; i < 2; ++i) {
- proxies[i] = proxyProvider->createTextureProxy(fImage[i], kNone_GrSurfaceFlags, 1,
+ proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
if (!proxies[i]) {
*errorMsg = "Failed to create proxy";
@@ -316,7 +316,7 @@
sk_sp<GrTextureProxy> proxies[3];
for (int i = 0; i < 3; ++i) {
- proxies[i] = proxyProvider->createTextureProxy(fImage[i], kNone_GrSurfaceFlags, 1,
+ proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
if (!proxies[i]) {
*errorMsg = "Failed to create proxy";
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index c36c08f..267ea9f 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -75,7 +75,8 @@
inline GrSurfacePriv surfacePriv();
inline const GrSurfacePriv surfacePriv() const;
- static size_t WorstCaseSize(const GrSurfaceDesc& desc, bool binSize = false);
+ static size_t WorstCaseSize(const GrSurfaceDesc& desc, GrRenderable renderable,
+ bool binSize = false);
static size_t ComputeSize(GrPixelConfig config, int width, int height, int colorSamplesPerPixel,
GrMipMapped, bool binSize = false);
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index 192744d..15a446b 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -144,33 +144,16 @@
}
/**
- * Optional bitfield flags that can be set on GrSurfaceDesc (below).
- */
-enum GrSurfaceFlags {
- kNone_GrSurfaceFlags = 0x0,
- /**
- * Creates a texture that can be rendered to as a GrRenderTarget. Use
- * GrTexture::asRenderTarget() to access.
- */
- kRenderTarget_GrSurfaceFlag = 0x1,
-};
-GR_MAKE_BITFIELD_OPS(GrSurfaceFlags)
-
-typedef GrSurfaceFlags GrSurfaceDescFlags;
-
-/**
* Describes a surface to be created.
*/
struct GrSurfaceDesc {
GrSurfaceDesc()
- : fFlags(kNone_GrSurfaceFlags)
- , fWidth(0)
+ : fWidth(0)
, fHeight(0)
, fIsProtected(GrProtected::kNo)
, fConfig(kUnknown_GrPixelConfig)
, fSampleCnt(1) {}
- GrSurfaceDescFlags fFlags; //!< bitfield of TextureFlags
int fWidth; //!< Width of the texture
int fHeight; //!< Height of the texture
GrProtected fIsProtected; //!< Surface is protected
diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp
index f0081f1..00b1039 100644
--- a/src/core/SkDeferredDisplayListRecorder.cpp
+++ b/src/core/SkDeferredDisplayListRecorder.cpp
@@ -139,7 +139,6 @@
}
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = fCharacterization.width();
desc.fHeight = fCharacterization.height();
desc.fIsProtected = fCharacterization.isProtected();
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 4f4e931..9008436 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -185,7 +185,7 @@
return std::move(tex);
},
- backendFormat, desc, fSurfaceOrigin, GrMipMapped::kNo,
+ backendFormat, desc, GrRenderable::kNo, fSurfaceOrigin, GrMipMapped::kNo,
GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo);
return texProxy;
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index c673053..a62dfab 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -192,8 +192,8 @@
// unrelated to the whatever SkImage key may be assigned to the proxy.
return {std::move(tex), GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
- format, desc, fSurfaceOrigin, mipMapped, GrInternalSurfaceFlags::kReadOnly,
- SkBackingFit::kExact, SkBudgeted::kNo);
+ format, desc, GrRenderable::kNo, fSurfaceOrigin, mipMapped,
+ GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo);
if (!proxy) {
return nullptr;
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index dd6ae3b..10f1d16 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -148,10 +148,8 @@
return false;
}
- filteredMask = proxyProvider->createTextureProxy(std::move(image),
- kNone_GrSurfaceFlags,
- 1, SkBudgeted::kYes,
- SkBackingFit::kApprox);
+ filteredMask = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1,
+ SkBudgeted::kYes, SkBackingFit::kApprox);
if (!filteredMask) {
return false;
}
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 50774c6..2330dbc 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -336,7 +336,8 @@
return this->onCanCopySurface(dst, src, srcRect, dstPoint);
}
-bool GrCaps::validateSurfaceDesc(const GrSurfaceDesc& desc, GrMipMapped mipped) const {
+bool GrCaps::validateSurfaceDesc(const GrSurfaceDesc& desc, GrRenderable renderable,
+ GrMipMapped mipped) const {
if (!this->isConfigTexturable(desc.fConfig)) {
return false;
}
@@ -349,7 +350,7 @@
return false;
}
- if (SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag)) {
+ if (renderable == GrRenderable::kYes) {
if (0 == this->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig)) {
return false;
}
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 6bb5d91..8c23ece 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -351,14 +351,16 @@
* This is can be called before allocating a texture to be a dst for copySurface. This is only
* used for doing dst copies needed in blends, thus the src is always a GrRenderTargetProxy. It
* will populate config and flags fields of the desc such that copySurface can efficiently
- * succeed as well as the proxy origin. rectsMustMatch will be set to true if the copy operation
- * must ensure that the src and dest rects are identical. disallowSubrect will be set to true if
- * copy rect must equal src's bounds.
+ * succeed as well as the proxy origin. renderable will be set to kYes if the destination
+ * texture should be renderable in order to implement the copy as a draw. rectsMustMatch will be
+ * set to true if the copy operation must ensure that the src and dest rects are identical.
+ * disallowSubrect will be set to true if copy rect must equal src's bounds.
*/
virtual bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
- bool* rectsMustMatch, bool* disallowSubrect) const = 0;
+ GrRenderable* renderable, bool* rectsMustMatch,
+ bool* disallowSubrect) const = 0;
- bool validateSurfaceDesc(const GrSurfaceDesc&, GrMipMapped) const;
+ bool validateSurfaceDesc(const GrSurfaceDesc&, GrRenderable renderable, GrMipMapped) const;
/**
* If the GrBackendRenderTarget can be used with the supplied SkColorType the return will be
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 3c282d5..62ed272 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -499,8 +499,9 @@
// MDB TODO: We're going to fill this proxy with an ASAP upload (which is out of order wrt
// to ops), so it can't have any pending IO.
- proxy = proxyProvider->createProxy(format, desc, kTopLeft_GrSurfaceOrigin,
- SkBackingFit::kApprox, SkBudgeted::kYes);
+ proxy = proxyProvider->createProxy(format, desc, GrRenderable::kNo,
+ kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox,
+ SkBudgeted::kYes);
auto uploader = skstd::make_unique<GrTDeferredProxyUploader<ClipMaskData>>(reducedClip);
GrTDeferredProxyUploader<ClipMaskData>* uploaderRaw = uploader.get();
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index 7fb8aca..eb709f3 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -522,8 +522,9 @@
int numPlotsY = fTextureHeight/fPlotHeight;
for (uint32_t i = 0; i < this->maxPages(); ++i) {
- fProxies[i] = proxyProvider->createProxy(fFormat, desc, kTopLeft_GrSurfaceOrigin,
- SkBackingFit::kExact, SkBudgeted::kYes);
+ fProxies[i] = proxyProvider->createProxy(fFormat, desc, GrRenderable::kNo,
+ kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact,
+ SkBudgeted::kYes);
if (!fProxies[i]) {
return false;
}
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index addbc15..ce2c840 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -144,8 +144,9 @@
return levelsWithPixelsCnt == mipLevelCount;
}
-sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, SkBudgeted budgeted,
- const GrMipLevel texels[], int mipLevelCount) {
+sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, GrRenderable renderable,
+ SkBudgeted budgeted, const GrMipLevel texels[],
+ int mipLevelCount) {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
if (GrPixelConfigIsCompressed(origDesc.fConfig)) {
// Call GrGpu::createCompressedTexture.
@@ -154,12 +155,11 @@
GrSurfaceDesc desc = origDesc;
GrMipMapped mipMapped = mipLevelCount > 1 ? GrMipMapped::kYes : GrMipMapped::kNo;
- if (!this->caps()->validateSurfaceDesc(desc, mipMapped)) {
+ if (!this->caps()->validateSurfaceDesc(desc, renderable, mipMapped)) {
return nullptr;
}
- bool isRT = desc.fFlags & kRenderTarget_GrSurfaceFlag;
- if (isRT) {
+ if (renderable == GrRenderable::kYes) {
desc.fSampleCnt = this->caps()->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig);
}
// Attempt to catch un- or wrongly initialized sample counts.
@@ -177,9 +177,9 @@
}
this->handleDirtyContext();
- sk_sp<GrTexture> tex = this->onCreateTexture(desc, budgeted, texels, mipLevelCount);
+ sk_sp<GrTexture> tex = this->onCreateTexture(desc, renderable, budgeted, texels, mipLevelCount);
if (tex) {
- if (!this->caps()->reuseScratchTextures() && !isRT) {
+ if (!this->caps()->reuseScratchTextures() && renderable == GrRenderable::kNo) {
tex->resourcePriv().removeScratchKey();
}
fStats.incTextureCreates();
@@ -192,8 +192,9 @@
return tex;
}
-sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) {
- return this->createTexture(desc, budgeted, nullptr, 0);
+sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& desc, GrRenderable renderable,
+ SkBudgeted budgeted) {
+ return this->createTexture(desc, renderable, budgeted, nullptr, 0);
}
sk_sp<GrTexture> GrGpu::createCompressedTexture(int width, int height,
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 04c411d..27a1941 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -80,30 +80,37 @@
void markContextDirty(uint32_t state = kAll_GrBackendState) { fResetBits |= state; }
/**
- * Creates a texture object. If kRenderTarget_GrSurfaceFlag the texture can
+ * Creates a texture object. If renderable is kYes then the returned texture can
* be used as a render target by calling GrTexture::asRenderTarget(). Not all
* pixel configs can be used as render targets. Support for configs as textures
* or render targets can be checked using GrCaps.
*
* @param desc describes the texture to be created.
+ * @param renderable should the resulting texture be renderable
* @param budgeted does this texture count against the resource cache budget?
* @param texels array of mipmap levels containing texel data to load.
- * Each level begins with full-size palette data for paletted textures.
- * It contains width*height texels. If there is only one
- * element and it contains nullptr fPixels, texture data is
- * uninitialized. Levels' row bytes Must be a multiple of
- * config's bytes-per-pixel. Must be tight to width if
- * !caps->writePixelsRowBytesSupport().
- * @param mipLevelCount the number of levels in 'texels'
+ * If level i has pixels then it is assumed that its dimensions are
+ * max(1, floor(desc.fWidth / 2)) by max(1, floor(desc.fHeight / 2)).
+ * If texels[i].fPixels == nullptr for all i <= mipLevelCount or
+ * mipLevelCount is 0 then the texture's contents are uninitialized.
+ * If a level has non-null pixels, its row bytes must be a multiple of the
+ * config's bytes-per-pixel. The row bytes must be tight to the
+ * level width if !caps->writePixelsRowBytesSupport().
+ * If mipLevelCount > 1 and texels[i].fPixels != nullptr for any i > 0
+ * then all levels must have non-null pixels. All levels must have
+ * non-null pixels if GrCaps::createTextureMustSpecifyAllLevels() is true.
+ * @param mipLevelCount the number of levels in 'texels'. May be 0, 1, or
+ * floor(max((log2(desc.fWidth), log2(desc.fHeight)))). It must be the
+ * latter if GrCaps::createTextureMustSpecifyAllLevels() is true.
* @return The texture object if successful, otherwise nullptr.
*/
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel texels[],
- int mipLevelCount);
+ sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, GrRenderable renderable, SkBudgeted,
+ const GrMipLevel texels[], int mipLevelCount);
/**
* Simplified createTexture() interface for when there is no initial texel data to upload.
*/
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, SkBudgeted);
+ sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, GrRenderable, SkBudgeted);
sk_sp<GrTexture> createCompressedTexture(int width, int height, SkImage::CompressionType,
SkBudgeted, const void* data, size_t dataSize);
@@ -519,8 +526,9 @@
// overridden by backend-specific derived class to create objects.
// Texture size and sample size will have already been validated in base class before
// onCreateTexture is called.
- virtual sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted,
- const GrMipLevel texels[], int mipLevelCount) = 0;
+ virtual sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, GrRenderable renderable,
+ SkBudgeted, const GrMipLevel texels[],
+ int mipLevelCount) = 0;
virtual sk_sp<GrTexture> onCreateCompressedTexture(int width, int height,
SkImage::CompressionType, SkBudgeted,
const void* data) = 0;
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 9a2da88..5e0fd0e 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -115,7 +115,8 @@
#if GR_TEST_UTILS
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
- const GrSurfaceDesc& desc, GrSurfaceOrigin origin, SkBackingFit fit, SkBudgeted budgeted) {
+ const GrSurfaceDesc& desc, GrRenderable renderable, GrSurfaceOrigin origin,
+ SkBackingFit fit, SkBudgeted budgeted) {
GrContext* direct = fImageContext->priv().asDirectContext();
if (!direct) {
return nullptr;
@@ -125,9 +126,10 @@
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
- tex = resourceProvider->createApproxTexture(desc, GrResourceProvider::Flags::kNoPendingIO);
+ tex = resourceProvider->createApproxTexture(desc, renderable,
+ GrResourceProvider::Flags::kNoPendingIO);
} else {
- tex = resourceProvider->createTexture(desc, budgeted,
+ tex = resourceProvider->createTexture(desc, renderable, budgeted,
GrResourceProvider::Flags::kNoPendingIO);
}
if (!tex) {
@@ -197,7 +199,7 @@
}
sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImage,
- GrSurfaceDescFlags descFlags,
+ GrRenderable renderable,
int sampleCnt,
SkBudgeted budgeted,
SkBackingFit fit,
@@ -231,7 +233,7 @@
}
}
- if (SkToBool(descFlags & kRenderTarget_GrSurfaceFlag)) {
+ if (renderable == GrRenderable::kYes) {
sampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, grCT, format);
if (!sampleCnt) {
return nullptr;
@@ -246,20 +248,21 @@
GrSurfaceDesc desc;
desc.fWidth = srcImage->width();
desc.fHeight = srcImage->height();
- desc.fFlags = descFlags;
desc.fSampleCnt = sampleCnt;
desc.fConfig = config;
sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
- [desc, budgeted, srcImage, fit](GrResourceProvider* resourceProvider) {
+ [desc, renderable, budgeted, srcImage, fit](GrResourceProvider* resourceProvider) {
SkPixmap pixMap;
SkAssertResult(srcImage->peekPixels(&pixMap));
GrMipLevel mipLevel = { pixMap.addr(), pixMap.rowBytes() };
- return LazyInstantiationResult(resourceProvider->createTexture(
- desc, budgeted, fit, mipLevel, GrResourceProvider::Flags::kNoPendingIO));
+ return LazyInstantiationResult(
+ resourceProvider->createTexture(desc, renderable, budgeted, fit, mipLevel,
+ GrResourceProvider::Flags::kNoPendingIO));
},
- format, desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, surfaceFlags, fit, budgeted);
+ format, desc, renderable, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, surfaceFlags, fit,
+ budgeted);
if (!proxy) {
return nullptr;
@@ -283,6 +286,7 @@
sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxy(const GrBackendFormat& format,
const GrSurfaceDesc& desc,
+ GrRenderable renderable,
GrSurfaceOrigin origin,
SkBudgeted budgeted) {
ASSERT_SINGLE_OWNER
@@ -291,8 +295,8 @@
return nullptr;
}
- return this->createProxy(format, desc, origin, GrMipMapped::kYes, SkBackingFit::kExact,
- budgeted, GrInternalSurfaceFlags::kNone);
+ return this->createProxy(format, desc, renderable, origin, GrMipMapped::kYes,
+ SkBackingFit::kExact, budgeted, GrInternalSurfaceFlags::kNone);
}
sk_sp<GrTextureProxy> GrProxyProvider::createProxyFromBitmap(const SkBitmap& bitmap,
@@ -325,7 +329,7 @@
// If mips weren't requested (or this was too small to have any), then take the fast path
if (GrMipMapped::kNo == mipMapped ||
0 == SkMipMap::ComputeLevelCount(baseLevel->width(), baseLevel->height())) {
- return this->createTextureProxy(std::move(baseLevel), kNone_GrSurfaceFlags, 1,
+ return this->createTextureProxy(std::move(baseLevel), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
}
@@ -382,10 +386,10 @@
}
return LazyInstantiationResult(resourceProvider->createTexture(
- desc, SkBudgeted::kYes, texels.get(), mipLevelCount));
+ desc, GrRenderable::kNo, SkBudgeted::kYes, texels.get(), mipLevelCount));
},
- format, desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kYes, SkBackingFit::kExact,
- SkBudgeted::kYes);
+ format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin, GrMipMapped::kYes,
+ SkBackingFit::kExact, SkBudgeted::kYes);
if (!proxy) {
return nullptr;
@@ -429,6 +433,7 @@
sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format,
const GrSurfaceDesc& desc,
+ GrRenderable renderable,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
SkBackingFit fit,
@@ -453,17 +458,17 @@
}
}
- if (!caps->validateSurfaceDesc(desc, mipMapped)) {
+ if (!caps->validateSurfaceDesc(desc, renderable, mipMapped)) {
return nullptr;
}
GrSurfaceDesc copyDesc = desc;
- if (desc.fFlags & kRenderTarget_GrSurfaceFlag) {
+ if (renderable == GrRenderable::kYes) {
copyDesc.fSampleCnt = caps->getRenderTargetSampleCount(desc.fSampleCnt, colorType, format);
}
GrSwizzle texSwizzle = caps->getTextureSwizzle(format, colorType);
- if (copyDesc.fFlags & kRenderTarget_GrSurfaceFlag) {
+ if (renderable == GrRenderable::kYes) {
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
GrSwizzle outSwizzle = caps->getOutputSwizzle(format, colorType);
@@ -496,8 +501,8 @@
return LazyInstantiationResult(resourceProvider->createCompressedTexture(
width, height, compressionType, budgeted, data.get()));
},
- format, desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, SkBackingFit::kExact,
- SkBudgeted::kYes);
+ format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
+ SkBackingFit::kExact, SkBudgeted::kYes);
if (!proxy) {
return nullptr;
@@ -727,17 +732,19 @@
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
const GrSurfaceDesc& desc,
+ GrRenderable renderable,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
SkBackingFit fit,
SkBudgeted budgeted) {
- return this->createLazyProxy(std::move(callback), format, desc, origin, mipMapped,
+ return this->createLazyProxy(std::move(callback), format, desc, renderable, origin, mipMapped,
GrInternalSurfaceFlags::kNone, fit, budgeted);
}
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
const GrSurfaceDesc& desc,
+ GrRenderable renderable,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrInternalSurfaceFlags surfaceFlags,
@@ -746,13 +753,14 @@
// For non-ddl draws always make lazy proxy's single use.
LazyInstantiationType lazyType = this->renderingDirectly() ? LazyInstantiationType::kSingleUse
: LazyInstantiationType::kMultipleUse;
- return this->createLazyProxy(std::move(callback), format, desc, origin, mipMapped, surfaceFlags,
- fit, budgeted, lazyType);
+ return this->createLazyProxy(std::move(callback), format, desc, renderable, origin, mipMapped,
+ surfaceFlags, fit, budgeted, lazyType);
}
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
const GrSurfaceDesc& desc,
+ GrRenderable renderable,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrInternalSurfaceFlags surfaceFlags,
@@ -774,7 +782,7 @@
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(format, colorType);
return sk_sp<GrTextureProxy>(
- SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags)
+ renderable == GrRenderable::kYes
? new GrTextureRenderTargetProxy(std::move(callback), lazyType, format, desc,
origin, mipMapped, texSwizzle, outSwizzle, fit,
budgeted, surfaceFlags)
@@ -795,7 +803,6 @@
return nullptr;
}
- SkASSERT(SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags));
SkASSERT(validate_backend_format_and_config(this->caps(), format, desc.fConfig));
using LazyInstantiationType = GrSurfaceProxy::LazyInstantiationType;
@@ -831,9 +838,6 @@
SkASSERT(validate_backend_format_and_config(&caps, format, config));
GrSurfaceDesc desc;
GrInternalSurfaceFlags surfaceFlags = GrInternalSurfaceFlags::kNone;
- if (Renderable::kYes == renderable) {
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- }
desc.fWidth = -1;
desc.fHeight = -1;
desc.fConfig = config;
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index dc4f4f0..a4b07f9 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -62,7 +62,7 @@
* actually upload the data to the gpu.
*/
sk_sp<GrTextureProxy> createTextureProxy(
- sk_sp<SkImage> srcImage, GrSurfaceDescFlags, int sampleCnt, SkBudgeted, SkBackingFit,
+ sk_sp<SkImage> srcImage, GrRenderable, int sampleCnt, SkBudgeted, SkBackingFit,
GrInternalSurfaceFlags = GrInternalSurfaceFlags::kNone);
/*
@@ -73,7 +73,7 @@
* based on the width and height in the GrSurfaceDesc.
*/
sk_sp<GrTextureProxy> createMipMapProxy(const GrBackendFormat&, const GrSurfaceDesc&,
- GrSurfaceOrigin, SkBudgeted);
+ GrRenderable, GrSurfaceOrigin, SkBudgeted);
/*
* Creates a new texture proxy for the bitmap, optionally with mip levels generated by the cpu.
@@ -83,15 +83,15 @@
/*
* Create a GrSurfaceProxy without any data.
*/
- sk_sp<GrTextureProxy> createProxy(const GrBackendFormat&, const GrSurfaceDesc&, GrSurfaceOrigin,
- GrMipMapped, SkBackingFit, SkBudgeted,
+ sk_sp<GrTextureProxy> createProxy(const GrBackendFormat&, const GrSurfaceDesc&, GrRenderable,
+ GrSurfaceOrigin, GrMipMapped, SkBackingFit, SkBudgeted,
GrInternalSurfaceFlags);
sk_sp<GrTextureProxy> createProxy(
- const GrBackendFormat& format, const GrSurfaceDesc& desc,
- GrSurfaceOrigin origin, SkBackingFit fit, SkBudgeted budgeted,
- GrInternalSurfaceFlags surfaceFlags = GrInternalSurfaceFlags::kNone) {
- return this->createProxy(format, desc, origin, GrMipMapped::kNo, fit, budgeted,
+ const GrBackendFormat& format, const GrSurfaceDesc& desc, GrRenderable renderable,
+ GrSurfaceOrigin origin, SkBackingFit fit, SkBudgeted budgeted,
+ GrInternalSurfaceFlags surfaceFlags = GrInternalSurfaceFlags::kNone) {
+ return this->createProxy(format, desc, renderable, origin, GrMipMapped::kNo, fit, budgeted,
surfaceFlags);
}
@@ -165,17 +165,18 @@
* callback should cleanup any resources it captured and return an empty sk_sp<GrTextureProxy>.
*/
sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&, const GrBackendFormat&,
- const GrSurfaceDesc&, GrSurfaceOrigin, GrMipMapped,
- GrInternalSurfaceFlags, SkBackingFit, SkBudgeted,
- LazyInstantiationType);
+ const GrSurfaceDesc&, GrRenderable, GrSurfaceOrigin,
+ GrMipMapped, GrInternalSurfaceFlags, SkBackingFit,
+ SkBudgeted, LazyInstantiationType);
sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&, const GrBackendFormat&,
- const GrSurfaceDesc&, GrSurfaceOrigin, GrMipMapped,
- GrInternalSurfaceFlags, SkBackingFit, SkBudgeted);
+ const GrSurfaceDesc&, GrRenderable, GrSurfaceOrigin,
+ GrMipMapped, GrInternalSurfaceFlags, SkBackingFit,
+ SkBudgeted);
sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&, const GrBackendFormat&,
- const GrSurfaceDesc&, GrSurfaceOrigin, GrMipMapped,
- SkBackingFit, SkBudgeted);
+ const GrSurfaceDesc&, GrRenderable, GrSurfaceOrigin,
+ GrMipMapped, SkBackingFit, SkBudgeted);
/** A null TextureInfo indicates a non-textureable render target. */
sk_sp<GrRenderTargetProxy> createLazyRenderTargetProxy(LazyInstantiateCallback&&,
@@ -241,8 +242,9 @@
/*
* Create a texture proxy that is backed by an instantiated GrSurface.
*/
- sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(const GrSurfaceDesc&, GrSurfaceOrigin,
- SkBackingFit, SkBudgeted);
+ sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(const GrSurfaceDesc&, GrRenderable,
+ GrSurfaceOrigin, SkBackingFit,
+ SkBudgeted);
sk_sp<GrTextureProxy> testingOnly_createWrapped(sk_sp<GrTexture>, GrSurfaceOrigin);
#endif
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index d007202..3512e4f 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -193,9 +193,11 @@
sk_sp<GrTextureProxy> texture;
if (GrMipMapped::kNo == mipMapped) {
- texture = this->proxyProvider()->createProxy(format, desc, origin, fit, budgeted);
+ texture = this->proxyProvider()->createProxy(format, desc, GrRenderable::kNo, origin, fit,
+ budgeted);
} else {
- texture = this->proxyProvider()->createMipMapProxy(format, desc, origin, budgeted);
+ texture = this->proxyProvider()->createMipMapProxy(format, desc, GrRenderable::kNo, origin,
+ budgeted);
}
if (!texture) {
return nullptr;
@@ -234,7 +236,6 @@
}
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = width;
desc.fHeight = height;
desc.fIsProtected = isProtected;
@@ -243,9 +244,11 @@
sk_sp<GrTextureProxy> rtp;
if (GrMipMapped::kNo == mipMapped) {
- rtp = this->proxyProvider()->createProxy(format, desc, origin, fit, budgeted);
+ rtp = this->proxyProvider()->createProxy(format, desc, GrRenderable::kYes, origin, fit,
+ budgeted);
} else {
- rtp = this->proxyProvider()->createMipMapProxy(format, desc, origin, budgeted);
+ rtp = this->proxyProvider()->createMipMapProxy(format, desc, GrRenderable::kYes, origin,
+ budgeted);
}
if (!rtp) {
return nullptr;
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index 6c7a893..e26ca65 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -25,7 +25,6 @@
, fSampleCnt(desc.fSampleCnt)
, fSamplePatternKey(GrSamplePatternDictionary::kInvalidSamplePatternKey)
, fStencilAttachment(stencil) {
- SkASSERT(desc.fFlags & kRenderTarget_GrSurfaceFlag);
fResolveRect = SkRectPriv::MakeILargestInverted();
}
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 22b359b..673e70c 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -2615,12 +2615,14 @@
// MSAA consideration: When there is support for reading MSAA samples in the shader we could
// have per-sample dst values by making the copy multisampled.
+ // TODO: We don't really use renderability or GrSurfaceDesc. Remove them from caps function?
GrSurfaceDesc desc;
bool rectsMustMatch = false;
bool disallowSubrect = false;
- if (!this->caps()->initDescForDstCopy(rtProxy, &desc, &rectsMustMatch,
+ GrRenderable renderable = GrRenderable::kNo;
+ if (!this->caps()->initDescForDstCopy(rtProxy, &desc, &renderable, &rectsMustMatch,
&disallowSubrect)) {
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ renderable = GrRenderable::kYes;
desc.fConfig = rtProxy->config();
}
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 756e1d6..0d70920 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -24,11 +24,11 @@
const GrSwizzle& textureSwizzle,
const GrSwizzle& outputSwizzle, SkBackingFit fit,
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
- : INHERITED(format, desc, origin, textureSwizzle, fit, budgeted, surfaceFlags)
+ : INHERITED(format, desc, GrRenderable::kYes, origin, textureSwizzle, fit, budgeted,
+ surfaceFlags)
, fSampleCnt(desc.fSampleCnt)
, fWrapsVkSecondaryCB(WrapsVkSecondaryCB::kNo)
- , fOutputSwizzle(outputSwizzle) {
-}
+ , fOutputSwizzle(outputSwizzle) {}
// Lazy-callback version
GrRenderTargetProxy::GrRenderTargetProxy(LazyInstantiateCallback&& callback,
@@ -38,13 +38,11 @@
const GrSwizzle& outputSwizzle, SkBackingFit fit,
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags,
WrapsVkSecondaryCB wrapsVkSecondaryCB)
- : INHERITED(std::move(callback), lazyType, format, desc, origin, textureSwizzle, fit,
- budgeted, surfaceFlags)
+ : INHERITED(std::move(callback), lazyType, format, desc, GrRenderable::kYes, origin,
+ textureSwizzle, fit, budgeted, surfaceFlags)
, fSampleCnt(desc.fSampleCnt)
, fWrapsVkSecondaryCB(wrapsVkSecondaryCB)
- , fOutputSwizzle(outputSwizzle) {
- SkASSERT(SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags));
-}
+ , fOutputSwizzle(outputSwizzle) {}
// Wrapped version
GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin,
@@ -65,9 +63,7 @@
if (LazyState::kNot != this->lazyInstantiationState()) {
return false;
}
- static constexpr GrSurfaceDescFlags kDescFlags = kRenderTarget_GrSurfaceFlag;
-
- if (!this->instantiateImpl(resourceProvider, fSampleCnt, fNumStencilSamples, kDescFlags,
+ if (!this->instantiateImpl(resourceProvider, fSampleCnt, fNumStencilSamples, GrRenderable::kYes,
GrMipMapped::kNo, nullptr)) {
return false;
}
@@ -87,10 +83,8 @@
}
sk_sp<GrSurface> GrRenderTargetProxy::createSurface(GrResourceProvider* resourceProvider) const {
- static constexpr GrSurfaceDescFlags kDescFlags = kRenderTarget_GrSurfaceFlag;
-
sk_sp<GrSurface> surface = this->createSurfaceImpl(
- resourceProvider, fSampleCnt, fNumStencilSamples, kDescFlags, GrMipMapped::kNo);
+ resourceProvider, fSampleCnt, fNumStencilSamples, GrRenderable::kYes, GrMipMapped::kNo);
if (!surface) {
return nullptr;
}
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 69f6c0f..d49721c 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -76,7 +76,8 @@
return true;
}
-sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
+sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
+ GrRenderable renderable, SkBudgeted budgeted,
const GrMipLevel texels[], int mipLevelCount) {
ASSERT_SINGLE_OWNER
@@ -87,7 +88,7 @@
}
GrMipMapped mipMapped = mipLevelCount > 1 ? GrMipMapped::kYes : GrMipMapped::kNo;
- if (!fCaps->validateSurfaceDesc(desc, mipMapped)) {
+ if (!fCaps->validateSurfaceDesc(desc, renderable, mipMapped)) {
return nullptr;
}
bool mustInitializeAllLevels = this->caps()->createTextureMustSpecifyAllLevels();
@@ -109,12 +110,13 @@
h = std::max(h / 2, 1);
}
}
- return fGpu->createTexture(desc, budgeted, tmpTexels.get(), mipLevelCount);
+ return fGpu->createTexture(desc, renderable, budgeted, tmpTexels.get(), mipLevelCount);
}
sk_sp<GrTexture> GrResourceProvider::getExactScratch(const GrSurfaceDesc& desc,
- SkBudgeted budgeted, Flags flags) {
- sk_sp<GrTexture> tex(this->refScratchTexture(desc, flags));
+ GrRenderable renderable, SkBudgeted budgeted,
+ Flags flags) {
+ sk_sp<GrTexture> tex(this->refScratchTexture(desc, renderable, flags));
if (tex && SkBudgeted::kNo == budgeted) {
tex->resourcePriv().makeUnbudgeted();
}
@@ -123,6 +125,7 @@
}
sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
+ GrRenderable renderable,
SkBudgeted budgeted,
SkBackingFit fit,
const GrMipLevel& mipLevel,
@@ -137,7 +140,7 @@
return nullptr;
}
- if (!fCaps->validateSurfaceDesc(desc, GrMipMapped::kNo)) {
+ if (!fCaps->validateSurfaceDesc(desc, renderable, GrMipMapped::kNo)) {
return nullptr;
}
@@ -157,8 +160,8 @@
GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
sk_sp<GrTexture> tex = (SkBackingFit::kApprox == fit)
- ? this->createApproxTexture(desc, flags)
- : this->createTexture(desc, budgeted, flags);
+ ? this->createApproxTexture(desc, renderable, flags)
+ : this->createTexture(desc, renderable, budgeted, flags);
if (!tex) {
return nullptr;
}
@@ -192,20 +195,21 @@
data->size());
}
-sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
+sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
+ GrRenderable renderable, SkBudgeted budgeted,
Flags flags) {
ASSERT_SINGLE_OWNER
if (this->isAbandoned()) {
return nullptr;
}
- if (!fCaps->validateSurfaceDesc(desc, GrMipMapped::kNo)) {
+ if (!fCaps->validateSurfaceDesc(desc, renderable, GrMipMapped::kNo)) {
return nullptr;
}
// Compressed textures are read-only so they don't support re-use for scratch.
if (!GrPixelConfigIsCompressed(desc.fConfig)) {
- sk_sp<GrTexture> tex = this->getExactScratch(desc, budgeted, flags);
+ sk_sp<GrTexture> tex = this->getExactScratch(desc, renderable, budgeted, flags);
if (tex) {
return tex;
}
@@ -218,10 +222,10 @@
GrMipLevel level;
level.fRowBytes = rowBytes;
level.fPixels = zeros.get();
- return fGpu->createTexture(desc, budgeted, &level, 1);
+ return fGpu->createTexture(desc, renderable, budgeted, &level, 1);
}
- return fGpu->createTexture(desc, budgeted);
+ return fGpu->createTexture(desc, renderable, budgeted);
}
// Map 'value' to a larger multiple of 2. Values <= 'kMagicTol' will pop up to
@@ -251,7 +255,7 @@
}
sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& desc,
- Flags flags) {
+ GrRenderable renderable, Flags flags) {
ASSERT_SINGLE_OWNER
SkASSERT(Flags::kNone == flags || Flags::kNoPendingIO == flags);
@@ -264,24 +268,24 @@
return nullptr;
}
- if (!fCaps->validateSurfaceDesc(desc, GrMipMapped::kNo)) {
+ if (!fCaps->validateSurfaceDesc(desc, renderable, GrMipMapped::kNo)) {
return nullptr;
}
- if (auto tex = this->refScratchTexture(desc, flags)) {
+ if (auto tex = this->refScratchTexture(desc, renderable, flags)) {
return tex;
}
SkTCopyOnFirstWrite<GrSurfaceDesc> copyDesc(desc);
// bin by some multiple or power of 2 with a reasonable min
- if (fGpu->caps()->reuseScratchTextures() || (desc.fFlags & kRenderTarget_GrSurfaceFlag)) {
+ if (fGpu->caps()->reuseScratchTextures() || renderable == GrRenderable::kYes) {
GrSurfaceDesc* wdesc = copyDesc.writable();
wdesc->fWidth = MakeApprox(wdesc->fWidth);
wdesc->fHeight = MakeApprox(wdesc->fHeight);
}
- if (auto tex = this->refScratchTexture(*copyDesc, flags)) {
+ if (auto tex = this->refScratchTexture(*copyDesc, renderable, flags)) {
return tex;
}
@@ -292,33 +296,33 @@
GrMipLevel level;
level.fRowBytes = rowBytes;
level.fPixels = zeros.get();
- return fGpu->createTexture(*copyDesc, SkBudgeted::kYes, &level, 1);
+ return fGpu->createTexture(*copyDesc, renderable, SkBudgeted::kYes, &level, 1);
}
- return fGpu->createTexture(*copyDesc, SkBudgeted::kYes);
+ return fGpu->createTexture(*copyDesc, renderable, SkBudgeted::kYes);
}
-sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& desc, Flags flags) {
+sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& desc,
+ GrRenderable renderable, Flags flags) {
ASSERT_SINGLE_OWNER
SkASSERT(!this->isAbandoned());
SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig));
- SkASSERT(fCaps->validateSurfaceDesc(desc, GrMipMapped::kNo));
+ SkASSERT(fCaps->validateSurfaceDesc(desc, renderable, GrMipMapped::kNo));
// We could make initial clears work with scratch textures but it is a rare case so we just opt
// to fall back to making a new texture.
- if (fGpu->caps()->reuseScratchTextures() || (desc.fFlags & kRenderTarget_GrSurfaceFlag)) {
+ if (fGpu->caps()->reuseScratchTextures() || renderable == GrRenderable::kYes) {
GrScratchKey key;
- GrTexturePriv::ComputeScratchKey(desc, &key);
+ GrTexturePriv::ComputeScratchKey(desc, renderable, &key);
auto scratchFlags = GrResourceCache::ScratchFlags::kNone;
if (Flags::kNoPendingIO & flags) {
scratchFlags |= GrResourceCache::ScratchFlags::kRequireNoPendingIO;
- } else if (!(desc.fFlags & kRenderTarget_GrSurfaceFlag)) {
+ } else if (renderable == GrRenderable::kNo) {
// If it is not a render target then it will most likely be populated by
// writePixels() which will trigger a flush if the texture has pending IO.
scratchFlags |= GrResourceCache::ScratchFlags::kPreferNoPendingIO;
}
- GrGpuResource* resource = fCache->findAndRefScratchResource(key,
- GrSurface::WorstCaseSize(desc),
- scratchFlags);
+ GrGpuResource* resource = fCache->findAndRefScratchResource(
+ key, GrSurface::WorstCaseSize(desc, renderable), scratchFlags);
if (resource) {
fGpu->stats()->incNumScratchTexturesReused();
GrSurface* surface = static_cast<GrSurface*>(resource);
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index a4931c6..3447fd4 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -71,25 +71,27 @@
/**
* Finds a texture that approximately matches the descriptor. Will be at least as large in width
- * and height as desc specifies. If desc specifies that the texture should be a render target
- * then result will be a render target. Format and sample count will always match the request.
+ * and height as desc specifies. If renderable is kYes then the GrTexture will also be a
+ * GrRenderTarget. The texture's format and sample count will always match the request.
* The contents of the texture are undefined.
*/
- sk_sp<GrTexture> createApproxTexture(const GrSurfaceDesc&, Flags);
+ sk_sp<GrTexture> createApproxTexture(const GrSurfaceDesc&, GrRenderable, Flags);
- /** Create an exact fit texture with no initial data to upload.
+ /** Create an exact fit texture with no initial data to upload. */
+ sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, GrRenderable, SkBudgeted,
+ Flags = Flags::kNone);
+
+ sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, GrRenderable, SkBudgeted,
+ const GrMipLevel texels[], int mipLevelCount);
+
+ /** Create a potentially loose fit texture with the provided data */
+ sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, GrRenderable renderable, SkBudgeted,
+ SkBackingFit, const GrMipLevel&, Flags);
+
+ /**
+ * Creates a compressed texture. The GrGpu must support the SkImageImage::Compression type.
+ * This does not currently support MIP maps. It will not be renderable.
*/
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, Flags = Flags::kNone);
-
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel texels[],
- int mipLevelCount);
-
- // Create a potentially loose fit texture with the provided data
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, SkBackingFit,
- const GrMipLevel&, Flags);
-
- // Creates a compressed texture. The GrGpu must support the SkImageImage::Compression type.
- // This does not currently support MIP maps.
sk_sp<GrTexture> createCompressedTexture(int width, int height, SkImage::CompressionType,
SkBudgeted, SkData* data);
@@ -264,13 +266,13 @@
// Attempts to find a resource in the cache that exactly matches the GrSurfaceDesc. Failing that
// it returns null. If non-null, the resulting texture is always budgeted.
- sk_sp<GrTexture> refScratchTexture(const GrSurfaceDesc&, Flags);
+ sk_sp<GrTexture> refScratchTexture(const GrSurfaceDesc&, GrRenderable, Flags);
/*
* Try to find an existing scratch texture that exactly matches 'desc'. If successful
* update the budgeting accordingly.
*/
- sk_sp<GrTexture> getExactScratch(const GrSurfaceDesc&, SkBudgeted, Flags);
+ sk_sp<GrTexture> getExactScratch(const GrSurfaceDesc&, GrRenderable, SkBudgeted, Flags);
GrResourceCache* cache() { return fCache; }
const GrResourceCache* cache() const { return fCache; }
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index afd687a..505a215 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -107,6 +107,6 @@
return nullptr;
}
- return context->priv().proxyProvider()->createTextureProxy(std::move(img), kNone_GrSurfaceFlags,
- 1, SkBudgeted::kYes, fit);
+ return context->priv().proxyProvider()->createTextureProxy(std::move(img), GrRenderable::kNo, 1,
+ SkBudgeted::kYes, fit);
}
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 1811154..425b91b 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -184,8 +184,8 @@
const GrBackendFormat format =
context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
- return proxyProvider->createProxy(format, desc, kTopLeft_GrSurfaceOrigin, fit,
- SkBudgeted::kYes);
+ return proxyProvider->createProxy(format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin,
+ fit, SkBudgeted::kYes);
}
namespace {
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 87d9e9c..67804bf 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -16,14 +16,13 @@
#include "src/core/SkMathPriv.h"
#include "src/gpu/SkGr.h"
-size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc, bool binSize) {
+size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc, GrRenderable renderable, bool binSize) {
size_t size;
int width = binSize ? GrResourceProvider::MakeApprox(desc.fWidth) : desc.fWidth;
int height = binSize ? GrResourceProvider::MakeApprox(desc.fHeight) : desc.fHeight;
- bool isRenderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
- if (isRenderTarget) {
+ if (renderable == GrRenderable::kYes) {
// We own one color value for each MSAA sample.
SkASSERT(desc.fSampleCnt >= 1);
int colorValuesPerPixel = desc.fSampleCnt;
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 94a3abe..6d24a73 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -308,7 +308,8 @@
GrSurfaceOrigin tempOrigin =
this->asRenderTargetContext() ? kTopLeft_GrSurfaceOrigin : dstProxy->origin();
auto tempProxy = direct->priv().proxyProvider()->createProxy(
- format, desc, tempOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
+ format, desc, GrRenderable::kNo, tempOrigin, SkBackingFit::kApprox,
+ SkBudgeted::kYes);
if (!tempProxy) {
return false;
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index db7e794..c0b2baa 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -53,9 +53,9 @@
// Lazy-callback version
GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback, LazyInstantiationType lazyType,
const GrBackendFormat& format, const GrSurfaceDesc& desc,
- GrSurfaceOrigin origin, const GrSwizzle& textureSwizzle,
- SkBackingFit fit, SkBudgeted budgeted,
- GrInternalSurfaceFlags surfaceFlags)
+ GrRenderable renderable, GrSurfaceOrigin origin,
+ const GrSwizzle& textureSwizzle, SkBackingFit fit,
+ SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
, fConfig(desc.fConfig)
@@ -79,7 +79,7 @@
}
if (GrPixelConfigIsCompressed(desc.fConfig)) {
- SkASSERT(!SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag));
+ SkASSERT(renderable == GrRenderable::kNo);
fSurfaceFlags |= GrInternalSurfaceFlags::kReadOnly;
}
}
@@ -131,12 +131,11 @@
sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(GrResourceProvider* resourceProvider,
int sampleCnt, int minStencilSampleCount,
- GrSurfaceDescFlags descFlags,
+ GrRenderable renderable,
GrMipMapped mipMapped) const {
SkASSERT(GrSurfaceProxy::LazyState::kNot == this->lazyInstantiationState());
SkASSERT(!fTarget);
GrSurfaceDesc desc;
- desc.fFlags = descFlags;
desc.fWidth = fWidth;
desc.fHeight = fHeight;
desc.fIsProtected = fIsProtected;
@@ -164,16 +163,19 @@
texels[i].fRowBytes = 0;
}
- surface = resourceProvider->createTexture(desc, fBudgeted, texels.get(), mipCount);
+ surface = resourceProvider->createTexture(desc, renderable, fBudgeted, texels.get(),
+ mipCount);
if (surface) {
SkASSERT(surface->asTexture());
SkASSERT(GrMipMapped::kYes == surface->asTexture()->texturePriv().mipMapped());
}
} else {
if (SkBackingFit::kApprox == fFit) {
- surface = resourceProvider->createApproxTexture(desc, resourceProviderFlags);
+ surface =
+ resourceProvider->createApproxTexture(desc, renderable, resourceProviderFlags);
} else {
- surface = resourceProvider->createTexture(desc, fBudgeted, resourceProviderFlags);
+ surface = resourceProvider->createTexture(desc, renderable, fBudgeted,
+ resourceProviderFlags);
}
}
if (!surface) {
@@ -227,7 +229,7 @@
}
bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
- int minStencilSampleCount, GrSurfaceDescFlags descFlags,
+ int minStencilSampleCount, GrRenderable renderable,
GrMipMapped mipMapped, const GrUniqueKey* uniqueKey) {
SkASSERT(LazyState::kNot == this->lazyInstantiationState());
if (fTarget) {
@@ -239,7 +241,7 @@
}
sk_sp<GrSurface> surface = this->createSurfaceImpl(
- resourceProvider, sampleCnt, minStencilSampleCount, descFlags, mipMapped);
+ resourceProvider, sampleCnt, minStencilSampleCount, renderable, mipMapped);
if (!surface) {
return false;
}
@@ -262,9 +264,10 @@
void GrSurfaceProxy::computeScratchKey(GrScratchKey* key) const {
SkASSERT(LazyState::kFully != this->lazyInstantiationState());
- const GrRenderTargetProxy* rtp = this->asRenderTargetProxy();
+ GrRenderable renderable = GrRenderable::kNo;
int sampleCount = 1;
- if (rtp) {
+ if (const auto* rtp = this->asRenderTargetProxy()) {
+ renderable = GrRenderable::kYes;
sampleCount = rtp->numSamples();
}
@@ -277,7 +280,7 @@
int width = this->worstCaseWidth();
int height = this->worstCaseHeight();
- GrTexturePriv::ComputeScratchKey(this->config(), width, height, SkToBool(rtp), sampleCount,
+ GrTexturePriv::ComputeScratchKey(this->config(), width, height, renderable, sampleCount,
mipMapped, key);
}
diff --git a/src/gpu/GrSurfaceProxy.h b/src/gpu/GrSurfaceProxy.h
index 522cdc8..33c3688 100644
--- a/src/gpu/GrSurfaceProxy.h
+++ b/src/gpu/GrSurfaceProxy.h
@@ -326,16 +326,16 @@
protected:
// Deferred version
GrSurfaceProxy(const GrBackendFormat& format, const GrSurfaceDesc& desc,
- GrSurfaceOrigin origin, const GrSwizzle& textureSwizzle, SkBackingFit fit,
- SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
- : GrSurfaceProxy(nullptr, LazyInstantiationType::kSingleUse, format, desc, origin,
- textureSwizzle, fit, budgeted, surfaceFlags) {
+ GrRenderable renderable, GrSurfaceOrigin origin, const GrSwizzle& textureSwizzle,
+ SkBackingFit fit, SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
+ : GrSurfaceProxy(nullptr, LazyInstantiationType::kSingleUse, format, desc, renderable,
+ origin, textureSwizzle, fit, budgeted, surfaceFlags) {
// Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources
}
// Lazy-callback version
- GrSurfaceProxy(LazyInstantiateCallback&&, LazyInstantiationType,
- const GrBackendFormat& format, const GrSurfaceDesc&, GrSurfaceOrigin,
+ GrSurfaceProxy(LazyInstantiateCallback&&, LazyInstantiationType, const GrBackendFormat& format,
+ const GrSurfaceDesc&, GrRenderable, GrSurfaceOrigin,
const GrSwizzle& textureSwizzle, SkBackingFit, SkBudgeted,
GrInternalSurfaceFlags);
@@ -358,9 +358,8 @@
virtual sk_sp<GrSurface> createSurface(GrResourceProvider*) const = 0;
void assign(sk_sp<GrSurface> surface);
- sk_sp<GrSurface> createSurfaceImpl(
- GrResourceProvider*, int sampleCnt, int minStencilSampleCount, GrSurfaceDescFlags,
- GrMipMapped) const;
+ sk_sp<GrSurface> createSurfaceImpl(GrResourceProvider*, int sampleCnt,
+ int minStencilSampleCount, GrRenderable, GrMipMapped) const;
// Once the size of a fully-lazy proxy is decided, and before it gets instantiated, the client
// can use this optional method to specify the proxy's size. (A proxy's size can be less than
@@ -373,9 +372,8 @@
fHeight = height;
}
- bool instantiateImpl(
- GrResourceProvider* resourceProvider, int sampleCnt, int minStencilSampleCount,
- GrSurfaceDescFlags descFlags, GrMipMapped, const GrUniqueKey*);
+ bool instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
+ int minStencilSampleCount, GrRenderable, GrMipMapped, const GrUniqueKey*);
// For deferred proxies this will be null until the proxy is instantiated.
// For wrapped proxies it will point to the wrapped resource.
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 34a2bd4..76e841a 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -78,43 +78,44 @@
void GrTexture::computeScratchKey(GrScratchKey* key) const {
if (!GrPixelConfigIsCompressed(this->config())) {
- const GrRenderTarget* rt = this->asRenderTarget();
int sampleCount = 1;
- if (rt) {
+ GrRenderable renderable = GrRenderable::kNo;
+ if (const auto* rt = this->asRenderTarget()) {
sampleCount = rt->numSamples();
+ renderable = GrRenderable::kYes;
}
- GrTexturePriv::ComputeScratchKey(this->config(), this->width(), this->height(),
- SkToBool(rt), sampleCount,
- this->texturePriv().mipMapped(), key);
+ GrTexturePriv::ComputeScratchKey(this->config(), this->width(), this->height(), renderable,
+ sampleCount, this->texturePriv().mipMapped(), key);
}
}
void GrTexturePriv::ComputeScratchKey(GrPixelConfig config, int width, int height,
- bool isRenderTarget, int sampleCnt,
- GrMipMapped mipMapped, GrScratchKey* key) {
+ GrRenderable renderable, int sampleCnt, GrMipMapped mipMapped,
+ GrScratchKey* key) {
static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
- uint32_t flags = isRenderTarget;
SkASSERT(width > 0);
SkASSERT(height > 0);
SkASSERT(sampleCnt > 0);
- SkASSERT(1 == sampleCnt || isRenderTarget);
+ SkASSERT(1 == sampleCnt || renderable == GrRenderable::kYes);
// make sure desc.fConfig fits in 5 bits
SkASSERT(sk_float_log2(kLast_GrPixelConfig) <= 5);
SkASSERT(static_cast<int>(config) < (1 << 5));
SkASSERT(sampleCnt < (1 << 8));
- SkASSERT(flags < (1 << 10));
SkASSERT(static_cast<int>(mipMapped) <= 1);
GrScratchKey::Builder builder(key, kType, 3);
builder[0] = width;
builder[1] = height;
- builder[2] = config | (static_cast<uint8_t>(mipMapped) << 5) | (sampleCnt << 6) | (flags << 14);
+ builder[2] = config
+ | (static_cast<uint32_t>(mipMapped) << 5)
+ | (sampleCnt << 6)
+ | (static_cast<uint32_t>(renderable) << 14);
}
-void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) {
+void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrRenderable renderable,
+ GrScratchKey* key) {
// Note: the fOrigin field is not used in the scratch key
- return ComputeScratchKey(desc.fConfig, desc.fWidth, desc.fHeight,
- SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag), desc.fSampleCnt,
+ return ComputeScratchKey(desc.fConfig, desc.fWidth, desc.fHeight, renderable, desc.fSampleCnt,
GrMipMapped::kNo, key);
}
diff --git a/src/gpu/GrTexturePriv.h b/src/gpu/GrTexturePriv.h
index fdc848c..101f1aa 100644
--- a/src/gpu/GrTexturePriv.h
+++ b/src/gpu/GrTexturePriv.h
@@ -50,11 +50,9 @@
: GrSamplerState::Filter::kMipMap;
}
- static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*);
- static void ComputeScratchKey(GrPixelConfig config, int width, int height,
- bool isRenderTarget, int sampleCnt,
- GrMipMapped, GrScratchKey* key);
-
+ static void ComputeScratchKey(const GrSurfaceDesc&, GrRenderable, GrScratchKey*);
+ static void ComputeScratchKey(GrPixelConfig config, int width, int height, GrRenderable,
+ int sampleCnt, GrMipMapped, GrScratchKey* key);
private:
GrTexturePriv(GrTexture* texture) : fTexture(texture) { }
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 4a66daf..ce3111e 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -20,7 +20,8 @@
GrSurfaceOrigin origin, GrMipMapped mipMapped,
const GrSwizzle& textureSwizzle, SkBackingFit fit,
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
- : INHERITED(format, srcDesc, origin, textureSwizzle, fit, budgeted, surfaceFlags)
+ : INHERITED(format, srcDesc, GrRenderable::kNo, origin, textureSwizzle, fit, budgeted,
+ surfaceFlags)
, fMipMapped(mipMapped)
, fProxyProvider(nullptr)
, fDeferredUploader(nullptr) {}
@@ -31,8 +32,8 @@
GrSurfaceOrigin origin, GrMipMapped mipMapped,
const GrSwizzle& texSwizzle, SkBackingFit fit, SkBudgeted budgeted,
GrInternalSurfaceFlags surfaceFlags)
- : INHERITED(std::move(callback), lazyType, format, desc, origin, texSwizzle, fit, budgeted,
- surfaceFlags)
+ : INHERITED(std::move(callback), lazyType, format, desc, GrRenderable::kNo, origin,
+ texSwizzle, fit, budgeted, surfaceFlags)
, fMipMapped(mipMapped)
, fProxyProvider(nullptr)
, fDeferredUploader(nullptr) {}
@@ -70,9 +71,8 @@
if (LazyState::kNot != this->lazyInstantiationState()) {
return false;
}
- if (!this->instantiateImpl(resourceProvider, 1, /* needsStencil = */ false,
- kNone_GrSurfaceFlags, fMipMapped,
- fUniqueKey.isValid() ? &fUniqueKey : nullptr)) {
+ if (!this->instantiateImpl(resourceProvider, 1, /* needsStencil = */ false, GrRenderable::kNo,
+ fMipMapped, fUniqueKey.isValid() ? &fUniqueKey : nullptr)) {
return false;
}
@@ -82,10 +82,9 @@
}
sk_sp<GrSurface> GrTextureProxy::createSurface(GrResourceProvider* resourceProvider) const {
- sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, 1,
- /* needsStencil = */ false,
- kNone_GrSurfaceFlags,
- fMipMapped);
+ sk_sp<GrSurface> surface =
+ this->createSurfaceImpl(resourceProvider, 1,
+ /* needsStencil = */ false, GrRenderable::kNo, fMipMapped);
if (!surface) {
return nullptr;
}
diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp
index a8710f0..2d010de 100644
--- a/src/gpu/GrTextureRenderTargetProxy.cpp
+++ b/src/gpu/GrTextureRenderTargetProxy.cpp
@@ -28,7 +28,8 @@
SkBackingFit fit,
SkBudgeted budgeted,
GrInternalSurfaceFlags surfaceFlags)
- : GrSurfaceProxy(format, desc, origin, texSwizzle, fit, budgeted, surfaceFlags)
+ : GrSurfaceProxy(format, desc, GrRenderable::kYes, origin, texSwizzle, fit, budgeted,
+ surfaceFlags)
// for now textures w/ data are always wrapped
, GrRenderTargetProxy(caps, format, desc, origin, texSwizzle, outSwizzle, fit, budgeted,
surfaceFlags)
@@ -47,8 +48,8 @@
SkBackingFit fit,
SkBudgeted budgeted,
GrInternalSurfaceFlags surfaceFlags)
- : GrSurfaceProxy(std::move(callback), lazyType, format, desc, origin, texSwizzle, fit,
- budgeted, surfaceFlags)
+ : GrSurfaceProxy(std::move(callback), lazyType, format, desc, GrRenderable::kYes, origin,
+ texSwizzle, fit, budgeted, surfaceFlags)
// 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(), lazyType, format, desc, origin, texSwizzle,
@@ -87,13 +88,12 @@
if (LazyState::kNot != this->lazyInstantiationState()) {
return false;
}
- static constexpr GrSurfaceDescFlags kDescFlags = kRenderTarget_GrSurfaceFlag;
const GrUniqueKey& key = this->getUniqueKey();
- if (!this->instantiateImpl(
- resourceProvider, this->numSamples(), this->numStencilSamples(), kDescFlags,
- this->mipMapped(), key.isValid() ? &key : nullptr)) {
+ if (!this->instantiateImpl(resourceProvider, this->numSamples(), this->numStencilSamples(),
+ GrRenderable::kYes, this->mipMapped(),
+ key.isValid() ? &key : nullptr)) {
return false;
}
if (key.isValid()) {
@@ -108,11 +108,9 @@
sk_sp<GrSurface> GrTextureRenderTargetProxy::createSurface(
GrResourceProvider* resourceProvider) const {
- static constexpr GrSurfaceDescFlags kDescFlags = kRenderTarget_GrSurfaceFlag;
-
- sk_sp<GrSurface> surface = this->createSurfaceImpl(
- resourceProvider, this->numSamples(), this->numStencilSamples(), kDescFlags,
- this->mipMapped());
+ sk_sp<GrSurface> surface =
+ this->createSurfaceImpl(resourceProvider, this->numSamples(), this->numStencilSamples(),
+ GrRenderable::kYes, this->mipMapped());
if (!surface) {
return nullptr;
}
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index f7a1e50..f3d259b 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -150,9 +150,8 @@
dataStoragePtr);
auto proxyProvider = ctx->priv().proxyProvider();
- auto clearFlag = kNone_GrSurfaceFlags;
- yuvTextureProxies[i] = proxyProvider->createTextureProxy(yuvImage, clearFlag,
- 1, SkBudgeted::kYes, fit);
+ yuvTextureProxies[i] = proxyProvider->createTextureProxy(yuvImage, GrRenderable::kNo, 1,
+ SkBudgeted::kYes, fit);
SkASSERT(yuvTextureProxies[i]->width() == yuvSizeInfo.fSizes[i].fWidth);
SkASSERT(yuvTextureProxies[i]->height() == yuvSizeInfo.fSizes[i].fHeight);
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 2226463..0cffd76 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -86,7 +86,6 @@
GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo& info) {
GrSurfaceDesc desc;
- desc.fFlags = kNone_GrSurfaceFlags;
desc.fWidth = info.width();
desc.fHeight = info.height();
desc.fConfig = SkImageInfo2GrPixelConfig(info);
@@ -194,8 +193,8 @@
proxy = proxyProvider->findOrCreateProxyByUniqueKey(originalKey, kTopLeft_GrSurfaceOrigin);
}
if (!proxy) {
- proxy = proxyProvider->createTextureProxy(srcImage, kNone_GrSurfaceFlags, 1,
- SkBudgeted::kYes, fit);
+ proxy = proxyProvider->createTextureProxy(srcImage, GrRenderable::kNo, 1, SkBudgeted::kYes,
+ fit);
if (proxy && originalKey.isValid()) {
proxyProvider->assignUniqueKeyToProxy(originalKey, proxy.get());
const SkBitmap* bm = as_IB(srcImage.get())->onPeekBitmap();
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index aaaff6f..f14380f 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -86,12 +86,12 @@
[this, pixelConfig](GrResourceProvider* resourceProvider) {
if (!fBackingTexture) {
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = fWidth;
desc.fHeight = fHeight;
desc.fConfig = pixelConfig;
fBackingTexture = resourceProvider->createTexture(
- desc, SkBudgeted::kYes, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kYes, SkBudgeted::kYes,
+ GrResourceProvider::Flags::kNoPendingIO);
}
return GrSurfaceProxy::LazyInstantiationResult(fBackingTexture);
},
diff --git a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
index 69026bf..5825dae 100644
--- a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
+++ b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
@@ -248,7 +248,7 @@
bm.setImmutable();
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bm);
- blurProfile = proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, 1,
+ blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
if (!blurProfile) {
return nullptr;
diff --git a/src/gpu/effects/GrConfigConversionEffect.fp b/src/gpu/effects/GrConfigConversionEffect.fp
index 58c0201..a4320b2 100644
--- a/src/gpu/effects/GrConfigConversionEffect.fp
+++ b/src/gpu/effects/GrConfigConversionEffect.fp
@@ -65,7 +65,7 @@
sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr);
sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy(std::move(image),
- kNone_GrSurfaceFlags,
+ GrRenderable::kNo,
1,
SkBudgeted::kYes,
SkBackingFit::kExact);
diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp
index 4a4bf6f..de27f55 100644
--- a/src/gpu/effects/GrRectBlurEffect.fp
+++ b/src/gpu/effects/GrRectBlurEffect.fp
@@ -69,7 +69,7 @@
return nullptr;
}
- blurProfile = proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags,
+ blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo,
1, SkBudgeted::kYes,
SkBackingFit::kExact);
if (!blurProfile) {
diff --git a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
index 0725194..dd51bfe 100644
--- a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
+++ b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
@@ -225,7 +225,7 @@
bm.setImmutable();
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bm);
- blurProfile = proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, 1,
+ blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
if (!blurProfile) {
return nullptr;
diff --git a/src/gpu/effects/generated/GrConfigConversionEffect.h b/src/gpu/effects/generated/GrConfigConversionEffect.h
index 1915ba9..8cbabb6 100644
--- a/src/gpu/effects/generated/GrConfigConversionEffect.h
+++ b/src/gpu/effects/generated/GrConfigConversionEffect.h
@@ -69,7 +69,7 @@
sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr);
sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy(
- std::move(image), kNone_GrSurfaceFlags, 1, SkBudgeted::kYes, SkBackingFit::kExact);
+ std::move(image), GrRenderable::kNo, 1, SkBudgeted::kYes, SkBackingFit::kExact);
if (!dataProxy) {
return false;
}
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.h b/src/gpu/effects/generated/GrRectBlurEffect.h
index 269bfa7..eee6b71 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRectBlurEffect.h
@@ -49,9 +49,8 @@
return nullptr;
}
- blurProfile =
- proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, 1,
- SkBudgeted::kYes, SkBackingFit::kExact);
+ blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1,
+ SkBudgeted::kYes, SkBackingFit::kExact);
if (!blurProfile) {
return nullptr;
}
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 2cc40b1..f420a1e 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -2723,7 +2723,10 @@
}
bool GrGLCaps::initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
- bool* rectsMustMatch, bool* disallowSubrect) const {
+ GrRenderable* renderable, bool* rectsMustMatch,
+ bool* disallowSubrect) const {
+ *renderable = GrRenderable::kNo;
+
// By default, we don't require rects to match.
*rectsMustMatch = false;
@@ -2733,7 +2736,7 @@
// If the src is a texture, we can implement the blit as a draw assuming the config is
// renderable.
if (src->asTextureProxy() && !this->isConfigRenderable(src->config())) {
- desc->fFlags = kRenderTarget_GrSurfaceFlag;
+ *renderable = GrRenderable::kYes;
desc->fConfig = src->config();
return true;
}
@@ -2794,9 +2797,8 @@
}
}
- // We'll do a CopyTexSubImage. Make the dst a plain old texture.
+ // We'll do a CopyTexSubImage.
desc->fConfig = src->config();
- desc->fFlags = kNone_GrSurfaceFlags;
return true;
}
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index d9f82ba..af9ce42 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -435,7 +435,8 @@
bool canCopyAsDraw(GrPixelConfig dstConfig, bool srcIsTextureable) const;
bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
- bool* rectsMustMatch, bool* disallowSubrect) const override;
+ GrRenderable* renderable, bool* rectsMustMatch,
+ bool* disallowSubrect) const override;
bool programBinarySupport() const { return fProgramBinarySupport; }
bool programParameterSupport() const { return fProgramParameterSupport; }
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 1cd837c..4f0718c 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -696,7 +696,6 @@
}
GrSurfaceDesc surfDesc;
- surfDesc.fFlags = kNone_GrSurfaceFlags;
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
@@ -739,7 +738,6 @@
const GrCaps* caps = this->caps();
GrSurfaceDesc surfDesc;
- surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
@@ -779,7 +777,6 @@
idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed;
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = backendRT.width();
desc.fHeight = backendRT.height();
desc.fConfig = backendRT.config();
@@ -805,7 +802,6 @@
}
GrSurfaceDesc surfDesc;
- surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
surfDesc.fWidth = tex.width();
surfDesc.fHeight = tex.height();
surfDesc.fConfig = tex.config();
@@ -1464,6 +1460,7 @@
}
sk_sp<GrTexture> GrGLGpu::onCreateTexture(const GrSurfaceDesc& desc,
+ GrRenderable renderable,
SkBudgeted budgeted,
const GrMipLevel texels[],
int mipLevelCount) {
@@ -1472,20 +1469,17 @@
return return_null_texture();
}
- bool isRenderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
-
GrGLTexture::IDDesc idDesc;
idDesc.fOwnership = GrBackendObjectOwnership::kOwned;
GrMipMapsStatus mipMapsStatus;
GrGLTextureParameters::SamplerOverriddenState initialState;
- if (!this->createTextureImpl(desc, &idDesc.fInfo,
- isRenderTarget ? GrRenderable::kYes : GrRenderable::kNo,
- &initialState, texels, mipLevelCount, &mipMapsStatus)) {
+ if (!this->createTextureImpl(desc, &idDesc.fInfo, renderable, &initialState, texels,
+ mipLevelCount, &mipMapsStatus)) {
return return_null_texture();
}
sk_sp<GrGLTexture> tex;
- if (isRenderTarget) {
+ if (renderable == GrRenderable::kYes) {
// unbind the texture from the texture unit before binding it to the frame buffer
GL_CALL(BindTexture(idDesc.fInfo.fTarget, 0));
GrGLRenderTarget::IDDesc rtIDDesc;
@@ -1503,10 +1497,6 @@
// The non-sampler params are still at their default values.
tex->parameters()->set(&initialState, GrGLTextureParameters::NonsamplerState(),
fResetTimestampForTextureParameters);
-#ifdef TRACE_TEXTURE_CREATION
- SkDebugf("--- new texture [%d] size=(%d %d) config=%d\n",
- idDesc.fInfo.fID, desc.fWidth, desc.fHeight, desc.fConfig);
-#endif
bool clearLevelsWithoutData =
this->caps()->shouldInitializeTextures() && this->glCaps().clearTextureSupport();
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 50da366..fb5c196 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -191,8 +191,8 @@
void xferBarrier(GrRenderTarget*, GrXferBarrierType) override;
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
- const GrMipLevel texels[], int mipLevelCount) override;
+ sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, GrRenderable, SkBudgeted,
+ const GrMipLevel[], int mipLevelCount) override;
sk_sp<GrTexture> onCreateCompressedTexture(int width, int height,
SkImage::CompressionType compression, SkBudgeted,
const void* data) override;
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index 461b332..4e82f19 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -119,7 +119,8 @@
}
bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
- bool* rectsMustMatch, bool* disallowSubrect) const override {
+ GrRenderable* renderable, bool* rectsMustMatch,
+ bool* disallowSubrect) const override {
return false;
}
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index 898aa7e..e6f0a62 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -85,8 +85,9 @@
fCaps.reset(new GrMockCaps(contextOptions, options));
}
-sk_sp<GrTexture> GrMockGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
- const GrMipLevel texels[], int mipLevelCount) {
+sk_sp<GrTexture> GrMockGpu::onCreateTexture(const GrSurfaceDesc& desc, GrRenderable renderable,
+ SkBudgeted budgeted, const GrMipLevel texels[],
+ int mipLevelCount) {
if (fMockOptions.fFailTextureAllocations) {
return nullptr;
}
@@ -99,7 +100,7 @@
GrMipMapsStatus mipMapsStatus = mipLevelCount > 1 ? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
GrMockTextureInfo texInfo(ct, NextInternalTextureID());
- if (desc.fFlags & kRenderTarget_GrSurfaceFlag) {
+ if (renderable == GrRenderable::kYes) {
GrMockRenderTargetInfo rtInfo(ct, NextInternalRenderTargetID());
return sk_sp<GrTexture>(new GrMockTextureRenderTarget(this, budgeted, desc, mipMapsStatus,
texInfo, rtInfo));
@@ -140,7 +141,6 @@
SkASSERT(colorType == texInfo.fColorType);
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = tex.width();
desc.fHeight = tex.height();
desc.fConfig = texInfo.pixelConfig();
@@ -160,7 +160,6 @@
SkAssertResult(rt.getMockRenderTargetInfo(&info));
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = rt.width();
desc.fHeight = rt.height();
desc.fConfig = info.pixelConfig();
@@ -175,7 +174,6 @@
SkAssertResult(tex.getMockTextureInfo(&texInfo));
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = tex.width();
desc.fHeight = tex.height();
desc.fConfig = texInfo.pixelConfig();
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index fadbf98..1459637 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -63,8 +63,8 @@
void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel[],
- int mipLevelCount) override;
+ sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, GrRenderable, SkBudgeted,
+ const GrMipLevel[], int mipLevelCount) override;
sk_sp<GrTexture> onCreateCompressedTexture(int width, int height, SkImage::CompressionType,
SkBudgeted, const void* data) override;
diff --git a/src/gpu/mock/GrMockTexture.h b/src/gpu/mock/GrMockTexture.h
index 0d7d645..44da34d 100644
--- a/src/gpu/mock/GrMockTexture.h
+++ b/src/gpu/mock/GrMockTexture.h
@@ -183,7 +183,7 @@
void computeScratchKey(GrScratchKey* key) const override {
GrTexturePriv::ComputeScratchKey(this->config(), this->width(), this->height(),
- true, this->numSamples(),
+ GrRenderable::kYes, this->numSamples(),
this->texturePriv().mipMapped(), key);
}
};
diff --git a/src/gpu/mtl/GrMtlCaps.h b/src/gpu/mtl/GrMtlCaps.h
index 5271019..d11aa29 100644
--- a/src/gpu/mtl/GrMtlCaps.h
+++ b/src/gpu/mtl/GrMtlCaps.h
@@ -63,7 +63,8 @@
const SkIRect& srcRect, const SkIPoint& dstPoint) const;
bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
- bool* rectsMustMatch, bool* disallowSubrect) const override {
+ GrRenderable* renderable, bool* rectsMustMatch,
+ bool* disallowSubrect) const override {
return false;
}
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 4b68cff..16f35fc 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -135,7 +135,7 @@
void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
+ sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, GrRenderable, SkBudgeted budgeted,
const GrMipLevel texels[], int mipLevelCount) override;
sk_sp<GrTexture> onCreateCompressedTexture(int width, int height, SkImage::CompressionType,
SkBudgeted, const void* data) override {
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 6cf0f8c..96c5e02 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -407,8 +407,9 @@
return stencil;
}
-sk_sp<GrTexture> GrMtlGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
- const GrMipLevel texels[], int mipLevelCount) {
+sk_sp<GrTexture> GrMtlGpu::onCreateTexture(const GrSurfaceDesc& desc, GrRenderable renderable,
+ SkBudgeted budgeted, const GrMipLevel texels[],
+ int mipLevelCount) {
int mipLevels = !mipLevelCount ? 1 : mipLevelCount;
if (!fMtlCaps->isConfigTexturable(desc.fConfig)) {
@@ -423,8 +424,6 @@
return nullptr; // TODO: add compressed texture support
}
- bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
-
sk_sp<GrMtlTexture> tex;
// This TexDesc refers to the texture that will be read by the client. Thus even if msaa is
// requested, this TexDesc describes the resolved texture. Therefore we always have samples
@@ -442,7 +441,7 @@
// to copy to them.
texDesc.storageMode = MTLStorageModePrivate;
texDesc.usage = MTLTextureUsageShaderRead;
- texDesc.usage |= renderTarget ? MTLTextureUsageRenderTarget : 0;
+ texDesc.usage |= (renderable == GrRenderable::kYes) ? MTLTextureUsageRenderTarget : 0;
GrMipMapsStatus mipMapsStatus = GrMipMapsStatus::kNotAllocated;
if (mipLevels > 1) {
@@ -455,7 +454,7 @@
}
}
- if (renderTarget) {
+ if (renderable == GrRenderable::kYes) {
tex = GrMtlTextureRenderTarget::MakeNewTextureRenderTarget(this, budgeted,
desc, texDesc, mipMapsStatus);
} else {
@@ -506,11 +505,10 @@
}
static inline void init_surface_desc(GrSurfaceDesc* surfaceDesc, id<MTLTexture> mtlTexture,
- bool isRenderTarget, GrPixelConfig config) {
- if (isRenderTarget) {
+ GrRenderable renderable, GrPixelConfig config) {
+ if (renderable == GrRenderable::kYes) {
SkASSERT(MTLTextureUsageRenderTarget & mtlTexture.usage);
}
- surfaceDesc->fFlags = isRenderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
surfaceDesc->fWidth = mtlTexture.width;
surfaceDesc->fHeight = mtlTexture.height;
surfaceDesc->fConfig = config;
@@ -526,7 +524,7 @@
}
GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, false, backendTex.config());
+ init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kNo, backendTex.config());
return GrMtlTexture::MakeWrappedTexture(this, surfDesc, mtlTexture, cacheable, ioType);
}
@@ -542,7 +540,7 @@
}
GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, true, backendTex.config());
+ init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kYes, backendTex.config());
surfDesc.fSampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, colorType,
backendTex.getBackendFormat());
@@ -565,7 +563,7 @@
}
GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, true, backendRT.config());
+ init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kYes, backendRT.config());
return GrMtlRenderTarget::MakeWrappedRenderTarget(this, surfDesc, mtlTexture);
}
@@ -578,7 +576,7 @@
}
GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, true, backendTex.config());
+ init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kYes, backendTex.config());
surfDesc.fSampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, surfDesc.fConfig);
if (!surfDesc.fSampleCnt) {
return nullptr;
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 432f01c..b040b81 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -409,7 +409,7 @@
const GrBackendFormat format =
context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
auto proxy = context->priv().proxyProvider()->createProxy(
- format, desc, origin, SkBackingFit::kExact, SkBudgeted::kYes);
+ format, desc, GrRenderable::kNo, origin, SkBackingFit::kExact, SkBudgeted::kYes);
do {
if (random->nextBool()) {
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index f88dd36..d3bf54e 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -693,9 +693,9 @@
context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(format, desc, origin, mipMapped, fit,
- SkBudgeted::kNo,
- GrInternalSurfaceFlags::kNone);
+ sk_sp<GrTextureProxy> proxy =
+ proxyProvider->createProxy(format, desc, GrRenderable::kNo, origin, mipMapped, fit,
+ SkBudgeted::kNo, GrInternalSurfaceFlags::kNone);
SkRect rect = GrTest::TestRect(random);
SkRect srcRect;
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 3fbc63b..2332648 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -60,20 +60,20 @@
}
bool GrVkCaps::initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
- bool* rectsMustMatch, bool* disallowSubrect) const {
+ GrRenderable* renderable, bool* rectsMustMatch,
+ bool* disallowSubrect) const {
// Vk doesn't use rectsMustMatch or disallowSubrect. Always return false.
*rectsMustMatch = false;
*disallowSubrect = false;
+ *renderable = GrRenderable::kNo;
+
// We can always succeed here with either a CopyImage (none msaa src) or ResolveImage (msaa).
// For CopyImage we can make a simple texture, for ResolveImage we require the dst to be a
// render target as well.
desc->fConfig = src->config();
if (src->numSamples() > 1 || src->asTextureProxy()) {
- desc->fFlags = kRenderTarget_GrSurfaceFlag;
- } else {
- // Just going to use CopyImage here
- desc->fFlags = kNone_GrSurfaceFlags;
+ *renderable = GrRenderable::kYes;
}
return true;
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
index 8e3eff6..9916a15 100644
--- a/src/gpu/vk/GrVkCaps.h
+++ b/src/gpu/vk/GrVkCaps.h
@@ -159,7 +159,8 @@
GrPixelConfig srcConfig, int srcSamplecnt, bool srcHasYcbcr) const;
bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
- bool* rectsMustMatch, bool* disallowSubrect) const override;
+ GrRenderable* renderable, bool* rectsMustMatch,
+ bool* disallowSubrect) const override;
GrPixelConfig validateBackendRenderTarget(const GrBackendRenderTarget&,
GrColorType) const override;
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 0cbafbe..32d45fb 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -785,7 +785,6 @@
return false;
}
GrSurfaceDesc surfDesc;
- surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
surfDesc.fWidth = width;
surfDesc.fHeight = height;
surfDesc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -950,15 +949,14 @@
}
////////////////////////////////////////////////////////////////////////////////
-sk_sp<GrTexture> GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
- const GrMipLevel texels[], int mipLevelCount) {
- bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
-
+sk_sp<GrTexture> GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, GrRenderable renderable,
+ SkBudgeted budgeted, const GrMipLevel texels[],
+ int mipLevelCount) {
VkFormat pixelFormat;
SkAssertResult(GrPixelConfigToVkFormat(desc.fConfig, &pixelFormat));
VkImageUsageFlags usageFlags = VK_IMAGE_USAGE_SAMPLED_BIT;
- if (renderTarget) {
+ if (renderable == GrRenderable::kYes) {
usageFlags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
}
@@ -997,9 +995,8 @@
}
sk_sp<GrVkTexture> tex;
- if (renderTarget) {
- tex = GrVkTextureRenderTarget::MakeNewTextureRenderTarget(this, budgeted, desc,
- imageDesc,
+ if (renderable == GrRenderable::kYes) {
+ tex = GrVkTextureRenderTarget::MakeNewTextureRenderTarget(this, budgeted, desc, imageDesc,
mipMapsStatus);
} else {
tex = GrVkTexture::MakeNewTexture(this, budgeted, desc, imageDesc, mipMapsStatus);
@@ -1189,7 +1186,6 @@
}
GrSurfaceDesc surfDesc;
- surfDesc.fFlags = kNone_GrSurfaceFlags;
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
@@ -1233,7 +1229,6 @@
colorType)));
GrSurfaceDesc surfDesc;
- surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fIsProtected = backendTex.isProtected() ? GrProtected::kYes : GrProtected::kNo;
@@ -1274,7 +1269,6 @@
}
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = backendRT.width();
desc.fHeight = backendRT.height();
desc.fIsProtected = backendRT.isProtected() ? GrProtected::kYes : GrProtected::kNo;
@@ -1314,7 +1308,6 @@
}
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = tex.width();
desc.fHeight = tex.height();
desc.fIsProtected = tex.isProtected() ? GrProtected::kYes : GrProtected::kNo;
@@ -1353,7 +1346,6 @@
}
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = imageInfo.width();
desc.fHeight = imageInfo.height();
desc.fConfig = config;
@@ -2411,7 +2403,6 @@
// Make a new surface that is RGBA to copy the RGB surface into.
GrSurfaceDesc surfDesc;
- surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
surfDesc.fWidth = width;
surfDesc.fHeight = height;
surfDesc.fConfig = kRGBA_8888_GrPixelConfig;
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index f961e4f..45b0090 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -191,8 +191,8 @@
void destroyResources();
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel[],
- int mipLevelCount) override;
+ sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, GrRenderable, SkBudgeted,
+ const GrMipLevel[], int mipLevelCount) override;
sk_sp<GrTexture> onCreateCompressedTexture(int width, int height, SkImage::CompressionType,
SkBudgeted, const void* data) override;
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index c543446..efce01d 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -489,8 +489,8 @@
desc.fConfig = config;
// We pass kReadOnly here since we should treat content of the client's texture as immutable.
- return proxyProvider->createLazyProxy(std::move(callback), backendFormat, desc, origin,
- mipMapped, GrInternalSurfaceFlags::kReadOnly,
- SkBackingFit::kExact, SkBudgeted::kNo,
- GrSurfaceProxy::LazyInstantiationType::kDeinstantiate);
+ return proxyProvider->createLazyProxy(
+ std::move(callback), backendFormat, desc, GrRenderable::kNo, origin, mipMapped,
+ GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
+ GrSurfaceProxy::LazyInstantiationType::kDeinstantiate);
}
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp
index 8b9ac4b..a86b97d 100644
--- a/tests/BlendTest.cpp
+++ b/tests/BlendTest.cpp
@@ -92,7 +92,6 @@
GrPixelConfig config, GrSurfaceOrigin origin,
sk_sp<GrTexture>* backingSurface) {
GrSurfaceDesc backingDesc;
- backingDesc.fFlags = kRenderTarget_GrSurfaceFlag;
backingDesc.fWidth = width;
backingDesc.fHeight = height;
backingDesc.fConfig = config;
@@ -100,8 +99,9 @@
auto resourceProvider = context->priv().resourceProvider();
- *backingSurface = resourceProvider->createTexture(backingDesc, SkBudgeted::kNo,
- GrResourceProvider::Flags::kNoPendingIO);
+ *backingSurface =
+ resourceProvider->createTexture(backingDesc, GrRenderable::kYes, SkBudgeted::kNo,
+ GrResourceProvider::Flags::kNoPendingIO);
if (!(*backingSurface)) {
return nullptr;
}
diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp
index 9b2c5ff..edf9196 100644
--- a/tests/DetermineDomainModeTest.cpp
+++ b/tests/DetermineDomainModeTest.cpp
@@ -146,8 +146,8 @@
(isPowerOfTwo || isExact) ? RectInfo::kHard : RectInfo::kBad,
name);
- return proxyProvider->createProxy(format, desc, kTopLeft_GrSurfaceOrigin, fit,
- SkBudgeted::kYes);
+ return proxyProvider->createProxy(format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin,
+ fit, SkBudgeted::kYes);
}
static RectInfo::EdgeType compute_inset_edgetype(RectInfo::EdgeType previous,
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index c20e842..ba1079a 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -268,27 +268,25 @@
GrMipMapped mipMapped = GrMipMapped(context->priv().caps()->mipMapSupport());
{
GrSurfaceDesc dummyDesc;
- dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
dummyDesc.fWidth = 34;
dummyDesc.fHeight = 18;
dummyDesc.fConfig = kRGBA_8888_GrPixelConfig;
const GrBackendFormat format =
context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
- proxies[0] = proxyProvider->createProxy(format, dummyDesc, kBottomLeft_GrSurfaceOrigin,
- mipMapped, SkBackingFit::kExact, SkBudgeted::kNo,
- GrInternalSurfaceFlags::kNone);
+ proxies[0] = proxyProvider->createProxy(
+ format, dummyDesc, GrRenderable::kYes, kBottomLeft_GrSurfaceOrigin, mipMapped,
+ SkBackingFit::kExact, SkBudgeted::kNo, GrInternalSurfaceFlags::kNone);
}
{
GrSurfaceDesc dummyDesc;
- dummyDesc.fFlags = kNone_GrSurfaceFlags;
dummyDesc.fWidth = 16;
dummyDesc.fHeight = 22;
dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
const GrBackendFormat format =
context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
- proxies[1] = proxyProvider->createProxy(format, dummyDesc, kTopLeft_GrSurfaceOrigin,
- mipMapped, SkBackingFit::kExact, SkBudgeted::kNo,
- GrInternalSurfaceFlags::kNone);
+ proxies[1] = proxyProvider->createProxy(
+ format, dummyDesc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin, mipMapped,
+ SkBackingFit::kExact, SkBudgeted::kNo, GrInternalSurfaceFlags::kNone);
}
if (!proxies[0] || !proxies[1]) {
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 869ed75..e08bbc4 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -29,13 +29,12 @@
auto resourceProvider = context->priv().resourceProvider();
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = 256;
desc.fHeight = 256;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = 1;
sk_sp<GrSurface> texRT1 = resourceProvider->createTexture(
- desc, SkBudgeted::kNo, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kYes, SkBudgeted::kNo, GrResourceProvider::Flags::kNoPendingIO);
REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asRenderTarget());
REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asTexture());
@@ -46,9 +45,8 @@
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT1->asRenderTarget()) ==
static_cast<GrSurface*>(texRT1->asTexture()));
- desc.fFlags = kNone_GrSurfaceFlags;
sk_sp<GrTexture> tex1 = resourceProvider->createTexture(
- desc, SkBudgeted::kNo, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kNo, SkBudgeted::kNo, GrResourceProvider::Flags::kNoPendingIO);
REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget());
REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture());
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1.get()) == tex1->asTexture());
@@ -107,11 +105,9 @@
GrSurfaceDesc desc;
desc.fWidth = width;
desc.fHeight = height;
- desc.fFlags = renderable == GrRenderable::kYes ? kRenderTarget_GrSurfaceFlag
- : kNone_GrSurfaceFlags;
desc.fConfig = config;
desc.fSampleCnt = 1;
- return rp->createTexture(desc, SkBudgeted::kNo,
+ return rp->createTexture(desc, renderable, SkBudgeted::kNo,
GrResourceProvider::Flags::kNoPendingIO);
}
};
@@ -160,19 +156,17 @@
GrSurfaceDesc desc;
desc.fWidth = kW;
desc.fHeight = kH;
- desc.fFlags = kNone_GrSurfaceFlags;
desc.fConfig = config;
desc.fSampleCnt = 1;
- sk_sp<GrTextureProxy> proxy =
- proxyProvider->createMipMapProxy(format, desc, origin, SkBudgeted::kNo);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createMipMapProxy(
+ format, desc, GrRenderable::kNo, origin, SkBudgeted::kNo);
REPORTER_ASSERT(reporter,
SkToBool(proxy.get()) ==
(caps->isConfigTexturable(desc.fConfig) &&
caps->mipMapSupport() && !GrPixelConfigIsCompressed(config)));
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- tex = resourceProvider->createTexture(desc, SkBudgeted::kNo,
+ tex = resourceProvider->createTexture(desc, GrRenderable::kYes, SkBudgeted::kNo,
GrResourceProvider::Flags::kNoPendingIO);
bool isRenderable = caps->isConfigRenderable(config);
REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
@@ -180,7 +174,7 @@
isRenderable);
desc.fSampleCnt = 2;
- tex = resourceProvider->createTexture(desc, SkBudgeted::kNo,
+ tex = resourceProvider->createTexture(desc, GrRenderable::kYes, SkBudgeted::kNo,
GrResourceProvider::Flags::kNoPendingIO);
isRenderable = SkToBool(caps->getRenderTargetSampleCount(2, config));
REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
@@ -220,16 +214,15 @@
if (!caps->isConfigTexturable(desc.fConfig)) {
continue;
}
- for (bool rt : {false, true}) {
- if (rt && !caps->isConfigRenderable(desc.fConfig)) {
+ for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
+ if (renderable == GrRenderable::kYes && !caps->isConfigRenderable(desc.fConfig)) {
continue;
}
- desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
for (GrSurfaceOrigin origin :
{kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
for (auto fit : {SkBackingFit::kApprox, SkBackingFit::kExact}) {
auto proxy = proxyProvider->testingOnly_createInstantiatedProxy(
- desc, origin, fit, SkBudgeted::kYes);
+ desc, renderable, origin, fit, SkBudgeted::kYes);
if (!proxy) {
continue;
}
@@ -284,7 +277,7 @@
// Try creating the texture as a deferred proxy.
for (int i = 0; i < 2; ++i) {
sk_sp<GrSurfaceContext> surfCtx;
- if (desc.fFlags & kRenderTarget_GrSurfaceFlag) {
+ if (renderable == GrRenderable::kYes) {
surfCtx = context->priv().makeDeferredRenderTargetContext(
fit, desc.fWidth, desc.fHeight, colorType, nullptr,
desc.fSampleCnt, GrMipMapped::kNo, origin, nullptr);
@@ -387,7 +380,7 @@
// Copies should not work with a read-only texture
auto copySrc = proxyProvider->createTextureProxy(
- SkImage::MakeFromRaster(write, nullptr, nullptr), kNone_GrSurfaceFlags, 1,
+ SkImage::MakeFromRaster(write, nullptr, nullptr), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
REPORTER_ASSERT(reporter, copySrc);
auto copyResult = surfContext->testCopy(copySrc.get());
@@ -453,10 +446,8 @@
GrSurfaceDesc desc;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fWidth = desc.fHeight = kSurfSize;
- desc.fFlags = GrRenderable::kYes == renderable ? kRenderTarget_GrSurfaceFlag
- : kNone_GrSurfaceFlags;
return context->priv().resourceProvider()->createTexture(
- desc, SkBudgeted::kNo, GrResourceProvider::Flags::kNoPendingIO);
+ desc, renderable, SkBudgeted::kNo, GrResourceProvider::Flags::kNoPendingIO);
}
DEF_GPUTEST(TextureIdleProcTest, reporter, options) {
@@ -523,7 +514,7 @@
auto texture = make(context, 1);
REPORTER_ASSERT(reporter, idleIDs.find(1) == idleIDs.end());
- bool isRT = SkToBool(texture->asRenderTarget());
+ auto renderable = GrRenderable(SkToBool(texture->asRenderTarget()));
auto backendFormat = texture->backendFormat();
texture.reset();
REPORTER_ASSERT(reporter, idleIDs.find(1) != idleIDs.end());
@@ -546,9 +537,6 @@
desc.fWidth = w;
desc.fHeight = h;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- if (isRT) {
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- }
SkBudgeted budgeted;
if (texture->resourcePriv().budgetedType() == GrBudgetedType::kBudgeted) {
budgeted = SkBudgeted::kYes;
@@ -556,7 +544,7 @@
budgeted = SkBudgeted::kNo;
}
auto proxy = context->priv().proxyProvider()->createLazyProxy(
- singleUseLazyCB, backendFormat, desc,
+ singleUseLazyCB, backendFormat, desc, renderable,
GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
GrInternalSurfaceFlags ::kNone, SkBackingFit::kExact, budgeted,
GrSurfaceProxy::LazyInstantiationType::kSingleUse);
@@ -593,7 +581,7 @@
return GrSurfaceProxy::LazyInstantiationResult{std::move(texture), mode};
};
proxy = context->priv().proxyProvider()->createLazyProxy(
- deinstantiateLazyCB, backendFormat, desc,
+ deinstantiateLazyCB, backendFormat, desc, renderable,
GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
GrInternalSurfaceFlags ::kNone, SkBackingFit::kExact, budgeted,
GrSurfaceProxy::LazyInstantiationType::kDeinstantiate);
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index e806fe4..937f554 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -202,8 +202,8 @@
static sk_sp<GrTextureProxy> create_proxy(GrProxyProvider* proxyProvider) {
SkBitmap srcBM = create_bm();
sk_sp<SkImage> srcImage(SkImage::MakeFromBitmap(srcBM));
- return proxyProvider->createTextureProxy(srcImage, kNone_GrSurfaceFlags, 1,
- SkBudgeted::kYes, SkBackingFit::kExact);
+ return proxyProvider->createTextureProxy(srcImage, GrRenderable::kNo, 1, SkBudgeted::kYes,
+ SkBackingFit::kExact);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) {
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 6604c56..6067e1f 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -95,8 +95,9 @@
desc.fWidth = 1234;
desc.fHeight = 567;
desc.fConfig = kRGB_565_GrPixelConfig;
- sk_sp<GrTexture> texture = rp->createTexture(
- desc, SkBudgeted::kYes, GrResourceProvider::Flags::kNoPendingIO);
+ sk_sp<GrTexture> texture =
+ rp->createTexture(desc, GrRenderable::kNo, SkBudgeted::kYes,
+ GrResourceProvider::Flags::kNoPendingIO);
REPORTER_ASSERT(fTest->fReporter, texture);
return std::move(texture);
}
@@ -264,9 +265,9 @@
int* fValue = nullptr;
};
sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
- TestCallback(&testCount), format, desc, kTopLeft_GrSurfaceOrigin,
- GrMipMapped::kNo, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact,
- SkBudgeted::kNo, lazyType);
+ TestCallback(&testCount), format, desc, GrRenderable::kNo,
+ kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, GrInternalSurfaceFlags::kNone,
+ SkBackingFit::kExact, SkBudgeted::kNo, lazyType);
REPORTER_ASSERT(reporter, proxy.get());
REPORTER_ASSERT(reporter, 0 == testCount);
@@ -330,12 +331,12 @@
*testExecuteValue = 1;
return {};
}
- return {rp->createTexture(desc, SkBudgeted::kNo,
+ return {rp->createTexture(desc, GrRenderable::kNo, SkBudgeted::kNo,
GrResourceProvider::Flags::kNoPendingIO),
GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
- format, desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, SkBackingFit::kExact,
- SkBudgeted::kNo);
+ format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
+ SkBackingFit::kExact, SkBudgeted::kNo);
SkASSERT(fLazyProxy.get());
@@ -470,7 +471,7 @@
texture->setRelease(DeinstantiateReleaseProc, releasePtr);
return std::move(texture);
},
- format, desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
+ format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo, lazyType);
REPORTER_ASSERT(reporter, lazyProxy.get());
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index f17c829..6ddf58b 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -307,7 +307,6 @@
[](GrResourceProvider* resourceProvider)
-> GrSurfaceProxy::LazyInstantiationResult {
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
// TODO: until partial flushes in MDB lands we're stuck having
// all 9 atlas draws occur
desc.fWidth = 9 /*this->numOps()*/ * kAtlasTileSize;
@@ -315,7 +314,8 @@
desc.fConfig = kRGBA_8888_GrPixelConfig;
auto texture = resourceProvider->createTexture(
- desc, SkBudgeted::kYes, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kYes, SkBudgeted::kYes,
+ GrResourceProvider::Flags::kNoPendingIO);
return std::move(texture);
},
format,
diff --git a/tests/OpChainTest.cpp b/tests/OpChainTest.cpp
index 4e96bcf..c07e90f 100644
--- a/tests/OpChainTest.cpp
+++ b/tests/OpChainTest.cpp
@@ -166,14 +166,13 @@
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fWidth = kNumOps + 1;
desc.fHeight = 1;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
const GrBackendFormat format =
context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
auto proxy = context->priv().proxyProvider()->createProxy(
- format, desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, SkBackingFit::kExact,
- SkBudgeted::kNo, GrInternalSurfaceFlags::kNone);
+ format, desc, GrRenderable::kYes, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
+ SkBackingFit::kExact, SkBudgeted::kNo, GrInternalSurfaceFlags::kNone);
SkASSERT(proxy);
proxy->instantiate(context->priv().resourceProvider());
int result[result_width()];
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index ab3b9e3..d4132df 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -178,8 +178,8 @@
SkBackingFit::kApprox, 1, 1, GrColorType::kRGBA_8888, nullptr));
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
- format, desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact,
- SkBudgeted::kYes);
+ format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin,
+ SkBackingFit::kExact, SkBudgeted::kYes);
{
SkTArray<sk_sp<GrTextureProxy>> proxies;
@@ -289,8 +289,8 @@
kRGBA_8888_SkColorType, kPremul_SkAlphaType);
SkPixmap pixmap(ii, rgbaData.get(), ii.minRowBytes());
sk_sp<SkImage> img = SkImage::MakeRasterCopy(pixmap);
- proxies[0] = proxyProvider->createTextureProxy(img, kNone_GrSurfaceFlags, 1,
- SkBudgeted::kYes, SkBackingFit::kExact);
+ proxies[0] = proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes,
+ SkBackingFit::kExact);
proxies[0]->instantiate(resourceProvider);
}
@@ -307,8 +307,8 @@
kAlpha_8_SkColorType, kPremul_SkAlphaType);
SkPixmap pixmap(ii, alphaData.get(), ii.minRowBytes());
sk_sp<SkImage> img = SkImage::MakeRasterCopy(pixmap);
- proxies[1] = proxyProvider->createTextureProxy(img, kNone_GrSurfaceFlags, 1,
- SkBudgeted::kYes, SkBackingFit::kExact);
+ proxies[1] = proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes,
+ SkBackingFit::kExact);
proxies[1]->instantiate(resourceProvider);
}
@@ -329,8 +329,8 @@
SkImageInfo ii = SkImageInfo::Make(width, height, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
SkPixmap pixmap(ii, data.get(), ii.minRowBytes());
sk_sp<SkImage> img = SkImage::MakeRasterCopy(pixmap);
- return proxyProvider->createTextureProxy(img, kNone_GrSurfaceFlags, 1,
- SkBudgeted::kYes, SkBackingFit::kExact);
+ return proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes,
+ SkBackingFit::kExact);
}
bool log_surface_context(sk_sp<GrSurfaceContext> src, SkString* dst) {
diff --git a/tests/PromiseImageTest.cpp b/tests/PromiseImageTest.cpp
index 19f3b45..b890b65 100644
--- a/tests/PromiseImageTest.cpp
+++ b/tests/PromiseImageTest.cpp
@@ -424,7 +424,7 @@
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fWidth = desc.fHeight = 100;
textures[i] = ctx->priv().resourceProvider()->createTexture(
- desc, SkBudgeted::kYes, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kNo, SkBudgeted::kYes, GrResourceProvider::Flags::kNoPendingIO);
REPORTER_ASSERT(reporter, textures[i]);
}
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index 0a5bb36..daf983d 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -42,17 +42,16 @@
static sk_sp<GrSurfaceProxy> make_offscreen_rt(GrProxyProvider* provider,
const GrSurfaceDesc& desc,
GrSurfaceOrigin origin) {
- SkASSERT(kRenderTarget_GrSurfaceFlag == desc.fFlags);
-
- return provider->testingOnly_createInstantiatedProxy(desc, origin, SkBackingFit::kExact,
- SkBudgeted::kYes);
+ return provider->testingOnly_createInstantiatedProxy(desc, GrRenderable::kYes, origin,
+ SkBackingFit::kExact, SkBudgeted::kYes);
}
static sk_sp<GrSurfaceProxy> make_texture(GrProxyProvider* provider,
const GrSurfaceDesc& desc,
+ GrRenderable renderable,
GrSurfaceOrigin origin) {
- return provider->testingOnly_createInstantiatedProxy(desc, origin, SkBackingFit::kExact,
- SkBudgeted::kYes);
+ return provider->testingOnly_createInstantiatedProxy(desc, renderable, origin,
+ SkBackingFit::kExact, SkBudgeted::kYes);
}
// Test converting between RenderTargetProxies and TextureProxies for preinstantiated Proxies
@@ -61,7 +60,6 @@
GrGpu* gpu = ctxInfo.grContext()->priv().getGpu();
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -98,7 +96,7 @@
{
// Internal offscreen render target - but through GrTextureProxy
sk_sp<GrSurfaceProxy> sProxy(
- make_texture(proxyProvider, desc, kBottomLeft_GrSurfaceOrigin));
+ make_texture(proxyProvider, desc, GrRenderable::kYes, kBottomLeft_GrSurfaceOrigin));
if (sProxy) {
// Both RenderTarget and Texture
GrTextureProxy* tProxy = sProxy->asTextureProxy();
@@ -111,10 +109,9 @@
}
{
- desc.fFlags = kNone_GrSurfaceFlags; // force no-RT
-
+ // force no-RT
sk_sp<GrSurfaceProxy> sProxy(
- make_texture(proxyProvider, desc, kBottomLeft_GrSurfaceOrigin));
+ make_texture(proxyProvider, desc, GrRenderable::kNo, kBottomLeft_GrSurfaceOrigin));
if (sProxy) {
// Texture-only
GrTextureProxy* tProxy = sProxy->asTextureProxy();
@@ -131,7 +128,6 @@
GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -141,7 +137,8 @@
GrColorType::kRGBA_8888);
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
- format, desc, kBottomLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
+ format, desc, GrRenderable::kYes, kBottomLeft_GrSurfaceOrigin,
+ SkBackingFit::kApprox, SkBudgeted::kYes);
// Both RenderTarget and Texture
GrRenderTargetProxy* rtProxy = proxy->asRenderTargetProxy();
@@ -154,7 +151,8 @@
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
- format, desc, kBottomLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
+ format, desc, GrRenderable::kYes, kBottomLeft_GrSurfaceOrigin,
+ SkBackingFit::kApprox, SkBudgeted::kYes);
// Both RenderTarget and Texture - but via GrTextureProxy
GrTextureProxy* tProxy = proxy->asTextureProxy();
@@ -166,10 +164,9 @@
}
{
- desc.fFlags = kNone_GrSurfaceFlags; // force no-RT
-
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
- format, desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
+ format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox,
+ SkBudgeted::kYes);
// Texture-only
GrTextureProxy* tProxy = proxy->asTextureProxy();
REPORTER_ASSERT(reporter, tProxy);
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index 0160a74..bacec67 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -36,25 +36,24 @@
static sk_sp<GrTextureProxy> make_deferred(GrProxyProvider* proxyProvider, const GrCaps* caps) {
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
const GrBackendFormat format = caps->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
- return proxyProvider->createProxy(format, desc, kBottomLeft_GrSurfaceOrigin,
+ return proxyProvider->createProxy(format, desc, GrRenderable::kYes, kBottomLeft_GrSurfaceOrigin,
SkBackingFit::kApprox, SkBudgeted::kYes);
}
static sk_sp<GrTextureProxy> make_wrapped(GrProxyProvider* proxyProvider, const GrCaps* caps) {
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
return proxyProvider->testingOnly_createInstantiatedProxy(
- desc, kBottomLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kNo);
+ desc, GrRenderable::kYes, kBottomLeft_GrSurfaceOrigin, SkBackingFit::kExact,
+ SkBudgeted::kNo);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 23022e0..7e3c040 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -121,7 +121,6 @@
SkASSERT(kUnknown_GrPixelConfig != config);
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = widthHeight;
desc.fHeight = widthHeight;
desc.fConfig = config;
@@ -132,19 +131,21 @@
continue;
}
+ // Renderable
{
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(
- desc, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kYes,
+ GrResourceProvider::Flags::kNoPendingIO);
} else {
tex = resourceProvider->createTexture(
- desc, budgeted, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kYes, budgeted,
+ GrResourceProvider::Flags::kNoPendingIO);
}
- sk_sp<GrTextureProxy> proxy =
- proxyProvider->createProxy(format, desc, origin, fit,
- budgeted);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
+ format, desc, GrRenderable::kYes, origin, fit, budgeted);
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
REPORTER_ASSERT(reporter, proxy->asRenderTargetProxy());
@@ -166,21 +167,21 @@
}
}
- desc.fFlags = kNone_GrSurfaceFlags;
-
+ // Not renderable
{
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(
- desc, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kNo,
+ GrResourceProvider::Flags::kNoPendingIO);
} else {
tex = resourceProvider->createTexture(
- desc, budgeted, GrResourceProvider::Flags::kNoPendingIO);
+ desc, GrRenderable::kNo, budgeted,
+ GrResourceProvider::Flags::kNoPendingIO);
}
- sk_sp<GrTextureProxy> proxy(
- proxyProvider->createProxy(format, desc, origin, fit,
- budgeted));
+ sk_sp<GrTextureProxy> proxy(proxyProvider->createProxy(
+ format, desc, GrRenderable::kNo, origin, fit, budgeted));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
// This forces the proxy to compute and cache its
@@ -362,7 +363,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
GrProxyProvider* provider = ctxInfo.grContext()->priv().proxyProvider();
- for (auto flags : { kRenderTarget_GrSurfaceFlag, kNone_GrSurfaceFlags }) {
+ for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {
for (int width : { 0, 100 }) {
for (int height : { 0, 100}) {
@@ -371,7 +372,6 @@
}
GrSurfaceDesc desc;
- desc.fFlags = flags;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -381,8 +381,9 @@
ctxInfo.grContext()->priv().caps()->getBackendFormatFromColorType(
GrColorType::kRGBA_8888);
- sk_sp<GrTextureProxy> proxy = provider->createProxy(
- format, desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kNo);
+ sk_sp<GrTextureProxy> proxy = provider->createProxy(format, desc, renderable,
+ kBottomLeft_GrSurfaceOrigin,
+ fit, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, !proxy);
}
}
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 4d365d2..0536255 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -58,7 +58,6 @@
static const size_t kRowBytes[] = {0, X_SIZE, X_SIZE + 1, 2 * X_SIZE - 1};
{
GrSurfaceDesc desc;
- desc.fFlags = kNone_GrSurfaceFlags;
desc.fConfig = kAlpha_8_GrPixelConfig; // it is a single channel texture
desc.fWidth = X_SIZE;
desc.fHeight = Y_SIZE;
@@ -70,9 +69,8 @@
SkPixmap pixmap(ii, alphaData, ii.minRowBytes());
sk_sp<SkImage> alphaImg = SkImage::MakeRasterCopy(pixmap);
- sk_sp<GrTextureProxy> proxy =
- proxyProvider->createTextureProxy(alphaImg, kNone_GrSurfaceFlags, 1,
- SkBudgeted::kNo, SkBackingFit::kExact);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
+ alphaImg, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact);
if (!proxy) {
ERRORF(reporter, "Could not create alpha texture.");
return;
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 3e7bd79..db3eab5 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -23,7 +23,7 @@
struct ProxyParams {
int fSize;
- bool fIsRT;
+ GrRenderable fRenderable;
SkColorType fColorType;
SkBackingFit fFit;
int fSampleCnt;
@@ -38,7 +38,6 @@
GrPixelConfig config = GrColorTypeToPixelConfig(grCT);
GrSurfaceDesc desc;
- desc.fFlags = p.fIsRT ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
desc.fWidth = p.fSize;
desc.fHeight = p.fSize;
desc.fConfig = config;
@@ -46,7 +45,7 @@
const GrBackendFormat format = caps->getBackendFormatFromColorType(grCT);
- return proxyProvider->createProxy(format, desc, p.fOrigin, p.fFit, p.fBudgeted);
+ return proxyProvider->createProxy(format, desc, p.fRenderable, p.fOrigin, p.fFit, p.fBudgeted);
}
static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams& p,
@@ -139,8 +138,8 @@
bool fExpectation;
};
- constexpr bool kRT = true;
- constexpr bool kNotRT = false;
+ constexpr GrRenderable kRT = GrRenderable::kYes;
+ constexpr GrRenderable kNotRT = GrRenderable::kNo;
constexpr bool kShare = true;
constexpr bool kDontShare = false;
@@ -273,20 +272,19 @@
GrPixelConfig config = GrColorTypeToPixelConfig(grCT);
GrSurfaceDesc desc;
- desc.fFlags = p.fIsRT ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
desc.fWidth = p.fSize;
desc.fHeight = p.fSize;
desc.fConfig = config;
desc.fSampleCnt = p.fSampleCnt;
SkBackingFit fit = p.fFit;
- auto callback = [fit, desc](GrResourceProvider* resourceProvider) {
+ auto callback = [fit, desc, renderable = p.fRenderable](GrResourceProvider* resourceProvider) {
sk_sp<GrTexture> texture;
if (fit == SkBackingFit::kApprox) {
texture = resourceProvider->createApproxTexture(
- desc, GrResourceProvider::Flags::kNoPendingIO);
+ desc, renderable, GrResourceProvider::Flags::kNoPendingIO);
} else {
- texture = resourceProvider->createTexture(desc, SkBudgeted::kNo,
+ texture = resourceProvider->createTexture(desc, renderable, SkBudgeted::kNo,
GrResourceProvider::Flags::kNoPendingIO);
}
return GrSurfaceProxy::LazyInstantiationResult(std::move(texture));
@@ -295,8 +293,8 @@
auto lazyType = deinstantiate ? GrSurfaceProxy::LazyInstantiationType ::kDeinstantiate
: GrSurfaceProxy::LazyInstantiationType ::kSingleUse;
GrInternalSurfaceFlags flags = GrInternalSurfaceFlags::kNone;
- return proxyProvider->createLazyProxy(callback, format, desc, p.fOrigin, GrMipMapped::kNo,
- flags, p.fFit, p.fBudgeted, lazyType);
+ return proxyProvider->createLazyProxy(callback, format, desc, p.fRenderable, p.fOrigin,
+ GrMipMapped::kNo, flags, p.fFit, p.fBudgeted, lazyType);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(LazyDeinstantiation, reporter, ctxInfo) {
@@ -306,17 +304,17 @@
texParams.fFit = SkBackingFit::kExact;
texParams.fOrigin = kTopLeft_GrSurfaceOrigin;
texParams.fColorType = kRGBA_8888_SkColorType;
- texParams.fIsRT = false;
+ texParams.fRenderable = GrRenderable::kNo;
texParams.fSampleCnt = 1;
texParams.fSize = 100;
texParams.fBudgeted = SkBudgeted::kNo;
- ProxyParams rtParams = texParams;
- rtParams.fIsRT = true;
auto proxyProvider = context->priv().proxyProvider();
auto caps = context->priv().caps();
auto p0 = make_lazy(proxyProvider, caps, texParams, true);
auto p1 = make_lazy(proxyProvider, caps, texParams, false);
- texParams.fFit = rtParams.fFit = SkBackingFit::kApprox;
+ ProxyParams rtParams = texParams;
+ rtParams.fRenderable = GrRenderable::kYes;
+ rtParams.fFit = SkBackingFit::kApprox;
auto p2 = make_lazy(proxyProvider, caps, rtParams, true);
auto p3 = make_lazy(proxyProvider, caps, rtParams, false);
@@ -359,7 +357,7 @@
// Force the resource allocator to always believe it is over budget
context->setResourceCacheLimits(0, 0);
- const ProxyParams params = { 64, false, kRGBA_8888_SkColorType,
+ const ProxyParams params = { 64, GrRenderable::kNo, kRGBA_8888_SkColorType,
SkBackingFit::kExact, 0, kTopLeft_GrSurfaceOrigin,
SkBudgeted::kYes };
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 29b13d0..da9f7da 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -34,11 +34,6 @@
////////////////////////////////////////////////////////////////////////////////
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
- GrSurfaceDesc desc;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = gWidth;
- desc.fHeight = gHeight;
SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
SkCanvas* canvas = surface->getCanvas();
@@ -97,13 +92,12 @@
static sk_sp<GrRenderTarget> create_RT_with_SB(GrResourceProvider* provider,
int size, int sampleCount, SkBudgeted budgeted) {
GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = size;
desc.fHeight = size;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = sampleCount;
- sk_sp<GrTexture> tex(provider->createTexture(desc, budgeted,
+ sk_sp<GrTexture> tex(provider->createTexture(desc, GrRenderable::kYes, budgeted,
GrResourceProvider::Flags::kNoPendingIO));
if (!tex || !tex->asRenderTarget()) {
return nullptr;
@@ -1615,37 +1609,35 @@
////////////////////////////////////////////////////////////////////////////////
static sk_sp<GrTexture> make_normal_texture(GrResourceProvider* provider,
- GrSurfaceDescFlags descFlags,
+ GrRenderable renderable,
int width, int height,
int sampleCnt) {
GrSurfaceDesc desc;
- desc.fFlags = descFlags;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = sampleCnt;
- return provider->createTexture(desc, SkBudgeted::kYes,
+ return provider->createTexture(desc, renderable, SkBudgeted::kYes,
GrResourceProvider::Flags::kNoPendingIO);
}
static sk_sp<GrTextureProxy> make_mipmap_proxy(GrProxyProvider* proxyProvider,
const GrCaps* caps,
- GrSurfaceDescFlags descFlags,
+ GrRenderable renderable,
int width, int height,
int sampleCnt) {
GrSurfaceDesc desc;
- desc.fFlags = descFlags;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = sampleCnt;
const GrBackendFormat format = caps->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
- auto origin = (descFlags & kRenderTarget_GrSurfaceFlag) ? kBottomLeft_GrSurfaceOrigin
- : kTopLeft_GrSurfaceOrigin;
+ auto origin = renderable == GrRenderable::kYes ? kBottomLeft_GrSurfaceOrigin
+ : kTopLeft_GrSurfaceOrigin;
- return proxyProvider->createMipMapProxy(format, desc, origin, SkBudgeted::kYes);
+ return proxyProvider->createMipMapProxy(format, desc, renderable, origin, SkBudgeted::kYes);
}
// Exercise GrSurface::gpuMemorySize for different combos of MSAA, RT-only,
@@ -1661,14 +1653,14 @@
{
sk_sp<GrTexture> tex;
- tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 1);
+ tex = make_normal_texture(resourceProvider, GrRenderable::kYes, kSize, kSize, 1);
size_t size = tex->gpuMemorySize();
REPORTER_ASSERT(reporter, kSize*kSize*4 == size);
size_t sampleCount = (size_t)context->priv().caps()->getRenderTargetSampleCount(
4, kRGBA_8888_GrPixelConfig);
if (sampleCount >= 4) {
- tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize,
+ tex = make_normal_texture(resourceProvider, GrRenderable::kYes, kSize, kSize,
sampleCount);
size = tex->gpuMemorySize();
REPORTER_ASSERT(reporter,
@@ -1677,7 +1669,7 @@
kSize*kSize*4*(sampleCount+1) == size); // explicit resolve buffer
}
- tex = make_normal_texture(resourceProvider, kNone_GrSurfaceFlags, kSize, kSize, 1);
+ tex = make_normal_texture(resourceProvider, GrRenderable::kNo, kSize, kSize, 1);
size = tex->gpuMemorySize();
REPORTER_ASSERT(reporter, kSize*kSize*4 == size);
}
@@ -1688,16 +1680,15 @@
if (caps->mipMapSupport()) {
sk_sp<GrTextureProxy> proxy;
- proxy = make_mipmap_proxy(proxyProvider, caps, kRenderTarget_GrSurfaceFlag, kSize, kSize,
- 1);
+ proxy = make_mipmap_proxy(proxyProvider, caps, GrRenderable::kYes, kSize, kSize, 1);
size_t size = proxy->gpuMemorySize();
REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size);
size_t sampleCount = (size_t)context->priv().caps()->getRenderTargetSampleCount(
4, kRGBA_8888_GrPixelConfig);
if (sampleCount >= 4) {
- proxy = make_mipmap_proxy(proxyProvider, caps, kRenderTarget_GrSurfaceFlag, kSize,
- kSize, sampleCount);
+ proxy = make_mipmap_proxy(proxyProvider, caps, GrRenderable::kYes, kSize, kSize,
+ sampleCount);
size = proxy->gpuMemorySize();
REPORTER_ASSERT(reporter,
kSize*kSize*4+(kSize*kSize*4)/3 == size || // msaa4 failed
@@ -1705,7 +1696,7 @@
kSize*kSize*4*(sampleCount+1)+(kSize*kSize*4)/3 == size); // explicit resolve buffer
}
- proxy = make_mipmap_proxy(proxyProvider, caps, kNone_GrSurfaceFlags, kSize, kSize, 1);
+ proxy = make_mipmap_proxy(proxyProvider, caps, GrRenderable::kNo, kSize, kSize, 1);
size = proxy->gpuMemorySize();
REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size);
}
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index 76360e3..1c6b36c 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -220,9 +220,8 @@
{
// gpu
sk_sp<SkImage> rasterImage = SkImage::MakeFromBitmap(bm);
- sk_sp<GrTextureProxy> proxy =
- proxyProvider->createTextureProxy(rasterImage, kNone_GrSurfaceFlags, 1,
- SkBudgeted::kNo, SkBackingFit::kExact);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
+ rasterImage, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact);
if (!proxy) {
return;
}
@@ -253,9 +252,8 @@
SkBitmap bm = create_bm();
sk_sp<SkImage> rasterImage = SkImage::MakeFromBitmap(bm);
- sk_sp<GrTextureProxy> proxy =
- proxyProvider->createTextureProxy(rasterImage, kNone_GrSurfaceFlags, 1,
- SkBudgeted::kNo, SkBackingFit::kExact);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
+ rasterImage, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact);
if (!proxy) {
return;
}
diff --git a/tests/TextureBindingsResetTest.cpp b/tests/TextureBindingsResetTest.cpp
index 51ecd84..670dd94 100644
--- a/tests/TextureBindingsResetTest.cpp
+++ b/tests/TextureBindingsResetTest.cpp
@@ -74,7 +74,7 @@
GrSurfaceDesc desc;
desc.fWidth = desc.fHeight = 10;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- auto tex = gpu->createTexture(desc, SkBudgeted::kNo);
+ auto tex = gpu->createTexture(desc, GrRenderable::kNo, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, tex);
context->resetGLTextureBindings();
checkBindings();
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index b85032e..e4f1104 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -24,9 +24,8 @@
return fUniquelyKeyedProxies.count();
}
-static GrSurfaceDesc make_desc(GrSurfaceDescFlags descFlags) {
+static GrSurfaceDesc make_desc() {
GrSurfaceDesc desc;
- desc.fFlags = descFlags;
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -40,13 +39,12 @@
static sk_sp<GrTextureProxy> deferred_tex(skiatest::Reporter* reporter, GrContext* ctx,
GrProxyProvider* proxyProvider, SkBackingFit fit) {
- const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
+ const GrSurfaceDesc desc = make_desc();
GrBackendFormat format =
ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
- sk_sp<GrTextureProxy> proxy =
- proxyProvider->createProxy(format, desc, kBottomLeft_GrSurfaceOrigin, fit,
- SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
+ format, desc, GrRenderable::kNo, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@@ -54,13 +52,12 @@
static sk_sp<GrTextureProxy> deferred_texRT(skiatest::Reporter* reporter, GrContext* ctx,
GrProxyProvider* proxyProvider, SkBackingFit fit) {
- const GrSurfaceDesc desc = make_desc(kRenderTarget_GrSurfaceFlag);
+ const GrSurfaceDesc desc = make_desc();
GrBackendFormat format =
ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
- sk_sp<GrTextureProxy> proxy =
- proxyProvider->createProxy(format, desc, kBottomLeft_GrSurfaceOrigin, fit,
- SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
+ format, desc, GrRenderable::kYes, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@@ -68,10 +65,10 @@
static sk_sp<GrTextureProxy> wrapped(skiatest::Reporter* reporter, GrContext* ctx,
GrProxyProvider* proxyProvider, SkBackingFit fit) {
- const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
+ const GrSurfaceDesc desc = make_desc();
sk_sp<GrTextureProxy> proxy = proxyProvider->testingOnly_createInstantiatedProxy(
- desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
+ desc, GrRenderable::kNo, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@@ -88,11 +85,11 @@
builder[0] = kUniqueKeyData++;
builder.finish();
- const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
+ const GrSurfaceDesc desc = make_desc();
// Only budgeted & wrapped external proxies get to carry uniqueKeys
sk_sp<GrTextureProxy> proxy = proxyProvider->testingOnly_createInstantiatedProxy(
- desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
+ desc, GrRenderable::kNo, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
SkAssertResult(proxyProvider->assignUniqueKeyToProxy(key, proxy.get()));
REPORTER_ASSERT(reporter, proxy->getUniqueKey().isValid());
return proxy;
@@ -103,9 +100,9 @@
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
GrResourceProvider* resourceProvider = context->priv().resourceProvider();
- const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
+ const GrSurfaceDesc desc = make_desc();
- *backingSurface = resourceProvider->createTexture(desc, SkBudgeted::kNo,
+ *backingSurface = resourceProvider->createTexture(desc, GrRenderable::kNo, SkBudgeted::kNo,
GrResourceProvider::Flags::kNoPendingIO);
if (!(*backingSurface)) {
return nullptr;
diff --git a/tests/TraceMemoryDumpTest.cpp b/tests/TraceMemoryDumpTest.cpp
index 5422bc4..dcff954 100644
--- a/tests/TraceMemoryDumpTest.cpp
+++ b/tests/TraceMemoryDumpTest.cpp
@@ -86,7 +86,6 @@
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
GrSurfaceDesc desc;
- desc.fFlags = kNone_GrSurfaceFlags;
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -112,7 +111,6 @@
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
GrSurfaceDesc desc;
- desc.fFlags = kNone_GrSurfaceFlags;
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -141,7 +139,6 @@
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
GrSurfaceDesc sd;
- sd.fFlags = kRenderTarget_GrSurfaceFlag;
sd.fWidth = 64;
sd.fHeight = 64;
sd.fConfig = kRGBA_8888_GrPixelConfig;
@@ -162,7 +159,6 @@
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
GrSurfaceDesc sd;
- sd.fFlags = kRenderTarget_GrSurfaceFlag;
sd.fWidth = 64;
sd.fHeight = 64;
sd.fConfig = kRGBA_8888_GrPixelConfig;
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index 44dcbfc..5d410dc 100644
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -69,7 +69,7 @@
}
void basic_transfer_to_test(skiatest::Reporter* reporter, GrContext* context, GrColorType colorType,
- bool renderTarget) {
+ GrRenderable renderable) {
if (GrCaps::kNone_MapFlags == context->priv().caps()->mapBufferFlags()) {
return;
}
@@ -81,8 +81,8 @@
return;
}
- if ((renderTarget && !caps->isFormatRenderable(colorType, backendFormat))) {
- return;
+ if ((renderable == GrRenderable::kYes && !caps->isFormatRenderable(colorType, backendFormat))) {
+ return;
}
auto resourceProvider = context->priv().resourceProvider();
@@ -94,13 +94,12 @@
const int kBufferHeight = 16;
GrSurfaceDesc desc;
- desc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
desc.fWidth = kTextureWidth;
desc.fHeight = kTextureHeight;
desc.fConfig = GrColorTypeToPixelConfig(colorType);
desc.fSampleCnt = 1;
- sk_sp<GrTexture> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo,
+ sk_sp<GrTexture> tex = resourceProvider->createTexture(desc, renderable, SkBudgeted::kNo,
GrResourceProvider::Flags::kNoPendingIO);
if (!tex) {
ERRORF(reporter, "Could not create texture");
@@ -192,7 +191,7 @@
}
void basic_transfer_from_test(skiatest::Reporter* reporter, const sk_gpu_test::ContextInfo& ctxInfo,
- GrColorType colorType, bool renderTarget) {
+ GrColorType colorType, GrRenderable renderable) {
auto context = ctxInfo.grContext();
auto caps = context->priv().caps();
if (GrCaps::kNone_MapFlags == caps->mapBufferFlags()) {
@@ -214,14 +213,14 @@
// create texture
GrSurfaceDesc desc;
- desc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
desc.fWidth = kTextureWidth;
desc.fHeight = kTextureHeight;
desc.fConfig = GrColorTypeToPixelConfig(colorType);
desc.fSampleCnt = 1;
if (!context->priv().caps()->isConfigTexturable(desc.fConfig) ||
- (renderTarget && !context->priv().caps()->isConfigRenderable(desc.fConfig))) {
+ (renderable == GrRenderable::kYes &&
+ !context->priv().caps()->isConfigRenderable(desc.fConfig))) {
return;
}
@@ -233,7 +232,8 @@
GrMipLevel data;
data.fPixels = textureData.get();
data.fRowBytes = textureDataRowBytes;
- sk_sp<GrTexture> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo, &data, 1);
+ sk_sp<GrTexture> tex =
+ resourceProvider->createTexture(desc, renderable, SkBudgeted::kNo, &data, 1);
if (!tex) {
return;
}
@@ -359,15 +359,12 @@
if (!ctxInfo.grContext()->priv().caps()->transferBufferSupport()) {
return;
}
- // RGBA
- basic_transfer_to_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888, false);
- basic_transfer_to_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888, true);
- basic_transfer_to_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888_SRGB, false);
- basic_transfer_to_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888_SRGB, true);
-
- // BGRA
- basic_transfer_to_test(reporter, ctxInfo.grContext(), GrColorType::kBGRA_8888, false);
- basic_transfer_to_test(reporter, ctxInfo.grContext(), GrColorType::kBGRA_8888, true);
+ for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
+ for (auto colorType :
+ {GrColorType::kRGBA_8888, GrColorType::kRGBA_8888_SRGB, GrColorType::kBGRA_8888}) {
+ basic_transfer_to_test(reporter, ctxInfo.grContext(), colorType, renderable);
+ }
+ }
}
// TODO(bsalomon): Metal
@@ -375,13 +372,10 @@
if (!ctxInfo.grContext()->priv().caps()->transferBufferSupport()) {
return;
}
- // RGBA
- basic_transfer_from_test(reporter, ctxInfo, GrColorType::kRGBA_8888, false);
- basic_transfer_from_test(reporter, ctxInfo, GrColorType::kRGBA_8888, true);
- basic_transfer_from_test(reporter, ctxInfo, GrColorType::kRGBA_8888_SRGB, false);
- basic_transfer_from_test(reporter, ctxInfo, GrColorType::kRGBA_8888_SRGB, true);
-
- // BGRA
- basic_transfer_from_test(reporter, ctxInfo, GrColorType::kBGRA_8888, false);
- basic_transfer_from_test(reporter, ctxInfo, GrColorType::kBGRA_8888, true);
+ for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
+ for (auto colorType :
+ {GrColorType::kRGBA_8888, GrColorType::kRGBA_8888_SRGB, GrColorType::kBGRA_8888}) {
+ basic_transfer_from_test(reporter, ctxInfo, colorType, renderable);
+ }
+ }
}
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index cb31108..84f8144 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -523,7 +523,6 @@
{
// Seed the resource cached with a scratch texture that will be reused by writePixels
GrSurfaceDesc desc;
- desc.fFlags = kNone_GrSurfaceFlags;
desc.fWidth = 32;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -532,7 +531,8 @@
context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
sk_sp<GrTextureProxy> temp = proxyProvider->createProxy(
- format, desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
+ format, desc, GrRenderable::kNo, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox,
+ SkBudgeted::kYes);
temp->instantiate(context->priv().resourceProvider());
}
diff --git a/tools/fiddle/fiddle_main.cpp b/tools/fiddle/fiddle_main.cpp
index 4e01a96..ae97cdb 100644
--- a/tools/fiddle/fiddle_main.cpp
+++ b/tools/fiddle/fiddle_main.cpp
@@ -127,7 +127,6 @@
auto resourceProvider = context->priv().resourceProvider();
GrSurfaceDesc backingDesc;
- backingDesc.fFlags = kNone_GrSurfaceFlags;
backingDesc.fWidth = bm.width();
backingDesc.fHeight = bm.height();
// This config must match the SkColorType used in draw.cpp in the SkImage and Surface factories
@@ -164,8 +163,8 @@
texels[i].fRowBytes = 0;
}
- backingTexture = resourceProvider->createTexture(backingDesc, SkBudgeted::kNo, texels.get(),
- mipLevelCount);
+ backingTexture = resourceProvider->createTexture(
+ backingDesc, GrRenderable::kNo, SkBudgeted::kNo, texels.get(), mipLevelCount);
if (!backingTexture) {
return false;
}
@@ -176,7 +175,6 @@
}
}
- backingDesc.fFlags = kRenderTarget_GrSurfaceFlag;
backingDesc.fWidth = options.fOffScreenWidth;
backingDesc.fHeight = options.fOffScreenHeight;
backingDesc.fSampleCnt = options.fOffScreenSampleCount;
@@ -191,8 +189,8 @@
// We use this fact to initialize it with data but don't allow mipmaps
GrMipLevel level0 = { data.get(), backingDesc.fWidth*sizeof(uint32_t) };
- sk_sp<GrTexture> tmp = resourceProvider->createTexture(backingDesc, SkBudgeted::kNo,
- &level0, 1);
+ sk_sp<GrTexture> tmp = resourceProvider->createTexture(backingDesc, GrRenderable::kYes,
+ SkBudgeted::kNo, &level0, 1);
if (!tmp || !tmp->asRenderTarget()) {
return false;
}
@@ -219,8 +217,8 @@
texels[i].fRowBytes = 0;
}
- backingTextureRenderTarget = resourceProvider->createTexture(backingDesc, SkBudgeted::kNo,
- texels.get(), mipLevelCount);
+ backingTextureRenderTarget = resourceProvider->createTexture(
+ backingDesc, GrRenderable::kYes, SkBudgeted::kNo, texels.get(), mipLevelCount);
if (!backingTextureRenderTarget || !backingTextureRenderTarget->asRenderTarget()) {
return false;
}
diff --git a/tools/gpu/ProxyUtils.cpp b/tools/gpu/ProxyUtils.cpp
index e592b02..6a2fe74 100644
--- a/tools/gpu/ProxyUtils.cpp
+++ b/tools/gpu/ProxyUtils.cpp
@@ -68,10 +68,8 @@
desc.fConfig = config;
desc.fWidth = width;
desc.fHeight = height;
- desc.fFlags = GrRenderable::kYes == renderable ? kRenderTarget_GrSurfaceFlag
- : kNone_GrSurfaceFlags;
proxy = context->priv().proxyProvider()->createProxy(
- format, desc, origin, SkBackingFit::kExact, SkBudgeted::kYes);
+ format, desc, renderable, origin, SkBackingFit::kExact, SkBudgeted::kYes);
if (!proxy) {
return nullptr;
}