Revert "Remove GrBackendFormat's textureType use from isFormatTexturable call."

This reverts commit 832c817bc8.

Reason for revert: uninitialized value in GrBackendTexture

Original change's description:
> Remove GrBackendFormat's textureType use from isFormatTexturable call.
>
> The goal of this change was to remove the use of GrBackendFormat::textureType()
> from GrCaps::isFormatTexturable call. Instead we will always pass in a
> GrTextureType into this call.
>
> To do this a lot of plumbing of GrTextureType was added to various call
> sites. However, this CL halts the plubming up at the proxy level where we
> get it from the GrBackendFormat still. Future CLs will continue removing
> these call sites and others that use GrBackendFormat::textureType().
>
> Bug: skia:12342
> Change-Id: Ic0f02b9c7f7402405623b8aa31aa32a9a7c22297
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439277
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: I354bbbf00be7a86c480009f3e7b36a8777a6bf3a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439338
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2021-08-13 20:05:08 +00:00 committed by SkCQ
parent 832c817bc8
commit d90777ada3
42 changed files with 161 additions and 355 deletions

View File

@ -47,16 +47,9 @@ static GrSurfaceProxyView create_view(GrDirectContext* dContext,
GrMipLevel mipLevel = {src.getPixels(), src.rowBytes(), nullptr};
auto colorType = SkColorTypeToGrColorType(src.colorType());
return rp->createTexture(src.dimensions(),
desc.fFormat,
desc.fFormat.textureType(),
colorType,
desc.fRenderable,
desc.fSampleCnt,
desc.fBudgeted,
desc.fFit,
desc.fProtected,
mipLevel);
return rp->createTexture(src.dimensions(), desc.fFormat, colorType,
desc.fRenderable, desc.fSampleCnt, desc.fBudgeted,
desc.fFit, desc.fProtected, mipLevel);
},
format, GrRenderable::kNo, 1, GrProtected::kNo, *dContext->priv().caps(),
GrSurfaceProxy::UseAllocator::kYes);

View File

@ -288,7 +288,6 @@ public:
/** deprecated alias of hasMipmaps(). */
bool hasMipMaps() const { return this->hasMipmaps(); }
GrBackendApi backend() const {return fBackend; }
GrTextureType textureType() const { return fTextureType; }
// If the backend API is GL, copies a snapshot of the GrGLTextureInfo struct into the passed in
// pointer and returns true. Otherwise returns false if the backend API is not GL.
@ -398,7 +397,6 @@ private:
int fHeight; //<! height in pixels
GrMipmapped fMipmapped;
GrBackendApi fBackend;
GrTextureType fTextureType;
union {
#ifdef SK_GL

View File

@ -82,27 +82,27 @@ GrBackendFormat& GrBackendFormat::operator=(const GrBackendFormat& that) {
}
#ifdef SK_GL
static GrTextureType gl_target_to_gr_target(GrGLenum target) {
switch (target) {
case GR_GL_TEXTURE_NONE:
return GrTextureType::kNone;
case GR_GL_TEXTURE_2D:
return GrTextureType::k2D;
case GR_GL_TEXTURE_RECTANGLE:
return GrTextureType::kRectangle;
case GR_GL_TEXTURE_EXTERNAL:
return GrTextureType::kExternal;
default:
SkUNREACHABLE;
}
}
GrBackendFormat::GrBackendFormat(GrGLenum format, GrGLenum target)
: fBackend(GrBackendApi::kOpenGL)
, fValid(true)
, fGLFormat(format)
, fTextureType(gl_target_to_gr_target(target)) {}
, fGLFormat(format) {
switch (target) {
case GR_GL_TEXTURE_NONE:
fTextureType = GrTextureType::kNone;
break;
case GR_GL_TEXTURE_2D:
fTextureType = GrTextureType::k2D;
break;
case GR_GL_TEXTURE_RECTANGLE:
fTextureType = GrTextureType::kRectangle;
break;
case GR_GL_TEXTURE_EXTERNAL:
fTextureType = GrTextureType::kExternal;
break;
default:
SK_ABORT("Unexpected texture target");
}
}
#endif
GrGLFormat GrBackendFormat::asGLFormat() const {
@ -455,7 +455,6 @@ GrBackendTexture::GrBackendTexture(int width,
, fHeight(height)
, fMipmapped(GrMipmapped(dawnInfo.fLevelCount > 1))
, fBackend(GrBackendApi::kDawn)
, fTextureType(GrTextureType::k2D)
, fDawnInfo(dawnInfo) {}
#endif
@ -484,13 +483,6 @@ static GrVkImageInfo apply_default_usage_flags(const GrVkImageInfo& info,
return info;
}
static GrTextureType vk_image_info_to_texture_type(const GrVkImageInfo& info) {
if (info.fYcbcrConversionInfo.isValid() && info.fYcbcrConversionInfo.fExternalFormat != 0) {
return GrTextureType::kExternal;
}
return GrTextureType::k2D;
}
GrBackendTexture::GrBackendTexture(int width,
int height,
const GrVkImageInfo& vkInfo,
@ -500,7 +492,6 @@ GrBackendTexture::GrBackendTexture(int width,
, fHeight(height)
, fMipmapped(GrMipmapped(vkInfo.fLevelCount > 1))
, fBackend(GrBackendApi::kVulkan)
, fTextureType(vk_image_info_to_texture_type(vkInfo))
, fVkInfo(apply_default_usage_flags(vkInfo, kDefaultTexRTUsageFlags))
, fMutableState(std::move(mutableState)) {}
#endif
@ -516,7 +507,6 @@ GrBackendTexture::GrBackendTexture(int width,
, fHeight(height)
, fMipmapped(mipmapped)
, fBackend(GrBackendApi::kOpenGL)
, fTextureType(gl_target_to_gr_target(glInfo.fTarget))
, fGLInfo(glInfo, params.release()) {}
sk_sp<GrGLTextureParameters> GrBackendTexture::getGLTextureParams() const {
@ -537,7 +527,6 @@ GrBackendTexture::GrBackendTexture(int width,
, fHeight(height)
, fMipmapped(mipmapped)
, fBackend(GrBackendApi::kMetal)
, fTextureType(GrTextureType::k2D)
, fMtlInfo(mtlInfo) {}
#endif
@ -557,7 +546,6 @@ GrBackendTexture::GrBackendTexture(int width,
, fHeight(height)
, fMipmapped(GrMipmapped(d3dInfo.fLevelCount > 1))
, fBackend(GrBackendApi::kDirect3D)
, fTextureType(GrTextureType::k2D)
, fD3DInfo(d3dInfo, state.release()) {}
#endif
@ -581,7 +569,6 @@ GrBackendTexture::GrBackendTexture(int width,
, fHeight(height)
, fMipmapped(mipmapped)
, fBackend(GrBackendApi::kMock)
, fTextureType(GrTextureType::k2D)
, fMockInfo(mockInfo) {}
GrBackendTexture::~GrBackendTexture() {

View File

@ -309,11 +309,9 @@ bool GrCaps::canCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src
bool GrCaps::validateSurfaceParams(const SkISize& dimensions, const GrBackendFormat& format,
GrRenderable renderable, int renderTargetSampleCnt,
GrMipmapped mipped, GrTextureType textureType) const {
if (textureType != GrTextureType::kNone) {
if (!this->isFormatTexturable(format, textureType)) {
return false;
}
GrMipmapped mipped) const {
if (!this->isFormatTexturable(format)) {
return false;
}
if (GrMipmapped::kYes == mipped && !this->mipmapSupport()) {
@ -388,7 +386,7 @@ GrBackendFormat GrCaps::getDefaultBackendFormat(GrColorType colorType,
}
auto format = this->onGetDefaultBackendFormat(colorType);
if (!this->isFormatTexturable(format, GrTextureType::k2D)) {
if (!this->isFormatTexturable(format)) {
return {};
}
if (!this->areColorTypeAndFormatCompatible(colorType, format)) {

View File

@ -221,9 +221,8 @@ public:
bool isFormatCompressed(const GrBackendFormat& format) const;
// Can a texture be made with the GrBackendFormat and texture type, and then be bound and
// sampled in a shader.
virtual bool isFormatTexturable(const GrBackendFormat&, GrTextureType) const = 0;
// Can a texture be made with the GrBackendFormat, and then be bound and sampled in a shader.
virtual bool isFormatTexturable(const GrBackendFormat&) const = 0;
// Returns whether a texture of the given format can be copied to a texture of the same format.
virtual bool isFormatCopyable(const GrBackendFormat&) const = 0;
@ -421,7 +420,7 @@ public:
}
bool validateSurfaceParams(const SkISize&, const GrBackendFormat&, GrRenderable renderable,
int renderTargetSampleCnt, GrMipmapped, GrTextureType) const;
int renderTargetSampleCnt, GrMipmapped) const;
bool areColorTypeAndFormatCompatible(GrColorType grCT, const GrBackendFormat& format) const;

View File

@ -99,7 +99,7 @@ SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization(
return {};
}
if (isTextureable && !fCaps->isFormatTexturable(backendFormat, backendFormat.textureType())) {
if (isTextureable && !fCaps->isFormatTexturable(backendFormat)) {
// Skia doesn't agree that this is textureable.
return {};
}
@ -158,7 +158,7 @@ GrBackendFormat GrContextThreadSafeProxy::compressedBackendFormat(SkImage::Compr
GrBackendFormat format = fCaps->getBackendFormatFromCompressionType(c);
SkASSERT(!format.isValid() || fCaps->isFormatTexturable(format, GrTextureType::k2D));
SkASSERT(!format.isValid() || fCaps->isFormatTexturable(format));
return format;
}

View File

@ -94,14 +94,8 @@ void GrDynamicAtlas::reset(SkISize initialSize, const GrCaps& caps) {
[this](GrResourceProvider* resourceProvider, const LazyAtlasDesc& desc) {
if (!fBackingTexture) {
fBackingTexture = resourceProvider->createTexture(
fTextureProxy->backingStoreDimensions(),
desc.fFormat,
desc.fFormat.textureType(),
desc.fRenderable,
desc.fSampleCnt,
desc.fMipmapped,
desc.fBudgeted,
desc.fProtected);
fTextureProxy->backingStoreDimensions(), desc.fFormat, desc.fRenderable,
desc.fSampleCnt, desc.fMipmapped, desc.fBudgeted, desc.fProtected);
}
return GrSurfaceProxy::LazyCallbackResult(fBackingTexture);
},

View File

@ -98,7 +98,6 @@ static bool validate_texel_levels(SkISize dimensions, GrColorType texelColorType
sk_sp<GrTexture> GrGpu::createTextureCommon(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
SkBudgeted budgeted,
@ -111,12 +110,8 @@ sk_sp<GrTexture> GrGpu::createTextureCommon(SkISize dimensions,
}
GrMipmapped mipMapped = mipLevelCount > 1 ? GrMipmapped::kYes : GrMipmapped::kNo;
if (!this->caps()->validateSurfaceParams(dimensions,
format,
renderable,
renderTargetSampleCnt,
mipMapped,
textureType)) {
if (!this->caps()->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
mipMapped)) {
return nullptr;
}
@ -152,7 +147,6 @@ sk_sp<GrTexture> GrGpu::createTextureCommon(SkISize dimensions,
sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrMipmapped mipMapped,
@ -165,15 +159,8 @@ sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
}
uint32_t levelClearMask =
this->caps()->shouldInitializeTextures() ? (1 << mipLevelCount) - 1 : 0;
auto tex = this->createTextureCommon(dimensions,
format,
textureType,
renderable,
renderTargetSampleCnt,
budgeted,
isProtected,
mipLevelCount,
levelClearMask);
auto tex = this->createTextureCommon(dimensions, format, renderable, renderTargetSampleCnt,
budgeted, isProtected, mipLevelCount, levelClearMask);
if (tex && mipMapped == GrMipmapped::kYes && levelClearMask) {
tex->markMipmapsClean();
}
@ -182,7 +169,6 @@ sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
SkBudgeted budgeted,
@ -213,15 +199,8 @@ sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
}
}
auto tex = this->createTextureCommon(dimensions,
format,
textureType,
renderable,
renderTargetSampleCnt,
budgeted,
isProtected,
texelLevelCount,
levelClearMask);
auto tex = this->createTextureCommon(dimensions, format, renderable, renderTargetSampleCnt,
budgeted, isProtected, texelLevelCount, levelClearMask);
if (tex) {
bool markMipLevelsClean = false;
// Currently if level 0 does not have pixels then no other level may, as enforced by
@ -266,16 +245,12 @@ sk_sp<GrTexture> GrGpu::createCompressedTexture(SkISize dimensions,
if (!data) {
return nullptr;
}
if (!this->caps()->isFormatTexturable(format)) {
return nullptr;
}
// TODO: expand CompressedDataIsCorrect to work here too
SkImage::CompressionType compressionType = GrBackendFormatToCompressionType(format);
if (compressionType == SkImage::CompressionType::kNone) {
return nullptr;
}
if (!this->caps()->isFormatTexturable(format, GrTextureType::k2D)) {
return nullptr;
}
if (dataSize < SkCompressedDataSize(compressionType, dimensions, nullptr,
mipMapped == GrMipmapped::kYes)) {
@ -295,7 +270,7 @@ sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTexture& backendTex,
const GrCaps* caps = this->caps();
SkASSERT(caps);
if (!caps->isFormatTexturable(backendTex.getBackendFormat(), backendTex.textureType())) {
if (!caps->isFormatTexturable(backendTex.getBackendFormat())) {
return nullptr;
}
if (backendTex.width() > caps->maxTextureSize() ||
@ -314,7 +289,7 @@ sk_sp<GrTexture> GrGpu::wrapCompressedBackendTexture(const GrBackendTexture& bac
const GrCaps* caps = this->caps();
SkASSERT(caps);
if (!caps->isFormatTexturable(backendTex.getBackendFormat(), backendTex.textureType())) {
if (!caps->isFormatTexturable(backendTex.getBackendFormat())) {
return nullptr;
}
if (backendTex.width() > caps->maxTextureSize() ||
@ -336,7 +311,7 @@ sk_sp<GrTexture> GrGpu::wrapRenderableBackendTexture(const GrBackendTexture& bac
const GrCaps* caps = this->caps();
if (!caps->isFormatTexturable(backendTex.getBackendFormat(), backendTex.textureType()) ||
if (!caps->isFormatTexturable(backendTex.getBackendFormat()) ||
!caps->isFormatRenderable(backendTex.getBackendFormat(), sampleCnt)) {
return nullptr;
}
@ -416,8 +391,7 @@ bool GrGpu::readPixels(GrSurface* surface,
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
SkASSERT(surface);
SkASSERT(!surface->framebufferOnly());
SkASSERT(this->caps()->areColorTypeAndFormatCompatible(surfaceColorType,
surface->backendFormat()));
SkASSERT(this->caps()->isFormatTexturable(surface->backendFormat()));
if (!SkIRect::MakeSize(surface->dimensions()).contains(rect)) {
return false;
@ -549,8 +523,7 @@ bool GrGpu::transferPixelsFrom(GrSurface* surface,
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
SkASSERT(surface);
SkASSERT(transferBuffer);
SkASSERT(this->caps()->areColorTypeAndFormatCompatible(surfaceColorType,
surface->backendFormat()));
SkASSERT(this->caps()->isFormatTexturable(surface->backendFormat()));
#ifdef SK_DEBUG
auto supportedRead = this->caps()->supportedReadPixelsColorType(

View File

@ -130,7 +130,6 @@ public:
*/
sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
SkBudgeted budgeted,
@ -145,7 +144,6 @@ public:
*/
sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrMipmapped mipMapped,
@ -800,7 +798,6 @@ private:
sk_sp<GrTexture> createTextureCommon(SkISize,
const GrBackendFormat&,
GrTextureType textureType,
GrRenderable,
int renderTargetSampleCnt,
SkBudgeted,

View File

@ -142,21 +142,11 @@ sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(dimensions,
format,
format.textureType(),
renderable,
renderTargetSampleCnt,
isProtected);
tex = resourceProvider->createApproxTexture(dimensions, format, renderable,
renderTargetSampleCnt, isProtected);
} else {
tex = resourceProvider->createTexture(dimensions,
format,
format.textureType(),
renderable,
renderTargetSampleCnt,
GrMipmapped::kNo,
budgeted,
isProtected);
tex = resourceProvider->createTexture(dimensions, format, renderable, renderTargetSampleCnt,
GrMipmapped::kNo, budgeted, isProtected);
}
if (!tex) {
return nullptr;
@ -337,16 +327,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createNonMippedProxyFromBitmap(const SkBi
GrMipLevel mipLevel = {bitmap.getPixels(), bitmap.rowBytes(), nullptr};
auto colorType = SkColorTypeToGrColorType(bitmap.colorType());
return LazyCallbackResult(resourceProvider->createTexture(
desc.fDimensions,
desc.fFormat,
desc.fFormat.textureType(),
colorType,
desc.fRenderable,
desc.fSampleCnt,
desc.fBudgeted,
desc.fFit,
desc.fProtected,
mipLevel));
desc.fDimensions, desc.fFormat, colorType, desc.fRenderable,
desc.fSampleCnt, desc.fBudgeted, desc.fFit, desc.fProtected, mipLevel));
},
format, dims, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
GrInternalSurfaceFlags::kNone, fit, budgeted, GrProtected::kNo, UseAllocator::kYes);
@ -393,16 +375,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createMippedProxyFromBitmap(const SkBitma
SkASSERT(generatedMipLevel.fPixmap.colorType() == bitmap.colorType());
}
return LazyCallbackResult(resourceProvider->createTexture(
desc.fDimensions,
desc.fFormat,
desc.fFormat.textureType(),
colorType,
GrRenderable::kNo,
1,
desc.fBudgeted,
GrMipMapped::kYes,
GrProtected::kNo,
texels.get()));
desc.fDimensions, desc.fFormat, colorType, GrRenderable::kNo, 1,
desc.fBudgeted, GrMipMapped::kYes, GrProtected::kNo, texels.get()));
},
format, dims, GrMipmapped::kYes, GrMipmapStatus::kValid, GrInternalSurfaceFlags::kNone,
SkBackingFit::kExact, budgeted, GrProtected::kNo, UseAllocator::kYes);
@ -446,12 +420,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
}
}
if (!caps->validateSurfaceParams(dimensions,
format,
renderable,
renderTargetSampleCnt,
mipMapped,
GrTextureType::k2D)) {
if (!caps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
mipMapped)) {
return nullptr;
}
GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipMapped)
@ -484,7 +454,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
GrBackendFormat format = this->caps()->getBackendFormatFromCompressionType(compressionType);
if (!this->caps()->isFormatTexturable(format, GrTextureType::k2D)) {
if (!this->caps()->isFormatTexturable(format)) {
return nullptr;
}

View File

@ -43,7 +43,6 @@ GrResourceProvider::GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSin
sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
@ -62,24 +61,14 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.fWidth, dimensions.fHeight) + 1;
}
if (!fCaps->validateSurfaceParams(dimensions,
format,
renderable,
renderTargetSampleCnt,
mipmapped,
textureType)) {
if (!fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
mipmapped)) {
return nullptr;
}
// Current rule is that you can provide no level data, just the base, or all the levels.
bool hasPixels = texels[0].fPixels;
auto scratch = this->getExactScratch(dimensions,
format,
textureType,
renderable,
renderTargetSampleCnt,
budgeted,
mipmapped,
isProtected);
auto scratch = this->getExactScratch(dimensions, format, renderable, renderTargetSampleCnt,
budgeted, mipmapped, isProtected);
if (scratch) {
if (!hasPixels) {
return scratch;
@ -96,33 +85,20 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
return nullptr;
}
}
return fGpu->createTexture(dimensions,
format,
textureType,
renderable,
renderTargetSampleCnt,
budgeted,
isProtected,
colorType,
tempColorType,
tmpTexels.get(),
return fGpu->createTexture(dimensions, format, renderable, renderTargetSampleCnt, budgeted,
isProtected, colorType, tempColorType, tmpTexels.get(),
numMipLevels);
}
sk_sp<GrTexture> GrResourceProvider::getExactScratch(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
SkBudgeted budgeted,
GrMipmapped mipmapped,
GrProtected isProtected) {
sk_sp<GrTexture> tex(this->findAndRefScratchTexture(dimensions,
format,
textureType,
renderable,
renderTargetSampleCnt,
mipmapped,
sk_sp<GrTexture> tex(this->findAndRefScratchTexture(dimensions, format, renderable,
renderTargetSampleCnt, mipmapped,
isProtected));
if (tex && SkBudgeted::kNo == budgeted) {
tex->resourcePriv().makeUnbudgeted();
@ -133,7 +109,6 @@ sk_sp<GrTexture> GrResourceProvider::getExactScratch(SkISize dimensions,
sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
@ -152,27 +127,19 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
return nullptr;
}
if (!fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
GrMipmapped::kNo, textureType)) {
GrMipmapped::kNo)) {
return nullptr;
}
auto tex = this->createApproxTexture(dimensions, format, textureType, renderable,
renderTargetSampleCnt, isProtected);
auto tex = this->createApproxTexture(dimensions, format, renderable, renderTargetSampleCnt,
isProtected);
if (!tex) {
return nullptr;
}
return this->writePixels(std::move(tex), colorType, dimensions, &mipLevel, 1);
} else {
return this->createTexture(dimensions,
format,
textureType,
colorType,
renderable,
renderTargetSampleCnt,
budgeted,
GrMipmapped::kNo,
isProtected,
&mipLevel);
return this->createTexture(dimensions, format, colorType, renderable, renderTargetSampleCnt,
budgeted, GrMipmapped::kNo, isProtected, &mipLevel);
}
}
@ -192,7 +159,6 @@ sk_sp<GrTexture> GrResourceProvider::createCompressedTexture(SkISize dimensions,
sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrMipmapped mipmapped,
@ -204,7 +170,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
}
if (!fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
mipmapped, textureType)) {
mipmapped)) {
return nullptr;
}
@ -214,26 +180,14 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
// TODO: Support GrMipmapped::kYes in scratch texture lookup here.
sk_sp<GrTexture> tex =
this->getExactScratch(dimensions,
format,
textureType,
renderable,
renderTargetSampleCnt,
budgeted,
mipmapped,
isProtected);
this->getExactScratch(dimensions, format, renderable, renderTargetSampleCnt, budgeted,
mipmapped, isProtected);
if (tex) {
return tex;
}
return fGpu->createTexture(dimensions,
format,
textureType,
renderable,
renderTargetSampleCnt,
mipmapped,
budgeted,
isProtected);
return fGpu->createTexture(dimensions, format, renderable, renderTargetSampleCnt, mipmapped,
budgeted, isProtected);
}
// Map 'value' to a larger multiple of 2. Values <= 'kMagicTol' will pop up to
@ -267,7 +221,6 @@ SkISize GrResourceProvider::MakeApprox(SkISize dimensions) {
sk_sp<GrTexture> GrResourceProvider::createApproxTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrProtected isProtected) {
@ -282,26 +235,20 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(SkISize dimensions,
SkASSERT(!this->caps()->isFormatCompressed(format));
if (!fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
GrMipmapped::kNo, textureType)) {
GrMipmapped::kNo)) {
return nullptr;
}
auto copyDimensions = MakeApprox(dimensions);
if (auto tex = this->findAndRefScratchTexture(copyDimensions, format, textureType, renderable,
if (auto tex = this->findAndRefScratchTexture(copyDimensions, format, renderable,
renderTargetSampleCnt, GrMipmapped::kNo,
isProtected)) {
return tex;
}
return fGpu->createTexture(copyDimensions,
format,
textureType,
renderable,
renderTargetSampleCnt,
GrMipmapped::kNo,
SkBudgeted::kYes,
isProtected);
return fGpu->createTexture(copyDimensions, format, renderable, renderTargetSampleCnt,
GrMipmapped::kNo, SkBudgeted::kYes, isProtected);
}
sk_sp<GrTexture> GrResourceProvider::findAndRefScratchTexture(const GrScratchKey& key) {
@ -319,7 +266,6 @@ sk_sp<GrTexture> GrResourceProvider::findAndRefScratchTexture(const GrScratchKey
sk_sp<GrTexture> GrResourceProvider::findAndRefScratchTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrMipmapped mipmapped,
@ -328,7 +274,7 @@ sk_sp<GrTexture> GrResourceProvider::findAndRefScratchTexture(SkISize dimensions
SkASSERT(!this->isAbandoned());
SkASSERT(!this->caps()->isFormatCompressed(format));
SkASSERT(fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
GrMipmapped::kNo, textureType));
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.
@ -650,12 +596,8 @@ sk_sp<GrAttachment> GrResourceProvider::getDiscardableMSAAAttachment(SkISize dim
return nullptr;
}
if (!fCaps->validateSurfaceParams(dimensions,
format,
GrRenderable::kYes,
sampleCnt,
GrMipmapped::kNo,
GrTextureType::kNone)) {
if (!fCaps->validateSurfaceParams(
dimensions, format, GrRenderable::kYes, sampleCnt, GrMipmapped::kNo)) {
return nullptr;
}
@ -691,12 +633,8 @@ sk_sp<GrAttachment> GrResourceProvider::makeMSAAAttachment(SkISize dimensions,
return nullptr;
}
if (!fCaps->validateSurfaceParams(dimensions,
format,
GrRenderable::kYes,
sampleCnt,
GrMipmapped::kNo,
GrTextureType::kNone)) {
if (!fCaps->validateSurfaceParams(dimensions, format, GrRenderable::kYes, sampleCnt,
GrMipmapped::kNo)) {
return nullptr;
}
@ -715,12 +653,8 @@ sk_sp<GrAttachment> GrResourceProvider::refScratchMSAAAttachment(SkISize dimensi
ASSERT_SINGLE_OWNER
SkASSERT(!this->isAbandoned());
SkASSERT(!this->caps()->isFormatCompressed(format));
SkASSERT(fCaps->validateSurfaceParams(dimensions,
format,
GrRenderable::kYes,
sampleCnt,
GrMipmapped::kNo,
GrTextureType::kNone));
SkASSERT(fCaps->validateSurfaceParams(dimensions, format, GrRenderable::kYes, sampleCnt,
GrMipmapped::kNo));
GrScratchKey key;
GrAttachment::ComputeScratchKey(*this->caps(), format, dimensions,

View File

@ -62,7 +62,6 @@ public:
*/
sk_sp<GrTexture> createApproxTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrProtected isProtected);
@ -70,7 +69,6 @@ public:
/** Create an exact fit texture with no initial data to upload. */
sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrMipmapped mipMapped,
@ -84,7 +82,6 @@ public:
*/
sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrTextureType textureType,
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
@ -100,7 +97,6 @@ public:
*/
sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat&,
GrTextureType textureType,
GrColorType srcColorType,
GrRenderable,
int renderTargetSampleCnt,
@ -116,7 +112,6 @@ public:
sk_sp<GrTexture> findAndRefScratchTexture(const GrScratchKey&);
sk_sp<GrTexture> findAndRefScratchTexture(SkISize dimensions,
const GrBackendFormat&,
GrTextureType textureType,
GrRenderable,
int renderTargetSampleCnt,
GrMipmapped,
@ -343,7 +338,6 @@ private:
*/
sk_sp<GrTexture> getExactScratch(SkISize dimensions,
const GrBackendFormat&,
GrTextureType,
GrRenderable,
int renderTargetSampleCnt,
SkBudgeted,

View File

@ -112,21 +112,11 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(GrResourceProvider* resourceP
sk_sp<GrSurface> surface;
if (SkBackingFit::kApprox == fFit) {
surface = resourceProvider->createApproxTexture(fDimensions,
fFormat,
fFormat.textureType(),
renderable,
sampleCnt,
surface = resourceProvider->createApproxTexture(fDimensions, fFormat, renderable, sampleCnt,
fIsProtected);
} else {
surface = resourceProvider->createTexture(fDimensions,
fFormat,
fFormat.textureType(),
renderable,
sampleCnt,
mipMapped,
fBudgeted,
fIsProtected);
surface = resourceProvider->createTexture(fDimensions, fFormat, renderable, sampleCnt,
mipMapped, fBudgeted, fIsProtected);
}
if (!surface) {
return nullptr;

View File

@ -783,7 +783,7 @@ bool GrD3DCaps::isFormatSRGB(const GrBackendFormat& format) const {
}
}
bool GrD3DCaps::isFormatTexturable(const GrBackendFormat& format, GrTextureType) const {
bool GrD3DCaps::isFormatTexturable(const GrBackendFormat& format) const {
DXGI_FORMAT dxgiFormat;
if (!format.asDxgiFormat(&dxgiFormat)) {
return false;

View File

@ -28,7 +28,7 @@ public:
bool isFormatSRGB(const GrBackendFormat&) const override;
bool isFormatTexturable(const GrBackendFormat&, GrTextureType) const override;
bool isFormatTexturable(const GrBackendFormat&) const override;
bool isFormatTexturable(DXGI_FORMAT) const;
bool isFormatCopyable(const GrBackendFormat&) const override { return true; }

View File

@ -687,7 +687,7 @@ bool GrD3DGpu::uploadToTexture(GrD3DTexture* tex,
GrColorType colorType,
const GrMipLevel* texels,
int mipLevelCount) {
SkASSERT(this->d3dCaps().isFormatTexturable(tex->dxgiFormat()));
SkASSERT(this->caps()->isFormatTexturable(tex->backendFormat()));
// The assumption is either that we have no mipmaps, or that our rect is the entire texture
SkASSERT(mipLevelCount == 1 || rect == SkIRect::MakeSize(tex->dimensions()));

View File

@ -37,7 +37,7 @@ bool GrDawnCaps::isFormatSRGB(const GrBackendFormat& format) const {
return false;
}
bool GrDawnCaps::isFormatTexturable(const GrBackendFormat& format, GrTextureType) const {
bool GrDawnCaps::isFormatTexturable(const GrBackendFormat& format) const {
// Currently, all the formats in GrDawnFormatToPixelConfig are texturable.
wgpu::TextureFormat dawnFormat;
return format.asDawnFormat(&dawnFormat);

View File

@ -27,7 +27,7 @@ public:
bool isFormatCopyable(const GrBackendFormat& format) const override { return true; }
bool isFormatTexturable(const GrBackendFormat& format, GrTextureType) const override;
bool isFormatTexturable(const GrBackendFormat& format) const override;
SupportedWrite supportedWritePixelsColorType(GrColorType surfaceColorType,
const GrBackendFormat& surfaceFormat,

View File

@ -4450,8 +4450,8 @@ bool GrGLCaps::isFormatSRGB(const GrBackendFormat& format) const {
return format.asGLFormat() == GrGLFormat::kSRGB8_ALPHA8;
}
bool GrGLCaps::isFormatTexturable(const GrBackendFormat& format, GrTextureType textureType) const {
if (textureType == GrTextureType::kRectangle && !this->rectangleTextureSupport()) {
bool GrGLCaps::isFormatTexturable(const GrBackendFormat& format) const {
if (format.textureType() == GrTextureType::kRectangle && !this->rectangleTextureSupport()) {
return false;
}
return this->isFormatTexturable(format.asGLFormat());

View File

@ -120,7 +120,7 @@ public:
bool isFormatSRGB(const GrBackendFormat&) const override;
bool isFormatTexturable(const GrBackendFormat&, GrTextureType) const override;
bool isFormatTexturable(const GrBackendFormat&) const override;
bool isFormatTexturable(GrGLFormat) const;
bool isFormatAsColorTypeRenderable(GrColorType ct, const GrBackendFormat& format,

View File

@ -51,7 +51,7 @@ public:
return GrGetColorTypeDesc(ct).encoding() == GrColorTypeEncoding::kSRGBUnorm;
}
bool isFormatTexturable(const GrBackendFormat& format, GrTextureType) const override {
bool isFormatTexturable(const GrBackendFormat& format) const override {
SkImage::CompressionType compression = format.asMockCompressionType();
if (compression != SkImage::CompressionType::kNone) {
return fOptions.fCompressedOptions[(int)compression].fTexturable;

View File

@ -229,7 +229,7 @@ GrBackendTexture GrMockGpu::onCreateBackendTexture(SkISize dimensions,
}
auto colorType = format.asMockColorType();
if (!this->caps()->isFormatTexturable(format, GrTextureType::k2D)) {
if (!this->caps()->isFormatTexturable(format)) {
return GrBackendTexture(); // invalid
}
@ -247,7 +247,7 @@ GrBackendTexture GrMockGpu::onCreateCompressedBackendTexture(
return {}; // should go through onCreateBackendTexture
}
if (!this->caps()->isFormatTexturable(format, GrTextureType::k2D)) {
if (!this->caps()->isFormatTexturable(format)) {
return {};
}

View File

@ -26,7 +26,7 @@ public:
bool isFormatSRGB(const GrBackendFormat&) const override;
bool isFormatTexturable(const GrBackendFormat&, GrTextureType) const override;
bool isFormatTexturable(const GrBackendFormat&) const override;
bool isFormatTexturable(MTLPixelFormat) const;
bool isFormatCopyable(const GrBackendFormat&) const override { return true; }

View File

@ -373,7 +373,7 @@ bool GrMtlCaps::isFormatSRGB(const GrBackendFormat& format) const {
return format_is_srgb(GrBackendFormatAsMTLPixelFormat(format));
}
bool GrMtlCaps::isFormatTexturable(const GrBackendFormat& format, GrTextureType) const {
bool GrMtlCaps::isFormatTexturable(const GrBackendFormat& format) const {
MTLPixelFormat mtlFormat = GrBackendFormatAsMTLPixelFormat(format);
return this->isFormatTexturable(mtlFormat);
}

View File

@ -366,7 +366,7 @@ bool GrMtlGpu::uploadToTexture(GrMtlTexture* tex,
GrColorType dataColorType,
const GrMipLevel texels[],
int mipLevelCount) {
SkASSERT(this->mtlCaps().isFormatTexturable(tex->mtlTexture().pixelFormat));
SkASSERT(this->caps()->isFormatTexturable(tex->backendFormat()));
// The assumption is either that we have no mipmaps, or that our rect is the entire texture
SkASSERT(mipLevelCount == 1 || rect == SkIRect::MakeSize(tex->dimensions()));
@ -475,7 +475,7 @@ bool GrMtlGpu::uploadToTexture(GrMtlTexture* tex,
}
bool GrMtlGpu::clearTexture(GrMtlTexture* tex, size_t bpp, uint32_t levelMask) {
SkASSERT(this->mtlCaps().isFormatTexturable(tex->mtlTexture().pixelFormat));
SkASSERT(this->mtlCaps().isFormatTexturable(tex->backendFormat()));
if (!levelMask) {
return true;
@ -645,7 +645,7 @@ sk_sp<GrTexture> GrMtlGpu::onCreateCompressedTexture(SkISize dimensions,
return nullptr;
}
SkASSERT(this->caps()->isFormatTexturable(format, GrTextureType::k2D));
SkASSERT(this->caps()->isFormatTexturable(format));
SkASSERT(data);
if (!check_max_blit_width(dimensions.width())) {

View File

@ -1411,7 +1411,7 @@ bool GrVkCaps::isFormatSRGB(const GrBackendFormat& format) const {
return format_is_srgb(vkFormat);
}
bool GrVkCaps::isFormatTexturable(const GrBackendFormat& format, GrTextureType) const {
bool GrVkCaps::isFormatTexturable(const GrBackendFormat& format) const {
VkFormat vkFormat;
if (!format.asVkFormat(&vkFormat)) {
return false;

View File

@ -36,7 +36,7 @@ public:
bool isFormatSRGB(const GrBackendFormat&) const override;
bool isFormatTexturable(const GrBackendFormat&, GrTextureType) const override;
bool isFormatTexturable(const GrBackendFormat&) const override;
bool isVkFormatTexturable(VkFormat) const;
bool isFormatCopyable(const GrBackendFormat&) const override { return true; }

View File

@ -442,7 +442,7 @@ static bool validate_backend_texture(const GrCaps* caps, const GrBackendTexture&
return false;
}
if (texturable && !caps->isFormatTexturable(backendFormat, tex.textureType())) {
if (texturable && !caps->isFormatTexturable(backendFormat)) {
return false;
}

View File

@ -798,11 +798,10 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest, reporter, ctxInfo) {
};
for (auto combo : combinations) {
for (GrTextureType textureType : {GrTextureType::k2D, GrTextureType::kRectangle}) {
GrGLenum target = textureType == GrTextureType::k2D ? GR_GL_TEXTURE_2D
: GR_GL_TEXTURE_RECTANGLE;
for (GrGLenum target : {GR_GL_TEXTURE_2D, GR_GL_TEXTURE_RECTANGLE}) {
GrBackendFormat format = GrBackendFormat::MakeGL(combo.fFormat, target);
if (!glCaps->isFormatTexturable(format, textureType)) {
if (!glCaps->isFormatTexturable(format)) {
continue;
}

View File

@ -295,7 +295,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CompressedBackendAllocationTest, reporter, ct
continue;
}
if (!caps->isFormatTexturable(format, GrTextureType::k2D)) {
if (!caps->isFormatTexturable(format)) {
continue;
}

View File

@ -36,8 +36,8 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) {
auto format = context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
GrRenderable::kYes);
sk_sp<GrSurface> texRT1 =
resourceProvider->createTexture(kDesc, format, GrTextureType::k2D, GrRenderable::kYes,
1, GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
resourceProvider->createTexture(kDesc, format, GrRenderable::kYes, 1, GrMipmapped::kNo,
SkBudgeted::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asRenderTarget());
REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asTexture());
@ -49,8 +49,8 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) {
static_cast<GrSurface*>(texRT1->asTexture()));
sk_sp<GrTexture> tex1 =
resourceProvider->createTexture(kDesc, format, GrTextureType::k2D, GrRenderable::kNo, 1,
GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
resourceProvider->createTexture(kDesc, format, GrRenderable::kNo, 1, GrMipmapped::kNo,
SkBudgeted::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget());
REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture());
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1.get()) == tex1->asTexture());
@ -100,8 +100,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
return rp->createCompressedTexture(dimensions, format, SkBudgeted::kNo,
GrMipmapped::kNo, GrProtected::kNo, data.get());
} else {
return rp->createTexture(dimensions, format, GrTextureType::k2D, renderable, 1,
GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
return rp->createTexture(dimensions, format, renderable, 1, GrMipmapped::kNo,
SkBudgeted::kNo, GrProtected::kNo);
}
};
@ -126,7 +126,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
// support check is working
{
bool isCompressed = caps->isFormatCompressed(combo.fFormat);
bool isTexturable = caps->isFormatTexturable(combo.fFormat, GrTextureType::k2D);
bool isTexturable = caps->isFormatTexturable(combo.fFormat);
sk_sp<GrSurface> tex = createTexture(kDims, combo.fColorType, combo.fFormat,
GrRenderable::kNo, resourceProvider);
@ -153,8 +153,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
bool isRenderable = caps->isFormatRenderable(combo.fFormat, 1);
sk_sp<GrSurface> tex = resourceProvider->createTexture(
kDims, combo.fFormat, GrTextureType::k2D, GrRenderable::kYes, 1,
GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
kDims, combo.fFormat, GrRenderable::kYes, 1, GrMipmapped::kNo, SkBudgeted::kNo,
GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
"ct:%s format:%s, tex:%d, isRenderable:%d",
GrColorTypeToStr(combo.fColorType), combo.fFormat.toStr().c_str(),
@ -166,8 +166,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
bool isRenderable = caps->isFormatRenderable(combo.fFormat, 2);
sk_sp<GrSurface> tex = resourceProvider->createTexture(
kDims, combo.fFormat, GrTextureType::k2D, GrRenderable::kYes, 2,
GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
kDims, combo.fFormat, GrRenderable::kYes, 2, GrMipmapped::kNo, SkBudgeted::kNo,
GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
"ct:%s format:%s, tex:%d, isRenderable:%d",
GrColorTypeToStr(combo.fColorType), combo.fFormat.toStr().c_str(),
@ -219,7 +219,7 @@ DEF_GPUTEST(InitialTextureClear, reporter, baseOptions) {
SkASSERT(combo.fColorType != GrColorType::kUnknown);
SkASSERT(combo.fFormat.isValid());
if (!caps->isFormatTexturable(combo.fFormat, GrTextureType::k2D)) {
if (!caps->isFormatTexturable(combo.fFormat)) {
continue;
}

View File

@ -92,14 +92,8 @@ public:
} else {
static constexpr SkISize kDimensions = {1234, 567};
sk_sp<GrTexture> texture = rp->createTexture(
kDimensions,
desc.fFormat,
desc.fFormat.textureType(),
desc.fRenderable,
desc.fSampleCnt,
desc.fMipmapped,
desc.fBudgeted,
desc.fProtected);
kDimensions, desc.fFormat, desc.fRenderable, desc.fSampleCnt,
desc.fMipmapped, desc.fBudgeted, desc.fProtected);
REPORTER_ASSERT(fTest->fReporter, texture);
return texture;
}
@ -245,14 +239,9 @@ DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) {
GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
GrRenderable::kNo);
auto tex = ctx->priv().resourceProvider()->createTexture({kSize, kSize},
format,
GrTextureType::k2D,
GrRenderable::kNo,
1,
GrMipmapped::kNo,
SkBudgeted::kNo,
GrProtected::kNo);
auto tex = ctx->priv().resourceProvider()->createTexture({kSize, kSize}, format,
GrRenderable::kNo, 1, GrMipmapped::kNo,
SkBudgeted::kNo, GrProtected::kNo);
using LazyInstantiationResult = GrSurfaceProxy::LazyCallbackResult;
for (bool doInstantiate : {true, false}) {
for (bool releaseCallback : {false, true}) {
@ -357,13 +346,8 @@ private:
*testExecuteValue = 1;
return {};
}
return {rp->createTexture(desc.fDimensions,
desc.fFormat,
desc.fFormat.textureType(),
desc.fRenderable,
desc.fSampleCnt,
desc.fMipmapped,
desc.fBudgeted,
return {rp->createTexture(desc.fDimensions, desc.fFormat, desc.fRenderable,
desc.fSampleCnt, desc.fMipmapped, desc.fBudgeted,
desc.fProtected),
true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},

View File

@ -61,9 +61,8 @@ DEF_GPUTEST_FOR_METAL_CONTEXT(MtlCopySurfaceTest, reporter, ctxInfo) {
GrBackendFormat backendFormat = GrBackendFormat::MakeMtl(drawable.texture.pixelFormat);
GrSurface* src = srcProxy->peekSurface();
sk_sp<GrTexture> dst =
gpu->createTexture({kWidth, kHeight}, backendFormat, GrTextureType::k2D,
GrRenderable::kNo, 1, GrMipmapped::kNo, SkBudgeted::kNo,
GrProtected::kNo);
gpu->createTexture({kWidth, kHeight}, backendFormat, GrRenderable::kNo, 1,
GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
bool result = gpu->copySurface(dst.get(), src, SkIRect::MakeXYWH(0, 0, kWidth, kHeight),
SkIPoint::Make(0, 0));

View File

@ -314,8 +314,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTextureFullCache, reporter, ctxIn
auto format = dContext->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
GrRenderable::kNo);
textures.emplace_back(dContext->priv().resourceProvider()->createTexture(
{100, 100}, format, GrTextureType::k2D, GrRenderable::kNo, 1, GrMipmapped::kNo,
SkBudgeted::kYes, GrProtected::kNo));
{100, 100}, format, GrRenderable::kNo, 1, GrMipmapped::kNo, SkBudgeted::kYes,
GrProtected::kNo));
REPORTER_ASSERT(reporter, textures[i]);
}

View File

@ -136,12 +136,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(
dims, format, GrTextureType::k2D, GrRenderable::kYes,
numSamples, GrProtected::kNo);
dims, format, GrRenderable::kYes, numSamples,
GrProtected::kNo);
} else {
tex = resourceProvider->createTexture(
dims, format, GrTextureType::k2D, GrRenderable::kYes,
numSamples, GrMipmapped::kNo, budgeted, GrProtected::kNo);
dims, format, GrRenderable::kYes, numSamples,
GrMipmapped::kNo, budgeted, GrProtected::kNo);
}
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
@ -172,12 +172,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(
dims, format, GrTextureType::k2D, GrRenderable::kNo,
numSamples, GrProtected::kNo);
dims, format, GrRenderable::kNo, numSamples,
GrProtected::kNo);
} else {
tex = resourceProvider->createTexture(
dims, format, GrTextureType::k2D, GrRenderable::kNo,
numSamples, GrMipmapped::kNo, budgeted, GrProtected::kNo);
dims, format, GrRenderable::kNo, numSamples,
GrMipmapped::kNo, budgeted, GrProtected::kNo);
}
sk_sp<GrTextureProxy> proxy(proxyProvider->createProxy(

View File

@ -91,7 +91,6 @@ static sk_sp<GrSurfaceProxy> make_fully_lazy(GrProxyProvider* proxyProvider, con
const GrBackendFormat format = caps->getDefaultBackendFormat(p.fColorType, p.fRenderable);
auto cb = [p](GrResourceProvider* provider, const GrSurfaceProxy::LazySurfaceDesc& desc) {
auto tex = provider->createTexture({p.fSize, p.fSize}, desc.fFormat,
desc.fFormat.textureType(),
desc.fRenderable, desc.fSampleCnt,
desc.fMipmapped, desc.fBudgeted,
desc.fProtected);
@ -107,7 +106,6 @@ static sk_sp<GrSurfaceProxy> make_lazy(GrProxyProvider* proxyProvider, const GrC
const GrBackendFormat format = caps->getDefaultBackendFormat(p.fColorType, p.fRenderable);
auto cb = [](GrResourceProvider* provider, const GrSurfaceProxy::LazySurfaceDesc& desc) {
auto tex = provider->createTexture(desc.fDimensions, desc.fFormat,
desc.fFormat.textureType(),
desc.fRenderable, desc.fSampleCnt,
desc.fMipmapped, desc.fBudgeted,
desc.fProtected);

View File

@ -89,9 +89,9 @@ static sk_sp<GrRenderTarget> create_RT_with_SB(GrResourceProvider* provider,
int size, int sampleCount, SkBudgeted budgeted) {
auto format =
provider->caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888, GrRenderable::kYes);
sk_sp<GrTexture> tex(provider->createTexture({size, size}, format, GrTextureType::k2D,
GrRenderable::kYes, sampleCount, GrMipmapped::kNo,
budgeted, GrProtected::kNo));
sk_sp<GrTexture> tex(provider->createTexture({size, size}, format, GrRenderable::kYes,
sampleCount, GrMipmapped::kNo, budgeted,
GrProtected::kNo));
if (!tex || !tex->asRenderTarget()) {
return nullptr;
}
@ -1687,8 +1687,8 @@ static sk_sp<GrTexture> make_normal_texture(GrResourceProvider* provider,
SkISize dims,
int sampleCnt) {
auto format = provider->caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888, renderable);
return provider->createTexture(dims, format, GrTextureType::k2D, renderable, sampleCnt,
GrMipmapped::kNo, SkBudgeted::kYes, GrProtected::kNo);
return provider->createTexture(dims, format, renderable, sampleCnt, GrMipmapped::kNo,
SkBudgeted::kYes, GrProtected::kNo);
}
static sk_sp<GrTextureProxy> make_mipmap_proxy(GrRecordingContext* rContext,

View File

@ -77,8 +77,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TextureBindingsResetTest, reporter, ctxInf
static constexpr SkISize kDims = {10, 10};
GrBackendFormat format = gpu->caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
GrRenderable::kNo);
auto tex = gpu->createTexture(kDims, format, GrTextureType::k2D, GrRenderable::kNo, 1,
GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
auto tex = gpu->createTexture(kDims, format, GrRenderable::kNo, 1, GrMipmapped::kNo,
SkBudgeted::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, tex);
dContext->resetGLTextureBindings();
checkBindings();

View File

@ -127,8 +127,8 @@ void basic_transfer_to_test(skiatest::Reporter* reporter,
const int kBufferHeight = 16;
sk_sp<GrTexture> tex =
resourceProvider->createTexture(kTexDims, backendFormat, GrTextureType::k2D, renderable,
1, GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
resourceProvider->createTexture(kTexDims, backendFormat, renderable, 1,
GrMipmapped::kNo, SkBudgeted::kNo, GrProtected::kNo);
if (!tex) {
ERRORF(reporter, "Could not create texture");
return;
@ -313,9 +313,8 @@ void basic_transfer_from_test(skiatest::Reporter* reporter, const sk_gpu_test::C
GrMipLevel data;
data.fPixels = textureData.get();
data.fRowBytes = textureDataRowBytes;
sk_sp<GrTexture> tex = resourceProvider->createTexture(kTexDims, format, GrTextureType::k2D,
colorType, renderable, 1,
SkBudgeted::kNo, GrMipMapped::kNo,
sk_sp<GrTexture> tex = resourceProvider->createTexture(kTexDims, format, colorType, renderable,
1, SkBudgeted::kNo, GrMipMapped::kNo,
GrProtected::kNo, &data);
if (!tex) {
return;

View File

@ -245,7 +245,7 @@ void DDLPromiseImageHelper::createCallbackContexts(GrDirectContext* direct) {
GrBackendFormat backendFormat = direct->defaultBackendFormat(baseLevel.colorType(),
GrRenderable::kNo);
if (!caps->isFormatTexturable(backendFormat, GrTextureType::k2D)) {
if (!caps->isFormatTexturable(backendFormat)) {
continue;
}

View File

@ -32,11 +32,12 @@ void DDLTileHelper::TileData::init(int id,
this->paddedRectSize().height());
SkASSERT(fPlaybackChar.isValid());
GrBackendFormat backendFormat = direct->defaultBackendFormat(fPlaybackChar.colorType(),
GrRenderable::kYes);
SkDEBUGCODE(const GrCaps* caps = direct->priv().caps());
SkASSERT(caps->isFormatTexturable(fPlaybackChar.backendFormat(),
fPlaybackChar.backendFormat().textureType()));
SkASSERT(caps->isFormatTexturable(backendFormat));
fCallbackContext.reset(new PromiseImageCallbackContext(direct, fPlaybackChar.backendFormat()));
fCallbackContext.reset(new PromiseImageCallbackContext(direct, backendFormat));
}
DDLTileHelper::TileData::TileData() {}

View File

@ -176,9 +176,8 @@ static bool setup_backend_objects(GrDirectContext* dContext,
constexpr int kSampleCnt = 0;
sk_sp<GrTexture> tmp = resourceProvider->createTexture(
offscreenDims, renderableFormat, GrTextureType::k2D, GrColorType::kRGBA_8888,
GrRenderable::kYes, kSampleCnt, SkBudgeted::kNo, GrMipMapped::kNo, GrProtected::kNo,
&level0);
offscreenDims, renderableFormat, GrColorType::kRGBA_8888, GrRenderable::kYes,
kSampleCnt, SkBudgeted::kNo, GrMipMapped::kNo, GrProtected::kNo, &level0);
if (!tmp || !tmp->asRenderTarget()) {
fputs("GrTexture is invalid.\n", stderr);
return false;