Remove GrSurfaceDesc
Replace with SkISize.
Also change some const SkISize& params to just SkISize.
Change-Id: I3c72d961662eefeda545fba17d63e877cd5ca813
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269374
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 78e1cfc..28d67a2 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -100,10 +100,6 @@
int width = this->getInfo().width();
int height = this->getInfo().height();
- GrSurfaceDesc desc;
- desc.fWidth = width;
- desc.fHeight = height;
-
GrTextureType textureType = GrTextureType::k2D;
if (context->backend() == GrBackendApi::kOpenGL) {
textureType = GrTextureType::kExternal;
@@ -183,7 +179,7 @@
return tex;
},
- backendFormat, desc, readSwizzle, GrRenderable::kNo, 1, fSurfaceOrigin,
+ backendFormat, {width, height}, readSwizzle, GrRenderable::kNo, 1, fSurfaceOrigin,
GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index f2a10a5..d9cbf6e 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -143,9 +143,6 @@
GrColorType grColorType = SkColorTypeToGrColorType(info.colorType());
- GrSurfaceDesc desc;
- desc.fWidth = fBackendTexture.width();
- desc.fHeight = fBackendTexture.height();
GrMipMapped mipMapped = fBackendTexture.hasMipMaps() ? GrMipMapped::kYes : GrMipMapped::kNo;
// Ganesh assumes that, when wrapping a mipmapped backend texture from a client, that its
@@ -197,15 +194,15 @@
// unrelated to the whatever SkImage key may be assigned to the proxy.
return {std::move(tex), true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
- backendFormat, desc, readSwizzle, GrRenderable::kNo, 1, fSurfaceOrigin, mipMapped,
- mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
- GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
+ backendFormat, fBackendTexture.dimensions(), readSwizzle, GrRenderable::kNo, 1,
+ fSurfaceOrigin, mipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly,
+ SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
+ GrSurfaceProxy::UseAllocator::kYes);
if (!proxy) {
return {};
}
- if (0 == origin.fX && 0 == origin.fY &&
- info.width() == fBackendTexture.width() && info.height() == fBackendTexture.height() &&
+ if (origin.isZero() && info.dimensions() == fBackendTexture.dimensions() &&
(!willNeedMipMaps || GrMipMapped::kYes == proxy->mipMapped())) {
// If the caller wants the entire texture and we have the correct mip support, we're done
return GrSurfaceProxyView(std::move(proxy), fSurfaceOrigin, readSwizzle);
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 4bfbf7a..3fc381a 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -479,10 +479,6 @@
if (taskGroup && renderTargetContext) {
// Create our texture proxy
- GrSurfaceDesc desc;
- desc.fWidth = maskSpaceIBounds.width();
- desc.fHeight = maskSpaceIBounds.height();
-
GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
GrRenderable::kNo);
@@ -491,7 +487,7 @@
// 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,
+ maskSpaceIBounds.size(),
swizzle,
GrRenderable::kNo,
1,
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index 18d4972..2ca5e6b 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -554,9 +554,7 @@
GrProxyProvider* proxyProvider, GenerationCounter* generationCounter) {
SkASSERT(SkIsPow2(fTextureWidth) && SkIsPow2(fTextureHeight));
- GrSurfaceDesc desc;
- desc.fWidth = fTextureWidth;
- desc.fHeight = fTextureHeight;
+ SkISize dims = {fTextureWidth, fTextureHeight};
int numPlotsX = fTextureWidth/fPlotWidth;
int numPlotsY = fTextureHeight/fPlotHeight;
@@ -564,7 +562,7 @@
for (uint32_t i = 0; i < this->maxPages(); ++i) {
GrSwizzle swizzle = proxyProvider->caps()->getReadSwizzle(fFormat, fColorType);
sk_sp<GrSurfaceProxy> proxy = proxyProvider->createProxy(
- fFormat, desc, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
+ fFormat, dims, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo,
GrInternalSurfaceFlags::kNone, GrSurfaceProxy::UseAllocator::kNo);
if (!proxy) {
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index b4fa68f..e46052b 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -102,12 +102,14 @@
return false;
}
-static bool validate_texel_levels(int w, int h, GrColorType texelColorType,
+static bool validate_texel_levels(SkISize dimensions, GrColorType texelColorType,
const GrMipLevel* texels, int mipLevelCount, const GrCaps* caps) {
SkASSERT(mipLevelCount > 0);
bool hasBasePixels = texels[0].fPixels;
int levelsWithPixelsCnt = 0;
auto bpp = GrColorTypeBytesPerPixel(texelColorType);
+ int w = dimensions.fWidth;
+ int h = dimensions.fHeight;
for (int currentMipLevel = 0; currentMipLevel < mipLevelCount; ++currentMipLevel) {
if (texels[currentMipLevel].fPixels) {
const size_t minRowBytes = w * bpp;
@@ -145,7 +147,7 @@
return levelsWithPixelsCnt == 1 || levelsWithPixelsCnt == mipLevelCount;
}
-sk_sp<GrTexture> GrGpu::createTextureCommon(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrGpu::createTextureCommon(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -159,8 +161,8 @@
}
GrMipMapped mipMapped = mipLevelCount > 1 ? GrMipMapped::kYes : GrMipMapped::kNo;
- if (!this->caps()->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, renderable,
- renderTargetSampleCnt, mipMapped)) {
+ if (!this->caps()->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
+ mipMapped)) {
return nullptr;
}
@@ -171,7 +173,7 @@
// Attempt to catch un- or wrongly initialized sample counts.
SkASSERT(renderTargetSampleCnt > 0 && renderTargetSampleCnt <= 64);
this->handleDirtyContext();
- auto tex = this->onCreateTexture(desc,
+ auto tex = this->onCreateTexture(dimensions,
format,
renderable,
renderTargetSampleCnt,
@@ -194,7 +196,7 @@
return tex;
}
-sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -203,19 +205,20 @@
GrProtected isProtected) {
int mipLevelCount = 1;
if (mipMapped == GrMipMapped::kYes) {
- mipLevelCount = 32 - SkCLZ(static_cast<uint32_t>(std::max(desc.fWidth, desc.fHeight)));
+ mipLevelCount =
+ 32 - SkCLZ(static_cast<uint32_t>(std::max(dimensions.fWidth, dimensions.fHeight)));
}
uint32_t levelClearMask =
this->caps()->shouldInitializeTextures() ? (1 << mipLevelCount) - 1 : 0;
- auto tex = this->createTextureCommon(desc, format, 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->texturePriv().markMipMapsClean();
}
return tex;
}
-sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -227,7 +230,7 @@
int texelLevelCount) {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
if (texelLevelCount) {
- if (!validate_texel_levels(desc.fWidth, desc.fHeight, srcColorType, texels, texelLevelCount,
+ if (!validate_texel_levels(dimensions, srcColorType, texels, texelLevelCount,
this->caps())) {
return nullptr;
}
@@ -247,15 +250,15 @@
}
}
- auto tex = this->createTextureCommon(desc, format, 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
// validate_texel_levels.
if (texelLevelCount && texels[0].fPixels) {
- if (!this->writePixels(tex.get(), 0, 0, desc.fWidth, desc.fHeight, textureColorType,
- srcColorType, texels, texelLevelCount)) {
+ if (!this->writePixels(tex.get(), 0, 0, dimensions.fWidth, dimensions.fHeight,
+ textureColorType, srcColorType, texels, texelLevelCount)) {
return nullptr;
}
// Currently if level[1] of mip map has pixel data then so must all other levels.
@@ -512,7 +515,8 @@
return false;
}
- if (!validate_texel_levels(width, height, srcColorType, texels, mipLevelCount, this->caps())) {
+ if (!validate_texel_levels({width, height}, srcColorType, texels, mipLevelCount,
+ this->caps())) {
return false;
}
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index d389f36..0cc7ccf 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -84,7 +84,7 @@
* 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 dimensions dimensions of the texture to be created.
* @param format the format for the texture (not currently used).
* @param renderable should the resulting texture be renderable
* @param renderTargetSampleCnt The number of samples to use for rendering if renderable is
@@ -93,7 +93,8 @@
* @param isProtected should the texture be created as protected.
* @param texels array of mipmap levels containing texel data to load.
* 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)).
+ * max(1, floor(dimensions.fWidth / 2)) by
+ * max(1, floor(dimensions.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
@@ -106,11 +107,12 @@
* of uploading texel data.
* @param srcColorType The color type of data in texels[].
* @param texelLevelCount 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.
+ * floor(max((log2(dimensions.fWidth), log2(dimensions.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& desc,
+ sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -124,7 +126,7 @@
/**
* Simplified createTexture() interface for when there is no initial texel data to upload.
*/
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc,
+ sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -665,7 +667,7 @@
// Texture size, renderablility, format support, sample count will have already been validated
// in base class before onCreateTexture is called.
// If the ith bit is set in levelClearMask then the ith MIP level should be cleared.
- virtual sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&,
+ virtual sk_sp<GrTexture> onCreateTexture(SkISize dimensions,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
@@ -739,7 +741,7 @@
virtual void onDumpJSON(SkJSONWriter*) const {}
#endif
- sk_sp<GrTexture> createTextureCommon(const GrSurfaceDesc&,
+ sk_sp<GrTexture> createTextureCommon(SkISize,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 24057b0..e6bf834 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -115,7 +115,7 @@
#if GR_TEST_UTILS
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
- const SkISize& dimensions,
+ SkISize dimensions,
GrColorType colorType,
const GrBackendFormat& format,
GrRenderable renderable,
@@ -138,18 +138,15 @@
// rely on GrColorType to get a swizzle for the proxy.
return nullptr;
}
- GrSurfaceDesc desc;
- desc.fWidth = dimensions.width();
- desc.fHeight = dimensions.height();
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
- tex = resourceProvider->createApproxTexture(desc, format, renderable, renderTargetSampleCnt,
- isProtected);
+ tex = resourceProvider->createApproxTexture(dimensions, format, renderable,
+ renderTargetSampleCnt, isProtected);
} else {
- tex = resourceProvider->createTexture(desc, format, renderable, renderTargetSampleCnt,
+ tex = resourceProvider->createTexture(dimensions, format, renderable, renderTargetSampleCnt,
GrMipMapped::kNo, budgeted, isProtected);
}
if (!tex) {
@@ -160,7 +157,7 @@
}
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
- const SkISize& dimensions,
+ SkISize dimensions,
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -315,30 +312,25 @@
SkBackingFit fit,
const GrBackendFormat& format,
GrColorType colorType) {
- GrSurfaceDesc desc;
- desc.fWidth = bitmap.width();
- desc.fHeight = bitmap.height();
-
GrSwizzle swizzle = this->caps()->getReadSwizzle(format, colorType);
+ auto dims = bitmap.dimensions();
sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
- [desc, format, bitmap, fit, colorType]
- (GrResourceProvider* resourceProvider) {
+ [dims, format, bitmap, fit, colorType](GrResourceProvider* resourceProvider) {
GrMipLevel mipLevel = { bitmap.getPixels(), bitmap.rowBytes() };
return LazyCallbackResult(resourceProvider->createTexture(
- desc, format, colorType, GrRenderable::kNo, 1, SkBudgeted::kYes, fit,
+ dims, format, colorType, GrRenderable::kNo, 1, SkBudgeted::kYes, fit,
GrProtected::kNo, mipLevel));
},
- format, desc, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
- GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone, fit,
- SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
+ format, dims, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
+ GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone, fit, SkBudgeted::kYes,
+ GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
return nullptr;
}
- SkASSERT(proxy->width() == desc.fWidth);
- SkASSERT(proxy->height() == desc.fHeight);
+ SkASSERT(proxy->dimensions() == bitmap.dimensions());
return proxy;
}
@@ -347,7 +339,6 @@
GrColorType colorType) {
SkASSERT(this->caps()->mipMapSupport());
- GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info());
sk_sp<SkMipMap> mipmaps(SkMipMap::Build(bitmap.pixmap(), nullptr));
if (!mipmaps) {
@@ -355,9 +346,10 @@
}
GrSwizzle readSwizzle = this->caps()->getReadSwizzle(format, colorType);
+ auto dims = bitmap.dimensions();
sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
- [desc, format, bitmap, mipmaps](GrResourceProvider* resourceProvider) {
+ [dims, format, bitmap, mipmaps](GrResourceProvider* resourceProvider) {
const int mipLevelCount = mipmaps->countLevels() + 1;
std::unique_ptr<GrMipLevel[]> texels(new GrMipLevel[mipLevelCount]);
@@ -374,10 +366,10 @@
SkASSERT(generatedMipLevel.fPixmap.colorType() == bitmap.colorType());
}
return LazyCallbackResult(resourceProvider->createTexture(
- desc, format, colorType, GrRenderable::kNo, 1, SkBudgeted::kYes,
+ dims, format, colorType, GrRenderable::kNo, 1, SkBudgeted::kYes,
GrProtected::kNo, texels.get(), mipLevelCount));
},
- format, desc, readSwizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
+ format, dims, readSwizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kYes, GrMipMapsStatus::kValid, GrInternalSurfaceFlags::kNone,
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
@@ -385,14 +377,13 @@
return nullptr;
}
- SkASSERT(proxy->width() == desc.fWidth);
- SkASSERT(proxy->height() == desc.fHeight);
+ SkASSERT(proxy->dimensions() == bitmap.dimensions());
return proxy;
}
sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrSwizzle readSwizzle,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -417,17 +408,16 @@
if (GrMipMapped::kYes == mipMapped) {
// SkMipMap doesn't include the base level in the level count so we have to add 1
- int mipCount = SkMipMap::ComputeLevelCount(desc.fWidth, desc.fHeight) + 1;
+ int mipCount = SkMipMap::ComputeLevelCount(dimensions.fWidth, dimensions.fHeight) + 1;
if (1 == mipCount) {
mipMapped = GrMipMapped::kNo;
}
}
- if (!caps->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, renderable,
- renderTargetSampleCnt, mipMapped)) {
+ if (!caps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
+ mipMapped)) {
return nullptr;
}
- GrSurfaceDesc copyDesc = desc;
GrMipMapsStatus mipMapsStatus = (GrMipMapped::kYes == mipMapped)
? GrMipMapsStatus::kDirty
: GrMipMapsStatus::kNotAllocated;
@@ -438,11 +428,11 @@
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(
- *caps, format, copyDesc, renderTargetSampleCnt, origin, mipMapped, mipMapsStatus,
+ *caps, format, dimensions, renderTargetSampleCnt, origin, mipMapped, mipMapsStatus,
readSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator));
}
- return sk_sp<GrTextureProxy>(new GrTextureProxy(format, copyDesc, origin, mipMapped,
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(format, dimensions, origin, mipMapped,
mipMapsStatus, readSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator));
}
@@ -455,10 +445,6 @@
return nullptr;
}
- GrSurfaceDesc desc;
- desc.fWidth = dimensions.width();
- desc.fHeight = dimensions.height();
-
GrBackendFormat format = this->caps()->getBackendFormatFromCompressionType(compressionType);
if (!this->caps()->isFormatTexturable(format)) {
@@ -470,13 +456,13 @@
: GrMipMapsStatus::kNotAllocated;
sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
- [dimensions, format, budgeted, mipMapped, isProtected, data]
- (GrResourceProvider* resourceProvider) {
+ [dimensions, format, budgeted, mipMapped, isProtected,
+ data](GrResourceProvider* resourceProvider) {
return LazyCallbackResult(resourceProvider->createCompressedTexture(
dimensions, format, budgeted, mipMapped, isProtected, data.get()));
},
- format, desc, GrSwizzle(), GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, mipMapped,
- mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
+ format, dimensions, GrSwizzle(), GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
+ mipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
@@ -740,7 +726,7 @@
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrSwizzle readSwizzle,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -756,15 +742,15 @@
if (this->isAbandoned()) {
return nullptr;
}
- SkASSERT((desc.fWidth <= 0 && desc.fHeight <= 0) ||
- (desc.fWidth > 0 && desc.fHeight > 0));
+ SkASSERT((dimensions.fWidth <= 0 && dimensions.fHeight <= 0) ||
+ (dimensions.fWidth > 0 && dimensions.fHeight > 0));
if (!format.isValid()) {
return nullptr;
}
- if (desc.fWidth > this->caps()->maxTextureSize() ||
- desc.fHeight > this->caps()->maxTextureSize()) {
+ if (dimensions.fWidth > this->caps()->maxTextureSize() ||
+ dimensions.fHeight > this->caps()->maxTextureSize()) {
return nullptr;
}
@@ -772,7 +758,7 @@
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*this->caps(),
std::move(callback),
format,
- desc,
+ dimensions,
renderTargetSampleCnt,
origin,
mipMapped,
@@ -786,7 +772,7 @@
} else {
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
format,
- desc,
+ dimensions,
origin,
mipMapped,
mipMapsStatus,
@@ -802,7 +788,7 @@
sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrSwizzle readSwizzle,
int sampleCnt,
GrSurfaceOrigin origin,
@@ -818,11 +804,11 @@
if (this->isAbandoned()) {
return nullptr;
}
- SkASSERT((desc.fWidth <= 0 && desc.fHeight <= 0) ||
- (desc.fWidth > 0 && desc.fHeight > 0));
+ SkASSERT((dimensions.fWidth <= 0 && dimensions.fHeight <= 0) ||
+ (dimensions.fWidth > 0 && dimensions.fHeight > 0));
- if (desc.fWidth > this->caps()->maxRenderTargetSize() ||
- desc.fHeight > this->caps()->maxRenderTargetSize()) {
+ if (dimensions.fWidth > this->caps()->maxRenderTargetSize() ||
+ dimensions.fHeight > this->caps()->maxRenderTargetSize()) {
return nullptr;
}
@@ -831,7 +817,7 @@
// actual VkImage to texture from.
SkASSERT(!wrapsVkSecondaryCB);
return sk_sp<GrRenderTargetProxy>(new GrTextureRenderTargetProxy(
- *this->caps(), std::move(callback), format, desc, sampleCnt, origin,
+ *this->caps(), std::move(callback), format, dimensions, sampleCnt, origin,
textureInfo->fMipMapped, mipMapsStatus, readSwizzle, fit, budgeted, isProtected,
surfaceFlags, useAllocator));
}
@@ -841,7 +827,7 @@
: GrRenderTargetProxy::WrapsVkSecondaryCB::kNo;
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(
- std::move(callback), format, desc, sampleCnt, origin, readSwizzle, fit, budgeted,
+ std::move(callback), format, dimensions, sampleCnt, origin, readSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator, vkSCB));
}
@@ -859,19 +845,17 @@
}
SkASSERT(renderTargetSampleCnt == 1 || renderable == GrRenderable::kYes);
- GrSurfaceDesc desc;
GrInternalSurfaceFlags surfaceFlags = GrInternalSurfaceFlags::kNone;
- desc.fWidth = -1;
- desc.fHeight = -1;
+ static constexpr SkISize kLazyDims = {-1, -1};
if (GrRenderable::kYes == renderable) {
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(
- caps, std::move(callback), format, desc, renderTargetSampleCnt, origin,
+ caps, std::move(callback), format, kLazyDims, renderTargetSampleCnt, origin,
GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, readSwizzle,
SkBackingFit::kApprox, SkBudgeted::kYes, isProtected, surfaceFlags, useAllocator));
} else {
return sk_sp<GrTextureProxy>(new GrTextureProxy(
- std::move(callback), format, desc, origin, GrMipMapped::kNo,
+ std::move(callback), format, kLazyDims, origin, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, readSwizzle, SkBackingFit::kApprox,
SkBudgeted::kYes, isProtected, surfaceFlags, useAllocator));
}
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index 6b13d42..3ff5471 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -73,7 +73,7 @@
* Create a GrSurfaceProxy without any data.
*/
sk_sp<GrTextureProxy> createProxy(const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize dimensions,
GrSwizzle readSwizzle,
GrRenderable,
int renderTargetSampleCnt,
@@ -160,7 +160,7 @@
*/
sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize dimensions,
GrSwizzle readSwizzle,
GrRenderable,
int renderTargetSampleCnt,
@@ -176,7 +176,7 @@
/** A null TextureInfo indicates a non-textureable render target. */
sk_sp<GrRenderTargetProxy> createLazyRenderTargetProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize dimensions,
GrSwizzle readSwizzle,
int renderTargetSampleCnt,
GrSurfaceOrigin origin,
@@ -245,7 +245,7 @@
* Create a texture proxy that is backed by an instantiated GrSurface.
* TODO: Remove GrColorType. Currently used to infer a readSwizzle.
*/
- sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(const SkISize& dimensions,
+ sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(SkISize dimensions,
GrColorType colorType,
const GrBackendFormat& format,
GrRenderable renderable,
@@ -256,7 +256,7 @@
GrProtected isProtected);
/** Version of above that picks the default format for the color type. */
- sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(const SkISize& dimensions,
+ sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(SkISize dimensions,
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index c49927c..a3d5a5d 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -165,7 +165,7 @@
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
SkBackingFit fit,
- const SkISize& dimensions,
+ SkISize dimensions,
const GrBackendFormat& format,
int sampleCnt,
GrMipMapped mipMapped,
@@ -180,15 +180,12 @@
if (context->priv().abandoned()) {
return nullptr;
}
- GrSurfaceDesc desc;
- desc.fWidth = dimensions.width();
- desc.fHeight = dimensions.height();
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
- format, desc, swizzle, GrRenderable::kYes, sampleCnt, origin, mipMapped, fit, budgeted,
- isProtected);
+ format, dimensions, swizzle, GrRenderable::kYes, sampleCnt, origin, mipMapped, fit,
+ budgeted, isProtected);
if (!proxy) {
return nullptr;
}
@@ -207,7 +204,7 @@
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
SkBackingFit fit,
- const SkISize& dimensions,
+ SkISize dimensions,
int sampleCnt,
GrMipMapped mipMapped,
GrProtected isProtected,
@@ -250,7 +247,7 @@
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
SkBackingFit fit,
- const SkISize& dimensions,
+ SkISize dimensions,
int sampleCnt,
GrMipMapped mipMapped,
GrProtected isProtected,
@@ -1910,7 +1907,7 @@
void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace,
sk_sp<SkColorSpace> dstColorSpace,
const SkIRect& srcRect,
- const SkISize& dstSize,
+ SkISize dstSize,
RescaleGamma rescaleGamma,
SkFilterQuality rescaleQuality,
ReadPixelsCallback callback,
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 605b6c8..3101fbe 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -61,27 +61,49 @@
GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, sk_sp<GrSurfaceProxy>,
GrSurfaceOrigin, const SkSurfaceProps*, bool managedOps = true);
- static std::unique_ptr<GrRenderTargetContext> Make(
- GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, SkBackingFit,
- const SkISize& dimensions, const GrBackendFormat&, int sampleCnt, GrMipMapped,
- GrProtected, GrSurfaceOrigin, SkBudgeted, const SkSurfaceProps*);
+ static std::unique_ptr<GrRenderTargetContext> Make(GrRecordingContext*,
+ GrColorType,
+ sk_sp<SkColorSpace>,
+ SkBackingFit,
+ SkISize dimensions,
+ const GrBackendFormat&,
+ int sampleCnt,
+ GrMipMapped,
+ GrProtected,
+ GrSurfaceOrigin,
+ SkBudgeted,
+ const SkSurfaceProps*);
// Same as above but will use the default GrBackendFormat for the given GrColorType
static std::unique_ptr<GrRenderTargetContext> Make(
- GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, SkBackingFit,
- const SkISize& dimensions, int sampleCnt = 1, GrMipMapped = GrMipMapped::kNo,
- GrProtected = GrProtected::kNo, GrSurfaceOrigin = kBottomLeft_GrSurfaceOrigin,
- SkBudgeted = SkBudgeted::kYes, const SkSurfaceProps* = nullptr);
+ GrRecordingContext*,
+ GrColorType,
+ sk_sp<SkColorSpace>,
+ SkBackingFit,
+ SkISize dimensions,
+ int sampleCnt = 1,
+ GrMipMapped = GrMipMapped::kNo,
+ GrProtected = GrProtected::kNo,
+ GrSurfaceOrigin = kBottomLeft_GrSurfaceOrigin,
+ SkBudgeted = SkBudgeted::kYes,
+ const SkSurfaceProps* = nullptr);
// Same as previous factory but will try to use fallback GrColorTypes if the one passed in
// fails. The fallback GrColorType will have at least the number of channels and precision per
// channel as the passed in GrColorType. It may also swizzle the changes (e.g., BGRA -> RGBA).
// SRGB-ness will be preserved.
static std::unique_ptr<GrRenderTargetContext> MakeWithFallback(
- GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, SkBackingFit,
- const SkISize& dimensions, int sampleCnt = 1, GrMipMapped = GrMipMapped::kNo,
- GrProtected = GrProtected::kNo, GrSurfaceOrigin = kBottomLeft_GrSurfaceOrigin,
- SkBudgeted = SkBudgeted::kYes, const SkSurfaceProps* = nullptr);
+ GrRecordingContext*,
+ GrColorType,
+ sk_sp<SkColorSpace>,
+ SkBackingFit,
+ SkISize dimensions,
+ int sampleCnt = 1,
+ GrMipMapped = GrMipMapped::kNo,
+ GrProtected = GrProtected::kNo,
+ GrSurfaceOrigin = kBottomLeft_GrSurfaceOrigin,
+ SkBudgeted = SkBudgeted::kYes,
+ const SkSurfaceProps* = nullptr);
// These match the definitions in SkSurface & GrSurface.h, for whence they came
typedef void* ReleaseContext;
@@ -515,7 +537,7 @@
void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace,
sk_sp<SkColorSpace> dstColorSpace,
const SkIRect& srcRect,
- const SkISize& dstSize,
+ SkISize dstSize,
RescaleGamma rescaleGamma,
SkFilterQuality rescaleQuality,
ReadPixelsCallback callback,
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 8268269..e16dba4 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -23,7 +23,7 @@
// cases to make the sampleConfig/numSamples stuff more rational.
GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCount,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
@@ -32,7 +32,7 @@
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : INHERITED(format, desc, GrRenderable::kYes, origin, textureSwizzle, fit, budgeted,
+ : INHERITED(format, dimensions, GrRenderable::kYes, origin, textureSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator)
, fSampleCnt(sampleCount)
, fWrapsVkSecondaryCB(WrapsVkSecondaryCB::kNo) {}
@@ -40,7 +40,7 @@
// Lazy-callback version
GrRenderTargetProxy::GrRenderTargetProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCount,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
@@ -50,8 +50,8 @@
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator,
WrapsVkSecondaryCB wrapsVkSecondaryCB)
- : INHERITED(std::move(callback), format, desc, GrRenderable::kYes, origin, textureSwizzle,
- fit, budgeted, isProtected, surfaceFlags, useAllocator)
+ : INHERITED(std::move(callback), format, dimensions, GrRenderable::kYes, origin,
+ textureSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator)
, fSampleCnt(sampleCount)
, fWrapsVkSecondaryCB(wrapsVkSecondaryCB) {}
diff --git a/src/gpu/GrRenderTargetProxy.h b/src/gpu/GrRenderTargetProxy.h
index 69c647c..4d68c20 100644
--- a/src/gpu/GrRenderTargetProxy.h
+++ b/src/gpu/GrRenderTargetProxy.h
@@ -90,7 +90,7 @@
// Deferred version
GrRenderTargetProxy(const GrCaps&,
const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize,
int sampleCount,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
@@ -114,7 +114,7 @@
// know the final size until flush time.
GrRenderTargetProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize,
int sampleCount,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 25835a7..1833748 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -43,7 +43,7 @@
fCaps = sk_ref_sp(fGpu->caps());
}
-sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrColorType colorType,
GrRenderable renderable,
@@ -61,45 +61,44 @@
}
GrMipMapped mipMapped = mipLevelCount > 1 ? GrMipMapped::kYes : GrMipMapped::kNo;
- if (!fCaps->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, renderable,
- renderTargetSampleCnt, mipMapped)) {
+ 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 = mipLevelCount && texels[0].fPixels;
- auto scratch = this->getExactScratch(desc, format, renderable, renderTargetSampleCnt, budgeted,
- mipMapped, isProtected);
+ auto scratch = this->getExactScratch(dimensions, format, renderable, renderTargetSampleCnt,
+ budgeted, mipMapped, isProtected);
if (scratch) {
if (!hasPixels) {
return scratch;
}
- return this->writePixels(std::move(scratch), colorType, {desc.fWidth, desc.fHeight}, texels,
- mipLevelCount);
+ return this->writePixels(std::move(scratch), colorType, dimensions, texels, mipLevelCount);
}
SkAutoSTMalloc<14, GrMipLevel> tmpTexels;
SkAutoSTArray<14, std::unique_ptr<char[]>> tmpDatas;
GrColorType tempColorType = GrColorType::kUnknown;
if (hasPixels) {
- tempColorType = this->prepareLevels(format, colorType, {desc.fWidth, desc.fHeight}, texels,
- mipLevelCount, &tmpTexels, &tmpDatas);
+ tempColorType = this->prepareLevels(format, colorType, dimensions, texels, mipLevelCount,
+ &tmpTexels, &tmpDatas);
if (tempColorType == GrColorType::kUnknown) {
return nullptr;
}
}
- return fGpu->createTexture(desc, format, renderable, renderTargetSampleCnt, budgeted,
+ return fGpu->createTexture(dimensions, format, renderable, renderTargetSampleCnt, budgeted,
isProtected, colorType, tempColorType, tmpTexels.get(),
mipLevelCount);
}
-sk_sp<GrTexture> GrResourceProvider::getExactScratch(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrResourceProvider::getExactScratch(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
SkBudgeted budgeted,
GrMipMapped mipMapped,
GrProtected isProtected) {
- sk_sp<GrTexture> tex(this->refScratchTexture(desc, format, renderable, renderTargetSampleCnt,
- mipMapped, isProtected));
+ sk_sp<GrTexture> tex(this->refScratchTexture(dimensions, format, renderable,
+ renderTargetSampleCnt, mipMapped, isProtected));
if (tex && SkBudgeted::kNo == budgeted) {
tex->resourcePriv().makeUnbudgeted();
}
@@ -107,7 +106,7 @@
return tex;
}
-sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrColorType colorType,
GrRenderable renderable,
@@ -126,20 +125,19 @@
if (this->isAbandoned()) {
return nullptr;
}
- if (!fCaps->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, renderable,
- renderTargetSampleCnt, GrMipMapped::kNo)) {
+ if (!fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
+ GrMipMapped::kNo)) {
return nullptr;
}
- auto tex = this->createApproxTexture(desc, format, renderable, renderTargetSampleCnt,
+ auto tex = this->createApproxTexture(dimensions, format, renderable, renderTargetSampleCnt,
isProtected);
if (!tex) {
return nullptr;
}
- return this->writePixels(std::move(tex), colorType, {desc.fWidth, desc.fHeight}, &mipLevel,
- 1);
+ return this->writePixels(std::move(tex), colorType, dimensions, &mipLevel, 1);
} else {
- return this->createTexture(desc, format, colorType, renderable, renderTargetSampleCnt,
+ return this->createTexture(dimensions, format, colorType, renderable, renderTargetSampleCnt,
budgeted, isProtected, &mipLevel, 1);
}
}
@@ -158,7 +156,7 @@
isProtected, data->data(), data->size());
}
-sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrResourceProvider::createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -170,8 +168,8 @@
return nullptr;
}
- if (!fCaps->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, renderable,
- renderTargetSampleCnt, mipMapped)) {
+ if (!fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
+ mipMapped)) {
return nullptr;
}
@@ -180,14 +178,15 @@
SkASSERT(!this->caps()->isFormatCompressed(format));
// TODO: Support GrMipMapped::kYes in scratch texture lookup here.
- sk_sp<GrTexture> tex = this->getExactScratch(
- desc, format, renderable, renderTargetSampleCnt, budgeted, mipMapped, isProtected);
+ sk_sp<GrTexture> tex =
+ this->getExactScratch(dimensions, format, renderable, renderTargetSampleCnt, budgeted,
+ mipMapped, isProtected);
if (tex) {
return tex;
}
- return fGpu->createTexture(desc, format, 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
@@ -219,7 +218,7 @@
return {adjust(dimensions.width()), adjust(dimensions.height())};
}
-sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrResourceProvider::createApproxTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -234,27 +233,23 @@
// textures should be created through the createCompressedTexture function.
SkASSERT(!this->caps()->isFormatCompressed(format));
- if (!fCaps->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, renderable,
- renderTargetSampleCnt, GrMipMapped::kNo)) {
+ if (!fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
+ GrMipMapped::kNo)) {
return nullptr;
}
- // bin by some multiple or power of 2 with a reasonable min
- GrSurfaceDesc copyDesc(desc);
- auto size = MakeApprox({desc.fWidth, desc.fHeight});
- copyDesc.fWidth = size.width();
- copyDesc.fHeight = size.height();
+ auto copyDimensions = MakeApprox(dimensions);
- if (auto tex = this->refScratchTexture(copyDesc, format, renderable, renderTargetSampleCnt,
- GrMipMapped::kNo, isProtected)) {
+ if (auto tex = this->refScratchTexture(copyDimensions, format, renderable,
+ renderTargetSampleCnt, GrMipMapped::kNo, isProtected)) {
return tex;
}
- return fGpu->createTexture(copyDesc, format, renderable, renderTargetSampleCnt,
+ return fGpu->createTexture(copyDimensions, format, renderable, renderTargetSampleCnt,
GrMipMapped::kNo, SkBudgeted::kYes, isProtected);
}
-sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrResourceProvider::refScratchTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -263,16 +258,15 @@
ASSERT_SINGLE_OWNER
SkASSERT(!this->isAbandoned());
SkASSERT(!this->caps()->isFormatCompressed(format));
- SkASSERT(fCaps->validateSurfaceParams({desc.fWidth, desc.fHeight}, format, renderable,
- renderTargetSampleCnt, GrMipMapped::kNo));
+ SkASSERT(fCaps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
+ 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() || renderable == GrRenderable::kYes) {
GrScratchKey key;
- GrTexturePriv::ComputeScratchKey(*this->caps(), format, {desc.fWidth, desc.fHeight},
- renderable, renderTargetSampleCnt, mipMapped, isProtected,
- &key);
+ GrTexturePriv::ComputeScratchKey(*this->caps(), format, dimensions, renderable,
+ renderTargetSampleCnt, mipMapped, isProtected, &key);
GrGpuResource* resource = fCache->findAndRefScratchResource(key);
if (resource) {
fGpu->stats()->incNumScratchTexturesReused();
@@ -562,7 +556,7 @@
// Ensures the row bytes are populated (not 0) and makes a copy to a temporary
// to make the row bytes tight if necessary. Returns false if the input row bytes are invalid.
static bool prepare_level(const GrMipLevel& inLevel,
- const SkISize& dimensions,
+ SkISize dimensions,
bool rowBytesSupport,
GrColorType origColorType,
GrColorType allowedColorType,
@@ -594,7 +588,7 @@
GrColorType GrResourceProvider::prepareLevels(const GrBackendFormat& format,
GrColorType colorType,
- const SkISize& baseSize,
+ SkISize baseSize,
const GrMipLevel texels[],
int mipLevelCount,
TempLevels* tempLevels,
@@ -622,7 +616,7 @@
sk_sp<GrTexture> GrResourceProvider::writePixels(sk_sp<GrTexture> texture,
GrColorType colorType,
- const SkISize& baseSize,
+ SkISize baseSize,
const GrMipLevel texels[],
int mipLevelCount) const {
SkASSERT(!this->isAbandoned());
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index bb4e460..5aa14e9 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -59,14 +59,14 @@
* 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& desc,
+ sk_sp<GrTexture> createApproxTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
GrProtected isProtected);
/** Create an exact fit texture with no initial data to upload. */
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc,
+ sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -79,7 +79,7 @@
* for the format and also describe the texel data. This will ensure any conversions that
* need to get applied to the data before upload are applied.
*/
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc,
+ sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat& format,
GrColorType colorType,
GrRenderable renderable,
@@ -94,7 +94,7 @@
* for the format and also describe the texel data. This will ensure any conversions that
* need to get applied to the data before upload are applied.
*/
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc&,
+ sk_sp<GrTexture> createTexture(SkISize dimensions,
const GrBackendFormat&,
GrColorType srcColorType,
GrRenderable,
@@ -310,9 +310,9 @@
private:
sk_sp<GrGpuResource> findResourceByUniqueKey(const GrUniqueKey&);
- // Attempts to find a resource in the cache that exactly matches the GrSurfaceDesc. Failing that
+ // Attempts to find a resource in the cache that exactly matches the SkISize. Failing that
// it returns null. If non-null, the resulting texture is always budgeted.
- sk_sp<GrTexture> refScratchTexture(const GrSurfaceDesc&,
+ sk_sp<GrTexture> refScratchTexture(SkISize dimensions,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
@@ -323,7 +323,7 @@
* Try to find an existing scratch texture that exactly matches 'desc'. If successful
* update the budgeting accordingly.
*/
- sk_sp<GrTexture> getExactScratch(const GrSurfaceDesc&,
+ sk_sp<GrTexture> getExactScratch(SkISize dimensions,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
@@ -337,7 +337,7 @@
using TempLevelDatas = SkAutoSTArray<14, std::unique_ptr<char[]>>;
GrColorType prepareLevels(const GrBackendFormat& format,
GrColorType,
- const SkISize& baseSize,
+ SkISize baseSize,
const GrMipLevel texels[],
int mipLevelCount,
TempLevels*,
@@ -350,7 +350,7 @@
// on failure.
sk_sp<GrTexture> writePixels(sk_sp<GrTexture> texture,
GrColorType colorType,
- const SkISize& baseSize,
+ SkISize baseSize,
const GrMipLevel texels[],
int mipLevelCount) const;
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 8b50c2a..7ea30e2 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -175,20 +175,16 @@
static sk_sp<GrTextureProxy> make_deferred_mask_texture_proxy(GrRecordingContext* context,
SkBackingFit fit,
- int width, int height) {
+ SkISize dimensions) {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
const GrCaps* caps = context->priv().caps();
- GrSurfaceDesc desc;
- desc.fWidth = width;
- desc.fHeight = height;
-
const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
GrRenderable::kNo);
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kAlpha_8);
- return proxyProvider->createProxy(format, desc, swizzle, GrRenderable::kNo, 1,
+ return proxyProvider->createProxy(format, dimensions, swizzle, GrRenderable::kNo, 1,
kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, fit,
SkBudgeted::kYes, GrProtected::kNo);
}
@@ -341,9 +337,7 @@
}
if (taskGroup) {
- proxy = make_deferred_mask_texture_proxy(args.fContext, fit,
- boundsForMask->width(),
- boundsForMask->height());
+ proxy = make_deferred_mask_texture_proxy(args.fContext, fit, boundsForMask->size());
if (!proxy) {
return false;
}
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index a742c17..9822462 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -61,28 +61,23 @@
return surfaceContext;
}
-std::unique_ptr<GrSurfaceContext> GrSurfaceContext::Make(
- GrRecordingContext* context,
- const SkISize& dimensions,
- const GrBackendFormat& format,
- GrRenderable renderable,
- int renderTargetSampleCnt,
- GrMipMapped mipMapped,
- GrProtected isProtected,
- GrSurfaceOrigin origin,
- GrColorType colorType,
- SkAlphaType alphaType,
- sk_sp<SkColorSpace> colorSpace,
- SkBackingFit fit,
- SkBudgeted budgeted) {
- GrSurfaceDesc desc;
- desc.fWidth = dimensions.width();
- desc.fHeight = dimensions.height();
-
+std::unique_ptr<GrSurfaceContext> GrSurfaceContext::Make(GrRecordingContext* context,
+ SkISize dimensions,
+ const GrBackendFormat& format,
+ GrRenderable renderable,
+ int renderTargetSampleCnt,
+ GrMipMapped mipMapped,
+ GrProtected isProtected,
+ GrSurfaceOrigin origin,
+ GrColorType colorType,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace,
+ SkBackingFit fit,
+ SkBudgeted budgeted) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
- format, desc, swizzle, renderable, renderTargetSampleCnt, origin, mipMapped, fit,
+ format, dimensions, swizzle, renderable, renderTargetSampleCnt, origin, mipMapped, fit,
budgeted, isProtected);
if (!proxy) {
return nullptr;
@@ -93,7 +88,6 @@
std::move(colorSpace));
}
-
// In MDB mode the reffing of the 'getLastOpsTask' call's result allows in-progress
// GrOpsTasks to be picked up and added to by renderTargetContexts lower in the call
// stack. When this occurs with a closed GrOpsTask, a new one will be allocated
@@ -359,9 +353,6 @@
direct->priv().validPMUPMConversionExists();
if (!caps->surfaceSupportsWritePixels(dstSurface) || canvas2DFastPath) {
- GrSurfaceDesc desc;
- desc.fWidth = srcInfo.width();
- desc.fHeight = srcInfo.height();
GrColorType colorType;
GrBackendFormat format;
@@ -389,8 +380,8 @@
GrSurfaceOrigin tempOrigin =
this->asRenderTargetContext() ? kTopLeft_GrSurfaceOrigin : dstProxy->origin();
auto tempProxy = direct->priv().proxyProvider()->createProxy(
- format, desc, tempReadSwizzle, GrRenderable::kNo, 1, tempOrigin, GrMipMapped::kNo,
- SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
+ format, srcInfo.dimensions(), tempReadSwizzle, GrRenderable::kNo, 1, tempOrigin,
+ GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
if (!tempProxy) {
return false;
}
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index 4173ea3..4bb1f2d 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -42,7 +42,7 @@
GrSurfaceProxyView readView,
GrColorType, SkAlphaType, sk_sp<SkColorSpace>);
- static std::unique_ptr<GrSurfaceContext> Make(GrRecordingContext*, const SkISize& dimensions,
+ static std::unique_ptr<GrSurfaceContext> Make(GrRecordingContext*, SkISize dimensions,
const GrBackendFormat&, GrRenderable,
int renderTargetSampleCnt, GrMipMapped,
GrProtected, GrSurfaceOrigin, GrColorType,
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index b2cee1d..7391c01 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -29,23 +29,23 @@
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrRenderTargetPriv.h"
-static bool is_valid_lazy(const GrSurfaceDesc& desc, SkBackingFit fit) {
+static bool is_valid_lazy(const SkISize& dimensions, SkBackingFit fit) {
// A "fully" lazy proxy's width and height are not known until instantiation time.
// So fully lazy proxies are created with width and height < 0. Regular lazy proxies must be
// created with positive widths and heights. The width and height are set to 0 only after a
// failed instantiation. The former must be "approximate" fit while the latter can be either.
- return ((desc.fWidth < 0 && desc.fHeight < 0 && SkBackingFit::kApprox == fit) ||
- (desc.fWidth > 0 && desc.fHeight > 0));
+ return ((dimensions.fWidth < 0 && dimensions.fHeight < 0 && SkBackingFit::kApprox == fit) ||
+ (dimensions.fWidth > 0 && dimensions.fHeight > 0));
}
-static bool is_valid_non_lazy(const GrSurfaceDesc& desc) {
- return desc.fWidth > 0 && desc.fHeight > 0;
+static bool is_valid_non_lazy(SkISize dimensions) {
+ return dimensions.fWidth > 0 && dimensions.fHeight > 0;
}
#endif
// Deferred version
GrSurfaceProxy::GrSurfaceProxy(const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrRenderable renderable,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
@@ -56,7 +56,7 @@
UseAllocator useAllocator)
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
- , fDimensions{desc.fWidth, desc.fHeight}
+ , fDimensions(dimensions)
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
@@ -65,13 +65,13 @@
, fIsProtected(isProtected)
, fGpuMemorySize(kInvalidGpuMemorySize) {
SkASSERT(fFormat.isValid());
- SkASSERT(is_valid_non_lazy(desc));
+ SkASSERT(is_valid_non_lazy(dimensions));
}
// Lazy-callback version
GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrRenderable renderable,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
@@ -82,7 +82,7 @@
UseAllocator useAllocator)
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
- , fDimensions{desc.fWidth, desc.fHeight}
+ , fDimensions(dimensions)
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
@@ -93,7 +93,7 @@
, fGpuMemorySize(kInvalidGpuMemorySize) {
SkASSERT(fFormat.isValid());
SkASSERT(fLazyInstantiateCallback);
- SkASSERT(is_valid_lazy(desc, fit));
+ SkASSERT(is_valid_lazy(dimensions, fit));
}
// Wrapped version
@@ -132,17 +132,14 @@
SkASSERT(mipMapped == GrMipMapped::kNo || fFit == SkBackingFit::kExact);
SkASSERT(!this->isLazy());
SkASSERT(!fTarget);
- GrSurfaceDesc desc;
- desc.fWidth = fDimensions.width();
- desc.fHeight = fDimensions.height();
sk_sp<GrSurface> surface;
if (SkBackingFit::kApprox == fFit) {
- surface = resourceProvider->createApproxTexture(desc, fFormat, renderable, sampleCnt,
+ surface = resourceProvider->createApproxTexture(fDimensions, fFormat, renderable, sampleCnt,
fIsProtected);
} else {
- surface = resourceProvider->createTexture(desc, fFormat, renderable, sampleCnt, mipMapped,
- fBudgeted, fIsProtected);
+ surface = resourceProvider->createTexture(fDimensions, fFormat, renderable, sampleCnt,
+ mipMapped, fBudgeted, fIsProtected);
}
if (!surface) {
return nullptr;
diff --git a/src/gpu/GrSurfaceProxy.h b/src/gpu/GrSurfaceProxy.h
index 46af8d7..99cc181 100644
--- a/src/gpu/GrSurfaceProxy.h
+++ b/src/gpu/GrSurfaceProxy.h
@@ -327,7 +327,7 @@
protected:
// Deferred version - takes a new UniqueID from the shared resource/proxy pool.
GrSurfaceProxy(const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize,
GrRenderable,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
@@ -339,7 +339,7 @@
// Lazy-callback version - takes a new UniqueID from the shared resource/proxy pool.
GrSurfaceProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize,
GrRenderable,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 6b5d3f0..d15e2f0 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -17,7 +17,7 @@
// Deferred version - no data
GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
- const GrSurfaceDesc& srcDesc,
+ SkISize dimensions,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
@@ -27,7 +27,7 @@
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : INHERITED(format, srcDesc, GrRenderable::kNo, origin, textureSwizzle, fit, budgeted,
+ : INHERITED(format, dimensions, GrRenderable::kNo, origin, textureSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator)
, fMipMapped(mipMapped)
, fMipMapsStatus(mipMapsStatus) SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
@@ -39,7 +39,7 @@
// Lazy-callback version
GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
@@ -49,8 +49,8 @@
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : INHERITED(std::move(callback), format, desc, GrRenderable::kNo, origin, texSwizzle, fit,
- budgeted, isProtected, surfaceFlags, useAllocator)
+ : INHERITED(std::move(callback), format, dimensions, GrRenderable::kNo, origin, texSwizzle,
+ fit, budgeted, isProtected, surfaceFlags, useAllocator)
, fMipMapped(mipMapped)
, fMipMapsStatus(mipMapsStatus) SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
, fProxyProvider(nullptr)
diff --git a/src/gpu/GrTextureProxy.h b/src/gpu/GrTextureProxy.h
index 8c23a58..186e2a0 100644
--- a/src/gpu/GrTextureProxy.h
+++ b/src/gpu/GrTextureProxy.h
@@ -109,7 +109,7 @@
// Deferred version - no data.
GrTextureProxy(const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize,
GrSurfaceOrigin,
GrMipMapped,
GrMipMapsStatus,
@@ -132,7 +132,7 @@
// know the final size until flush time.
GrTextureProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
- const GrSurfaceDesc& desc,
+ SkISize,
GrSurfaceOrigin,
GrMipMapped,
GrMipMapsStatus,
diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp
index 6675884..1fa3da1 100644
--- a/src/gpu/GrTextureRenderTargetProxy.cpp
+++ b/src/gpu/GrTextureRenderTargetProxy.cpp
@@ -22,7 +22,7 @@
// GrRenderTargetProxy) so its constructor must be explicitly called.
GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
@@ -33,13 +33,13 @@
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : GrSurfaceProxy(format, desc, GrRenderable::kYes, origin, texSwizzle, fit, budgeted,
+ : GrSurfaceProxy(format, dimensions, GrRenderable::kYes, origin, texSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator)
// for now textures w/ data are always wrapped
- , GrRenderTargetProxy(caps, format, desc, sampleCnt, origin, texSwizzle, fit, budgeted,
- isProtected, surfaceFlags, useAllocator)
- , GrTextureProxy(format, desc, origin, mipMapped, mipMapsStatus, texSwizzle, fit, budgeted,
- isProtected, surfaceFlags, useAllocator) {
+ , GrRenderTargetProxy(caps, format, dimensions, sampleCnt, origin, texSwizzle, fit,
+ budgeted, isProtected, surfaceFlags, useAllocator)
+ , GrTextureProxy(format, dimensions, origin, mipMapped, mipMapsStatus, texSwizzle, fit,
+ budgeted, isProtected, surfaceFlags, useAllocator) {
this->initSurfaceFlags(caps);
}
@@ -47,7 +47,7 @@
GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
@@ -58,15 +58,16 @@
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
- : GrSurfaceProxy(std::move(callback), format, desc, GrRenderable::kYes, origin, texSwizzle,
- fit, budgeted, isProtected, surfaceFlags, useAllocator)
+ : GrSurfaceProxy(std::move(callback), format, dimensions, GrRenderable::kYes, origin,
+ texSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator)
// Since we have virtual inheritance, we initialize GrSurfaceProxy directly. Send null
// callbacks to the texture and RT proxies simply to route to the appropriate constructors.
- , GrRenderTargetProxy(LazyInstantiateCallback(), format, desc, sampleCnt, origin,
+ , GrRenderTargetProxy(LazyInstantiateCallback(), format, dimensions, sampleCnt, origin,
texSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator,
WrapsVkSecondaryCB::kNo)
- , GrTextureProxy(LazyInstantiateCallback(), format, desc, origin, mipMapped, mipMapsStatus,
- texSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator) {
+ , GrTextureProxy(LazyInstantiateCallback(), format, dimensions, origin, mipMapped,
+ mipMapsStatus, texSwizzle, fit, budgeted, isProtected, surfaceFlags,
+ useAllocator) {
this->initSurfaceFlags(caps);
}
diff --git a/src/gpu/GrTextureRenderTargetProxy.h b/src/gpu/GrTextureRenderTargetProxy.h
index 68e68f7..d795685 100644
--- a/src/gpu/GrTextureRenderTargetProxy.h
+++ b/src/gpu/GrTextureRenderTargetProxy.h
@@ -30,7 +30,7 @@
// Deferred version
GrTextureRenderTargetProxy(const GrCaps&,
const GrBackendFormat&,
- const GrSurfaceDesc&,
+ SkISize,
int sampleCnt,
GrSurfaceOrigin,
GrMipMapped,
@@ -46,7 +46,7 @@
GrTextureRenderTargetProxy(const GrCaps&,
LazyInstantiateCallback&&,
const GrBackendFormat&,
- const GrSurfaceDesc& desc,
+ SkISize,
int sampleCnt,
GrSurfaceOrigin,
GrMipMapped,
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 26074ac..470bf2a 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -105,7 +105,7 @@
}
GrSurfaceProxyView GrYUVProvider::refAsTextureProxyView(GrRecordingContext* ctx,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrColorType colorType,
SkColorSpace* srcColorSpace,
SkColorSpace* dstColorSpace) {
@@ -164,8 +164,8 @@
// TODO: investigate preallocating mip maps here
auto renderTargetContext = GrRenderTargetContext::Make(
- ctx, colorType, nullptr, SkBackingFit::kExact, {desc.fWidth, desc.fHeight}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ ctx, colorType, nullptr, SkBackingFit::kExact, dimensions, 1, GrMipMapped::kNo,
+ GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
if (!renderTargetContext) {
return {};
}
diff --git a/src/gpu/GrYUVProvider.h b/src/gpu/GrYUVProvider.h
index 521ec48..6e3af05 100644
--- a/src/gpu/GrYUVProvider.h
+++ b/src/gpu/GrYUVProvider.h
@@ -16,7 +16,6 @@
class GrBackendFormat;
class GrRecordingContext;
-struct GrSurfaceDesc;
class GrSurfaceProxyView;
class SkCachedData;
@@ -42,7 +41,7 @@
* On failure (e.g. the provider had no data), this returns NULL.
*/
GrSurfaceProxyView refAsTextureProxyView(GrRecordingContext*,
- const GrSurfaceDesc&,
+ SkISize,
GrColorType colorType,
SkColorSpace* srcColorSpace,
SkColorSpace* dstColorSpace);
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 7579e28..8216270 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -86,13 +86,6 @@
}
)";
-GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo& info) {
- GrSurfaceDesc desc;
- desc.fWidth = info.width();
- desc.fHeight = info.height();
- return desc;
-}
-
void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& imageBounds) {
SkASSERT(key);
SkASSERT(imageID);
diff --git a/src/gpu/SkGr.h b/src/gpu/SkGr.h
index 9613d4a..0d97169 100644
--- a/src/gpu/SkGr.h
+++ b/src/gpu/SkGr.h
@@ -125,8 +125,6 @@
////////////////////////////////////////////////////////////////////////////////
// Misc Sk to Gr type conversions
-GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&);
-
GrSamplerState::Filter GrSkFilterQualityToGrFilterMode(int imageWidth, int imageHeight,
SkFilterQuality paintFilterQuality,
const SkMatrix& viewM,
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index 37f5d65..82f89a6 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -114,12 +114,9 @@
[this](GrResourceProvider* resourceProvider,const GrBackendFormat& format,
int sampleCount) {
if (!fBackingTexture) {
- GrSurfaceDesc desc;
- desc.fWidth = fWidth;
- desc.fHeight = fHeight;
fBackingTexture = resourceProvider->createTexture(
- desc, format, GrRenderable::kYes, sampleCount, GrMipMapped::kNo,
- SkBudgeted::kYes, GrProtected::kNo);
+ {fWidth, fHeight}, format, GrRenderable::kYes, sampleCount,
+ GrMipMapped::kNo, SkBudgeted::kYes, GrProtected::kNo);
}
return GrSurfaceProxy::LazyCallbackResult(fBackingTexture);
},
diff --git a/src/gpu/dawn/GrDawnGpu.cpp b/src/gpu/dawn/GrDawnGpu.cpp
index 1d364e2..e80d7b6 100644
--- a/src/gpu/dawn/GrDawnGpu.cpp
+++ b/src/gpu/dawn/GrDawnGpu.cpp
@@ -148,7 +148,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-sk_sp<GrTexture> GrDawnGpu::onCreateTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrDawnGpu::onCreateTexture(SkISize dimensions,
const GrBackendFormat& backendFormat,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -165,10 +165,8 @@
GrMipMapsStatus mipMapsStatus =
mipLevelCount > 1 ? GrMipMapsStatus::kDirty : GrMipMapsStatus::kNotAllocated;
- return GrDawnTexture::Make(this, { desc.fWidth, desc.fHeight },
- format, renderable,
- renderTargetSampleCnt, budgeted, mipLevelCount,
- mipMapsStatus);
+ return GrDawnTexture::Make(this, dimensions, format, renderable, renderTargetSampleCnt,
+ budgeted, mipLevelCount, mipMapsStatus);
}
sk_sp<GrTexture> GrDawnGpu::onCreateCompressedTexture(SkISize dimensions, const GrBackendFormat&,
diff --git a/src/gpu/dawn/GrDawnGpu.h b/src/gpu/dawn/GrDawnGpu.h
index 682e336..8ce14d2 100644
--- a/src/gpu/dawn/GrDawnGpu.h
+++ b/src/gpu/dawn/GrDawnGpu.h
@@ -110,7 +110,7 @@
virtual void querySampleLocations(GrRenderTarget*, SkTArray<SkPoint>*) override {}
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&,
+ sk_sp<GrTexture> onCreateTexture(SkISize,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
diff --git a/src/gpu/dawn/GrDawnRenderTarget.h b/src/gpu/dawn/GrDawnRenderTarget.h
index 16d498d..fca5508 100644
--- a/src/gpu/dawn/GrDawnRenderTarget.h
+++ b/src/gpu/dawn/GrDawnRenderTarget.h
@@ -43,9 +43,6 @@
// This accounts for the texture's memory and any MSAA renderbuffer's memory.
size_t onGpuMemorySize() const override;
- static GrDawnRenderTarget* Create(GrDawnGpu*, const GrSurfaceDesc&, int sampleCnt,
- const GrDawnRenderTargetInfo&);
-
bool completeStencilAttachment() override;
GrDawnRenderTargetInfo fInfo;
typedef GrRenderTarget INHERITED;
diff --git a/src/gpu/dawn/GrDawnTexture.h b/src/gpu/dawn/GrDawnTexture.h
index df3801f..118ad8f 100644
--- a/src/gpu/dawn/GrDawnTexture.h
+++ b/src/gpu/dawn/GrDawnTexture.h
@@ -52,8 +52,6 @@
}
private:
- GrDawnTexture(GrDawnGpu*, const GrSurfaceDesc&, const GrDawnTextureInfo&, GrMipMapsStatus);
-
GrDawnTextureInfo fInfo;
wgpu::TextureView fTextureView;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 7697ebb..2cf0032 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -833,10 +833,9 @@
rtIDs.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID;
rtIDs.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed;
- const auto size = SkISize::Make(backendRT.width(), backendRT.height());
int sampleCount = this->glCaps().getRenderTargetSampleCount(backendRT.sampleCnt(), format);
- return GrGLRenderTarget::MakeWrapped(this, size, format, sampleCount, rtIDs,
+ return GrGLRenderTarget::MakeWrapped(this, backendRT.dimensions(), format, sampleCount, rtIDs,
backendRT.stencilBits());
}
@@ -1296,7 +1295,7 @@
return state;
}
-sk_sp<GrTexture> GrGLGpu::onCreateTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrGLGpu::onCreateTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -1315,15 +1314,15 @@
mipLevelCount > 1 ? GrMipMapsStatus::kDirty : GrMipMapsStatus::kNotAllocated;
GrGLTextureParameters::SamplerOverriddenState initialState;
GrGLTexture::Desc texDesc;
- texDesc.fSize = {desc.fWidth, desc.fHeight};
+ texDesc.fSize = dimensions;
texDesc.fTarget = GR_GL_TEXTURE_2D;
texDesc.fFormat = format.asGLFormat();
texDesc.fOwnership = GrBackendObjectOwnership::kOwned;
SkASSERT(texDesc.fFormat != GrGLFormat::kUnknown);
SkASSERT(!GrGLFormatIsCompressed(texDesc.fFormat));
- texDesc.fID = this->createTexture2D({desc.fWidth, desc.fHeight}, texDesc.fFormat, renderable,
- &initialState, mipLevelCount);
+ texDesc.fID = this->createTexture2D(dimensions, texDesc.fFormat, renderable, &initialState,
+ mipLevelCount);
if (!texDesc.fID) {
return return_null_texture();
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 3f63fb6..8668363 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -191,7 +191,7 @@
void xferBarrier(GrRenderTarget*, GrXferBarrierType) override;
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&,
+ sk_sp<GrTexture> onCreateTexture(SkISize dimensions,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index 7f0075e..ba2d7fb 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -131,7 +131,7 @@
}
}
-sk_sp<GrTexture> GrMockGpu::onCreateTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrMockGpu::onCreateTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -154,12 +154,12 @@
GrMockTextureInfo texInfo(ct, SkImage::CompressionType::kNone, NextInternalTextureID());
if (renderable == GrRenderable::kYes) {
GrMockRenderTargetInfo rtInfo(ct, NextInternalRenderTargetID());
- return sk_sp<GrTexture>(new GrMockTextureRenderTarget(this, budgeted, desc,
+ return sk_sp<GrTexture>(new GrMockTextureRenderTarget(this, budgeted, dimensions,
renderTargetSampleCnt, isProtected,
mipMapsStatus, texInfo, rtInfo));
}
return sk_sp<GrTexture>(
- new GrMockTexture(this, budgeted, desc, isProtected, mipMapsStatus, texInfo));
+ new GrMockTexture(this, budgeted, dimensions, isProtected, mipMapsStatus, texInfo));
}
// TODO: why no 'isProtected' ?!
@@ -179,10 +179,6 @@
SkASSERT(compression != SkImage::CompressionType::kNone);
#endif
- GrSurfaceDesc desc;
- desc.fWidth = dimensions.width();
- desc.fHeight = dimensions.height();
-
GrMipMapsStatus mipMapsStatus = (mipMapped == GrMipMapped::kYes)
? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
@@ -190,8 +186,8 @@
format.asMockCompressionType(),
NextInternalTextureID());
- return sk_sp<GrTexture>(new GrMockTexture(this, budgeted, desc, isProtected,
- mipMapsStatus, texInfo));
+ return sk_sp<GrTexture>(
+ new GrMockTexture(this, budgeted, dimensions, isProtected, mipMapsStatus, texInfo));
}
sk_sp<GrTexture> GrMockGpu::onWrapBackendTexture(const GrBackendTexture& tex, GrColorType colorType,
@@ -207,15 +203,11 @@
SkASSERT(colorType == texInfo.colorType());
- GrSurfaceDesc desc;
- desc.fWidth = tex.width();
- desc.fHeight = tex.height();
-
GrMipMapsStatus mipMapsStatus = tex.hasMipMaps() ? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
auto isProtected = GrProtected(tex.isProtected());
- return sk_sp<GrTexture>(
- new GrMockTexture(this, desc, isProtected, mipMapsStatus, texInfo, wrapType, ioType));
+ return sk_sp<GrTexture>(new GrMockTexture(this, tex.dimensions(), isProtected, mipMapsStatus,
+ texInfo, wrapType, ioType));
}
sk_sp<GrTexture> GrMockGpu::onWrapCompressedBackendTexture(const GrBackendTexture& tex,
@@ -234,9 +226,6 @@
SkASSERT(texInfo.compressionType() == SkImage::CompressionType::kNone);
SkASSERT(colorType == texInfo.colorType());
- GrSurfaceDesc desc;
- desc.fWidth = tex.width();
- desc.fHeight = tex.height();
GrMipMapsStatus mipMapsStatus =
tex.hasMipMaps() ? GrMipMapsStatus::kValid : GrMipMapsStatus::kNotAllocated;
@@ -245,8 +234,9 @@
GrMockRenderTargetInfo rtInfo(texInfo.colorType(), NextInternalRenderTargetID());
auto isProtected = GrProtected(tex.isProtected());
- return sk_sp<GrTexture>(new GrMockTextureRenderTarget(
- this, desc, sampleCnt, isProtected, mipMapsStatus, texInfo, rtInfo, cacheable));
+ return sk_sp<GrTexture>(new GrMockTextureRenderTarget(this, tex.dimensions(), sampleCnt,
+ isProtected, mipMapsStatus, texInfo,
+ rtInfo, cacheable));
}
sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& rt,
@@ -255,13 +245,11 @@
SkAssertResult(rt.getMockRenderTargetInfo(&info));
SkASSERT(colorType == info.colorType());
- GrSurfaceDesc desc;
- desc.fWidth = rt.width();
- desc.fHeight = rt.height();
auto isProtected = GrProtected(rt.isProtected());
- return sk_sp<GrRenderTarget>(new GrMockRenderTarget(this, GrMockRenderTarget::kWrapped, desc,
- rt.sampleCnt(), isProtected, info));
+ return sk_sp<GrRenderTarget>(new GrMockRenderTarget(this, GrMockRenderTarget::kWrapped,
+ rt.dimensions(), rt.sampleCnt(),
+ isProtected, info));
}
sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
@@ -272,16 +260,13 @@
SkASSERT(texInfo.compressionType() == SkImage::CompressionType::kNone);
SkASSERT(colorType == texInfo.colorType());
- GrSurfaceDesc desc;
- desc.fWidth = tex.width();
- desc.fHeight = tex.height();
// The client gave us the texture ID but we supply the render target ID.
GrMockRenderTargetInfo rtInfo(texInfo.colorType(), NextInternalRenderTargetID());
auto isProtected = GrProtected(tex.isProtected());
- return sk_sp<GrRenderTarget>(new GrMockRenderTarget(this, GrMockRenderTarget::kWrapped, desc,
- sampleCnt, isProtected, rtInfo));
+ return sk_sp<GrRenderTarget>(new GrMockRenderTarget(
+ this, GrMockRenderTarget::kWrapped, tex.dimensions(), sampleCnt, isProtected, rtInfo));
}
sk_sp<GrGpuBuffer> GrMockGpu::onCreateBuffer(size_t sizeInBytes, GrGpuBufferType type,
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index 3333bb7..a6c0c6c 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -62,7 +62,7 @@
void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&,
+ sk_sp<GrTexture> onCreateTexture(SkISize,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
diff --git a/src/gpu/mock/GrMockTexture.h b/src/gpu/mock/GrMockTexture.h
index b1beab4..640e41b 100644
--- a/src/gpu/mock/GrMockTexture.h
+++ b/src/gpu/mock/GrMockTexture.h
@@ -17,17 +17,24 @@
class GrMockTexture : public GrTexture {
public:
- GrMockTexture(GrMockGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
- GrProtected isProtected, GrMipMapsStatus mipMapsStatus,
+ GrMockTexture(GrMockGpu* gpu,
+ SkBudgeted budgeted,
+ SkISize dimensions,
+ GrProtected isProtected,
+ GrMipMapsStatus mipMapsStatus,
const GrMockTextureInfo& info)
- : GrMockTexture(gpu, desc, isProtected, mipMapsStatus, info) {
+ : GrMockTexture(gpu, dimensions, isProtected, mipMapsStatus, info) {
this->registerWithCache(budgeted);
}
- GrMockTexture(GrMockGpu* gpu, const GrSurfaceDesc& desc, GrProtected isProtected,
- GrMipMapsStatus mipMapsStatus, const GrMockTextureInfo& info,
- GrWrapCacheable cacheable, GrIOType ioType)
- : GrMockTexture(gpu, desc, isProtected, mipMapsStatus, info) {
+ GrMockTexture(GrMockGpu* gpu,
+ SkISize dimensions,
+ GrProtected isProtected,
+ GrMipMapsStatus mipMapsStatus,
+ const GrMockTextureInfo& info,
+ GrWrapCacheable cacheable,
+ GrIOType ioType)
+ : GrMockTexture(gpu, dimensions, isProtected, mipMapsStatus, info) {
if (ioType == kRead_GrIOType) {
this->setReadOnly();
}
@@ -49,11 +56,10 @@
protected:
// constructor for subclasses
- GrMockTexture(GrMockGpu* gpu, const GrSurfaceDesc& desc, GrProtected isProtected,
+ GrMockTexture(GrMockGpu* gpu, const SkISize& dimensions, GrProtected isProtected,
GrMipMapsStatus mipMapsStatus, const GrMockTextureInfo& info)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, isProtected)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, isProtected, GrTextureType::k2D,
- mipMapsStatus)
+ : GrSurface(gpu, dimensions, isProtected)
+ , INHERITED(gpu, dimensions, isProtected, GrTextureType::k2D, mipMapsStatus)
, fInfo(info) {}
void onRelease() override {
@@ -76,19 +82,23 @@
class GrMockRenderTarget : public GrRenderTarget {
public:
- GrMockRenderTarget(GrMockGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
- int sampleCnt, GrProtected isProtected, const GrMockRenderTargetInfo& info)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, isProtected)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, sampleCnt, isProtected)
+ GrMockRenderTarget(GrMockGpu* gpu,
+ SkBudgeted budgeted,
+ SkISize dimensions,
+ int sampleCnt,
+ GrProtected isProtected,
+ const GrMockRenderTargetInfo& info)
+ : GrSurface(gpu, dimensions, isProtected)
+ , INHERITED(gpu, dimensions, sampleCnt, isProtected)
, fInfo(info) {
this->registerWithCache(budgeted);
}
enum Wrapped { kWrapped };
- GrMockRenderTarget(GrMockGpu* gpu, Wrapped, const GrSurfaceDesc& desc, int sampleCnt,
+ GrMockRenderTarget(GrMockGpu* gpu, Wrapped, SkISize dimensions, int sampleCnt,
GrProtected isProtected, const GrMockRenderTargetInfo& info)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, isProtected)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, sampleCnt, isProtected)
+ : GrSurface(gpu, dimensions, isProtected)
+ , INHERITED(gpu, dimensions, sampleCnt, isProtected)
, fInfo(info) {
this->registerWithCacheWrapped(GrWrapCacheable::kNo);
}
@@ -121,10 +131,13 @@
protected:
// constructor for subclasses
- GrMockRenderTarget(GrMockGpu* gpu, const GrSurfaceDesc& desc, int sampleCnt,
- GrProtected isProtected, const GrMockRenderTargetInfo& info)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, isProtected)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, sampleCnt, isProtected)
+ GrMockRenderTarget(GrMockGpu* gpu,
+ SkISize dimensions,
+ int sampleCnt,
+ GrProtected isProtected,
+ const GrMockRenderTargetInfo& info)
+ : GrSurface(gpu, dimensions, isProtected)
+ , INHERITED(gpu, dimensions, sampleCnt, isProtected)
, fInfo(info) {}
private:
@@ -136,25 +149,33 @@
class GrMockTextureRenderTarget : public GrMockTexture, public GrMockRenderTarget {
public:
// Internally created.
- GrMockTextureRenderTarget(GrMockGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
- int sampleCnt, GrProtected isProtected, GrMipMapsStatus mipMapsStatus,
+ GrMockTextureRenderTarget(GrMockGpu* gpu,
+ SkBudgeted budgeted,
+ SkISize dimensions,
+ int sampleCnt,
+ GrProtected isProtected,
+ GrMipMapsStatus mipMapsStatus,
const GrMockTextureInfo& texInfo,
const GrMockRenderTargetInfo& rtInfo)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, isProtected)
- , GrMockTexture(gpu, desc, isProtected, mipMapsStatus, texInfo)
- , GrMockRenderTarget(gpu, desc, sampleCnt, isProtected, rtInfo) {
+ : GrSurface(gpu, dimensions, isProtected)
+ , GrMockTexture(gpu, dimensions, isProtected, mipMapsStatus, texInfo)
+ , GrMockRenderTarget(gpu, dimensions, sampleCnt, isProtected, rtInfo) {
this->registerWithCache(budgeted);
}
// Renderable wrapped backend texture.
- GrMockTextureRenderTarget(GrMockGpu* gpu, const GrSurfaceDesc& desc, int sampleCnt,
- GrProtected isProtected, GrMipMapsStatus mipMapsStatus,
+ GrMockTextureRenderTarget(GrMockGpu* gpu,
+ SkISize dimensions,
+ int sampleCnt,
+ GrProtected isProtected,
+ GrMipMapsStatus mipMapsStatus,
const GrMockTextureInfo& texInfo,
- const GrMockRenderTargetInfo& rtInfo, GrWrapCacheable cacheble)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, isProtected)
- , GrMockTexture(gpu, desc, isProtected, mipMapsStatus, texInfo)
- , GrMockRenderTarget(gpu, desc, sampleCnt, isProtected, rtInfo) {
- this->registerWithCacheWrapped(cacheble);
+ const GrMockRenderTargetInfo& rtInfo,
+ GrWrapCacheable cacheable)
+ : GrSurface(gpu, dimensions, isProtected)
+ , GrMockTexture(gpu, dimensions, isProtected, mipMapsStatus, texInfo)
+ , GrMockRenderTarget(gpu, dimensions, sampleCnt, isProtected, rtInfo) {
+ this->registerWithCacheWrapped(cacheable);
}
GrTexture* asTexture() override { return this; }
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 535ec46..d26170c 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -139,7 +139,7 @@
GrProtected,
const BackendTextureData*) override;
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&,
+ sk_sp<GrTexture> onCreateTexture(SkISize,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 1d467d5..2d1d072 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -440,7 +440,7 @@
return stencil;
}
-sk_sp<GrTexture> GrMtlGpu::onCreateTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrMtlGpu::onCreateTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -465,8 +465,8 @@
MTLTextureDescriptor* texDesc = [[MTLTextureDescriptor alloc] init];
texDesc.textureType = MTLTextureType2D;
texDesc.pixelFormat = mtlPixelFormat;
- texDesc.width = desc.fWidth;
- texDesc.height = desc.fHeight;
+ texDesc.width = dimensions.fWidth;
+ texDesc.height = dimensions.fHeight;
texDesc.depth = 1;
texDesc.mipmapLevelCount = mipLevelCount;
texDesc.sampleCount = 1;
@@ -482,11 +482,10 @@
GrMipMapsStatus mipMapsStatus =
mipLevelCount > 1 ? GrMipMapsStatus::kDirty : GrMipMapsStatus::kNotAllocated;
if (renderable == GrRenderable::kYes) {
- tex = GrMtlTextureRenderTarget::MakeNewTextureRenderTarget(this, budgeted,
- desc, renderTargetSampleCnt,
- texDesc, mipMapsStatus);
+ tex = GrMtlTextureRenderTarget::MakeNewTextureRenderTarget(
+ this, budgeted, dimensions, renderTargetSampleCnt, texDesc, mipMapsStatus);
} else {
- tex = GrMtlTexture::MakeNewTexture(this, budgeted, desc, texDesc, mipMapsStatus);
+ tex = GrMtlTexture::MakeNewTexture(this, budgeted, dimensions, texDesc, mipMapsStatus);
}
if (!tex) {
@@ -551,10 +550,7 @@
? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
- GrSurfaceDesc desc;
- desc.fWidth = dimensions.width();
- desc.fHeight = dimensions.height();
- auto tex = GrMtlTexture::MakeNewTexture(this, budgeted, desc, texDesc, mipMapsStatus);
+ auto tex = GrMtlTexture::MakeNewTexture(this, budgeted, dimensions, texDesc, mipMapsStatus);
if (!tex) {
return nullptr;
}
@@ -631,17 +627,6 @@
return GrGetMTLTexture(textureInfo.fTexture.get());
}
-static inline void init_surface_desc(GrSurfaceDesc* surfaceDesc, id<MTLTexture> mtlTexture,
- GrRenderable renderable) {
- if (@available(macOS 10.11, iOS 9.0, *)) {
- if (renderable == GrRenderable::kYes) {
- SkASSERT(MTLTextureUsageRenderTarget & mtlTexture.usage);
- }
- }
- surfaceDesc->fWidth = mtlTexture.width;
- surfaceDesc->fHeight = mtlTexture.height;
-}
-
sk_sp<GrTexture> GrMtlGpu::onWrapBackendTexture(const GrBackendTexture& backendTex,
GrColorType grColorType,
GrWrapOwnership,
@@ -652,10 +637,8 @@
return nullptr;
}
- GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kNo);
-
- return GrMtlTexture::MakeWrappedTexture(this, surfDesc, mtlTexture, cacheable, ioType);
+ return GrMtlTexture::MakeWrappedTexture(this, backendTex.dimensions(), mtlTexture, cacheable,
+ ioType);
}
sk_sp<GrTexture> GrMtlGpu::onWrapCompressedBackendTexture(const GrBackendTexture& backendTex,
@@ -666,10 +649,8 @@
return nullptr;
}
- GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kNo);
-
- return GrMtlTexture::MakeWrappedTexture(this, surfDesc, mtlTexture, cacheable, kRead_GrIOType);
+ return GrMtlTexture::MakeWrappedTexture(this, backendTex.dimensions(), mtlTexture, cacheable,
+ kRead_GrIOType);
}
sk_sp<GrTexture> GrMtlGpu::onWrapRenderableBackendTexture(const GrBackendTexture& backendTex,
@@ -689,14 +670,15 @@
return nullptr;
}
- GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kYes);
+ if (@available(macOS 10.11, iOS 9.0, *)) {
+ SkASSERT(MTLTextureUsageRenderTarget & mtlTexture.usage);
+ }
sampleCnt = caps.getRenderTargetSampleCount(sampleCnt, format);
SkASSERT(sampleCnt);
- return GrMtlTextureRenderTarget::MakeWrappedTextureRenderTarget(this, surfDesc, sampleCnt,
- mtlTexture, cacheable);
+ return GrMtlTextureRenderTarget::MakeWrappedTextureRenderTarget(
+ this, backendTex.dimensions(), sampleCnt, mtlTexture, cacheable);
}
sk_sp<GrRenderTarget> GrMtlGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT,
@@ -710,11 +692,12 @@
return nullptr;
}
- GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kYes);
+ if (@available(macOS 10.11, iOS 9.0, *)) {
+ SkASSERT(MTLTextureUsageRenderTarget & mtlTexture.usage);
+ }
- return GrMtlRenderTarget::MakeWrappedRenderTarget(this, surfDesc, backendRT.sampleCnt(),
- mtlTexture);
+ return GrMtlRenderTarget::MakeWrappedRenderTarget(this, backendRT.dimensions(),
+ backendRT.sampleCnt(), mtlTexture);
}
sk_sp<GrRenderTarget> GrMtlGpu::onWrapBackendTextureAsRenderTarget(
@@ -729,14 +712,17 @@
return nullptr;
}
- GrSurfaceDesc surfDesc;
- init_surface_desc(&surfDesc, mtlTexture, GrRenderable::kYes);
+ if (@available(macOS 10.11, iOS 9.0, *)) {
+ SkASSERT(MTLTextureUsageRenderTarget & mtlTexture.usage);
+ }
+
sampleCnt = this->mtlCaps().getRenderTargetSampleCount(sampleCnt, format);
if (!sampleCnt) {
return nullptr;
}
- return GrMtlRenderTarget::MakeWrappedRenderTarget(this, surfDesc, sampleCnt, mtlTexture);
+ return GrMtlRenderTarget::MakeWrappedRenderTarget(this, backendTex.dimensions(), sampleCnt,
+ mtlTexture);
}
bool GrMtlGpu::onRegenerateMipMapLevels(GrTexture* texture) {
diff --git a/src/gpu/mtl/GrMtlRenderTarget.h b/src/gpu/mtl/GrMtlRenderTarget.h
index 0ef1bcc..cae6a9d 100644
--- a/src/gpu/mtl/GrMtlRenderTarget.h
+++ b/src/gpu/mtl/GrMtlRenderTarget.h
@@ -20,7 +20,7 @@
class GrMtlRenderTarget: public GrRenderTarget {
public:
static sk_sp<GrMtlRenderTarget> MakeWrappedRenderTarget(GrMtlGpu*,
- const GrSurfaceDesc&,
+ SkISize,
int sampleCnt,
id<MTLTexture>);
@@ -39,14 +39,12 @@
protected:
GrMtlRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize,
int sampleCnt,
id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture);
- GrMtlRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
- id<MTLTexture> colorTexture);
+ GrMtlRenderTarget(GrMtlGpu* gpu, SkISize, id<MTLTexture> colorTexture);
GrMtlGpu* getMtlGpu() const;
@@ -74,15 +72,12 @@
// Extra param to disambiguate from constructor used by subclasses.
enum Wrapped { kWrapped };
GrMtlRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize,
int sampleCnt,
id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture,
Wrapped);
- GrMtlRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
- id<MTLTexture> colorTexture,
- Wrapped);
+ GrMtlRenderTarget(GrMtlGpu* gpu, SkISize, id<MTLTexture> colorTexture, Wrapped);
bool completeStencilAttachment() override;
diff --git a/src/gpu/mtl/GrMtlRenderTarget.mm b/src/gpu/mtl/GrMtlRenderTarget.mm
index bc1cb73..f773280 100644
--- a/src/gpu/mtl/GrMtlRenderTarget.mm
+++ b/src/gpu/mtl/GrMtlRenderTarget.mm
@@ -16,14 +16,13 @@
// Called for wrapped non-texture render targets.
GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture,
Wrapped)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , GrRenderTarget(
- gpu, {desc.fWidth, desc.fHeight}, sampleCnt, GrProtected::kNo)
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , GrRenderTarget(gpu, dimensions, sampleCnt, GrProtected::kNo)
, fColorTexture(colorTexture)
, fResolveTexture(resolveTexture) {
SkASSERT(sampleCnt > 1);
@@ -31,11 +30,11 @@
}
GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
id<MTLTexture> colorTexture,
Wrapped)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, 1, GrProtected::kNo)
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , GrRenderTarget(gpu, dimensions, 1, GrProtected::kNo)
, fColorTexture(colorTexture)
, fResolveTexture(nil) {
this->registerWithCacheWrapped(GrWrapCacheable::kNo);
@@ -43,28 +42,25 @@
// Called by subclass constructors.
GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , GrRenderTarget(
- gpu, {desc.fWidth, desc.fHeight}, sampleCnt, GrProtected::kNo)
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , GrRenderTarget(gpu, dimensions, sampleCnt, GrProtected::kNo)
, fColorTexture(colorTexture)
, fResolveTexture(resolveTexture) {
SkASSERT(sampleCnt > 1);
}
-GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
- id<MTLTexture> colorTexture)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, 1, GrProtected::kNo)
+GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu, SkISize dimensions, id<MTLTexture> colorTexture)
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , GrRenderTarget(gpu, dimensions, 1, GrProtected::kNo)
, fColorTexture(colorTexture)
, fResolveTexture(nil) {}
sk_sp<GrMtlRenderTarget> GrMtlRenderTarget::MakeWrappedRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
id<MTLTexture> texture) {
SkASSERT(nil != texture);
@@ -82,8 +78,8 @@
MTLTextureDescriptor* texDesc = [[MTLTextureDescriptor alloc] init];
texDesc.textureType = MTLTextureType2DMultisample;
texDesc.pixelFormat = format;
- texDesc.width = desc.fWidth;
- texDesc.height = desc.fHeight;
+ texDesc.width = dimensions.fWidth;
+ texDesc.height = dimensions.fHeight;
texDesc.depth = 1;
texDesc.mipmapLevelCount = 1;
texDesc.sampleCount = sampleCnt;
@@ -100,9 +96,9 @@
if (@available(macOS 10.11, iOS 9.0, *)) {
SkASSERT((MTLTextureUsageShaderRead|MTLTextureUsageRenderTarget) & colorTexture.usage);
}
- mtlRT = new GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, texture, kWrapped);
+ mtlRT = new GrMtlRenderTarget(gpu, dimensions, sampleCnt, colorTexture, texture, kWrapped);
} else {
- mtlRT = new GrMtlRenderTarget(gpu, desc, texture, kWrapped);
+ mtlRT = new GrMtlRenderTarget(gpu, dimensions, texture, kWrapped);
}
return sk_sp<GrMtlRenderTarget>(mtlRT);
diff --git a/src/gpu/mtl/GrMtlTexture.h b/src/gpu/mtl/GrMtlTexture.h
index c81aef0..6478e7a 100644
--- a/src/gpu/mtl/GrMtlTexture.h
+++ b/src/gpu/mtl/GrMtlTexture.h
@@ -16,13 +16,17 @@
class GrMtlTexture : public GrTexture {
public:
- static sk_sp<GrMtlTexture> MakeNewTexture(GrMtlGpu*, SkBudgeted budgeted,
- const GrSurfaceDesc&,
+ static sk_sp<GrMtlTexture> MakeNewTexture(GrMtlGpu*,
+ SkBudgeted budgeted,
+ SkISize,
MTLTextureDescriptor*,
GrMipMapsStatus);
- static sk_sp<GrMtlTexture> MakeWrappedTexture(GrMtlGpu*, const GrSurfaceDesc&, id<MTLTexture>,
- GrWrapCacheable, GrIOType);
+ static sk_sp<GrMtlTexture> MakeWrappedTexture(GrMtlGpu*,
+ SkISize,
+ id<MTLTexture>,
+ GrWrapCacheable,
+ GrIOType);
~GrMtlTexture() override;
@@ -37,7 +41,7 @@
bool reallocForMipmap(GrMtlGpu* gpu, uint32_t mipLevels);
protected:
- GrMtlTexture(GrMtlGpu*, const GrSurfaceDesc&, id<MTLTexture>, GrMipMapsStatus);
+ GrMtlTexture(GrMtlGpu*, SkISize, id<MTLTexture>, GrMipMapsStatus);
GrMtlGpu* getMtlGpu() const;
@@ -57,11 +61,15 @@
private:
enum Wrapped { kWrapped };
- GrMtlTexture(GrMtlGpu*, SkBudgeted, const GrSurfaceDesc&, id<MTLTexture>,
- GrMipMapsStatus);
+ GrMtlTexture(GrMtlGpu*, SkBudgeted, SkISize, id<MTLTexture>, GrMipMapsStatus);
- GrMtlTexture(GrMtlGpu*, Wrapped, const GrSurfaceDesc&, id<MTLTexture>, GrMipMapsStatus,
- GrWrapCacheable, GrIOType);
+ GrMtlTexture(GrMtlGpu*,
+ Wrapped,
+ SkISize,
+ id<MTLTexture>,
+ GrMipMapsStatus,
+ GrWrapCacheable,
+ GrIOType);
id<MTLTexture> fTexture;
diff --git a/src/gpu/mtl/GrMtlTexture.mm b/src/gpu/mtl/GrMtlTexture.mm
index aa252ab..fc98ad8 100644
--- a/src/gpu/mtl/GrMtlTexture.mm
+++ b/src/gpu/mtl/GrMtlTexture.mm
@@ -17,12 +17,11 @@
GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
id<MTLTexture> texture,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo,
- GrTextureType::k2D, mipMapsStatus)
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , INHERITED(gpu, dimensions, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus)
, fTexture(texture) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
if (@available(macOS 10.11, iOS 9.0, *)) {
@@ -37,14 +36,13 @@
GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
Wrapped,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
id<MTLTexture> texture,
GrMipMapsStatus mipMapsStatus,
GrWrapCacheable cacheable,
GrIOType ioType)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo,
- GrTextureType::k2D, mipMapsStatus)
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , INHERITED(gpu, dimensions, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus)
, fTexture(texture) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
if (@available(macOS 10.11, iOS 9.0, *)) {
@@ -58,12 +56,11 @@
}
GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
id<MTLTexture> texture,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo,
- GrTextureType::k2D, mipMapsStatus)
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , INHERITED(gpu, dimensions, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus)
, fTexture(texture) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
if (@available(macOS 10.11, iOS 9.0, *)) {
@@ -72,10 +69,11 @@
SkASSERT(!texture.framebufferOnly);
}
-sk_sp<GrMtlTexture> GrMtlTexture::MakeNewTexture(GrMtlGpu* gpu, SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
- MTLTextureDescriptor* texDesc,
- GrMipMapsStatus mipMapsStatus) {
+sk_sp<GrMtlTexture> GrMtlTexture::MakeNewTexture(GrMtlGpu* gpu,
+ SkBudgeted budgeted,
+ SkISize dimensions,
+ MTLTextureDescriptor* texDesc,
+ GrMipMapsStatus mipMapsStatus) {
id<MTLTexture> texture = [gpu->device() newTextureWithDescriptor:texDesc];
if (!texture) {
return nullptr;
@@ -83,11 +81,11 @@
if (@available(macOS 10.11, iOS 9.0, *)) {
SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
}
- return sk_sp<GrMtlTexture>(new GrMtlTexture(gpu, budgeted, desc, texture, mipMapsStatus));
+ return sk_sp<GrMtlTexture>(new GrMtlTexture(gpu, budgeted, dimensions, texture, mipMapsStatus));
}
sk_sp<GrMtlTexture> GrMtlTexture::MakeWrappedTexture(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
id<MTLTexture> texture,
GrWrapCacheable cacheable,
GrIOType ioType) {
@@ -97,8 +95,8 @@
}
GrMipMapsStatus mipMapsStatus = texture.mipmapLevelCount > 1 ? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
- return sk_sp<GrMtlTexture>(new GrMtlTexture(gpu, kWrapped, desc, texture, mipMapsStatus,
- cacheable, ioType));
+ return sk_sp<GrMtlTexture>(
+ new GrMtlTexture(gpu, kWrapped, dimensions, texture, mipMapsStatus, cacheable, ioType));
}
GrMtlTexture::~GrMtlTexture() {
diff --git a/src/gpu/mtl/GrMtlTextureRenderTarget.h b/src/gpu/mtl/GrMtlTextureRenderTarget.h
index 2e1bda7..bb10e5b 100644
--- a/src/gpu/mtl/GrMtlTextureRenderTarget.h
+++ b/src/gpu/mtl/GrMtlTextureRenderTarget.h
@@ -15,13 +15,13 @@
public:
static sk_sp<GrMtlTextureRenderTarget> MakeNewTextureRenderTarget(GrMtlGpu*,
SkBudgeted,
- const GrSurfaceDesc&,
+ SkISize,
int sampleCnt,
MTLTextureDescriptor*,
GrMipMapsStatus);
static sk_sp<GrMtlTextureRenderTarget> MakeWrappedTextureRenderTarget(GrMtlGpu*,
- const GrSurfaceDesc&,
+ SkISize,
int sampleCnt,
id<MTLTexture>,
GrWrapCacheable);
@@ -43,7 +43,7 @@
private:
GrMtlTextureRenderTarget(GrMtlGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize,
int sampleCnt,
id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture,
@@ -51,12 +51,12 @@
GrMtlTextureRenderTarget(GrMtlGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize,
id<MTLTexture> colorTexture,
GrMipMapsStatus);
GrMtlTextureRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize,
int sampleCnt,
id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture,
@@ -64,7 +64,7 @@
GrWrapCacheable cacheable);
GrMtlTextureRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize,
id<MTLTexture> colorTexture,
GrMipMapsStatus,
GrWrapCacheable cacheable);
diff --git a/src/gpu/mtl/GrMtlTextureRenderTarget.mm b/src/gpu/mtl/GrMtlTextureRenderTarget.mm
index b6dc2ec..57f2b4b 100644
--- a/src/gpu/mtl/GrMtlTextureRenderTarget.mm
+++ b/src/gpu/mtl/GrMtlTextureRenderTarget.mm
@@ -15,53 +15,53 @@
GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , GrMtlTexture(gpu, desc, resolveTexture, mipMapsStatus)
- , GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, resolveTexture) {
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , GrMtlTexture(gpu, dimensions, resolveTexture, mipMapsStatus)
+ , GrMtlRenderTarget(gpu, dimensions, sampleCnt, colorTexture, resolveTexture) {
this->registerWithCache(budgeted);
}
GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
id<MTLTexture> colorTexture,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , GrMtlTexture(gpu, desc, colorTexture, mipMapsStatus)
- , GrMtlRenderTarget(gpu, desc, colorTexture) {
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , GrMtlTexture(gpu, dimensions, colorTexture, mipMapsStatus)
+ , GrMtlRenderTarget(gpu, dimensions, colorTexture) {
this->registerWithCache(budgeted);
}
GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture,
GrMipMapsStatus mipMapsStatus,
GrWrapCacheable cacheable)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , GrMtlTexture(gpu, desc, resolveTexture, mipMapsStatus)
- , GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, resolveTexture) {
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , GrMtlTexture(gpu, dimensions, resolveTexture, mipMapsStatus)
+ , GrMtlRenderTarget(gpu, dimensions, sampleCnt, colorTexture, resolveTexture) {
this->registerWithCacheWrapped(cacheable);
}
GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
id<MTLTexture> colorTexture,
GrMipMapsStatus mipMapsStatus,
GrWrapCacheable cacheable)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, GrProtected::kNo)
- , GrMtlTexture(gpu, desc, colorTexture, mipMapsStatus)
- , GrMtlRenderTarget(gpu, desc, colorTexture) {
+ : GrSurface(gpu, dimensions, GrProtected::kNo)
+ , GrMtlTexture(gpu, dimensions, colorTexture, mipMapsStatus)
+ , GrMtlRenderTarget(gpu, dimensions, colorTexture) {
this->registerWithCacheWrapped(cacheable);
}
-id<MTLTexture> create_msaa_texture(GrMtlGpu* gpu, const GrSurfaceDesc& desc, MTLPixelFormat format,
+id<MTLTexture> create_msaa_texture(GrMtlGpu* gpu, SkISize dimensions, MTLPixelFormat format,
int sampleCnt) {
if (!gpu->mtlCaps().isFormatRenderable(format, sampleCnt)) {
return nullptr;
@@ -69,8 +69,8 @@
MTLTextureDescriptor* texDesc = [[MTLTextureDescriptor alloc] init];
texDesc.textureType = MTLTextureType2DMultisample;
texDesc.pixelFormat = format;
- texDesc.width = desc.fWidth;
- texDesc.height = desc.fHeight;
+ texDesc.width = dimensions.fWidth;
+ texDesc.height = dimensions.fHeight;
texDesc.depth = 1;
texDesc.mipmapLevelCount = 1;
texDesc.sampleCount = sampleCnt;
@@ -86,7 +86,7 @@
sk_sp<GrMtlTextureRenderTarget> GrMtlTextureRenderTarget::MakeNewTextureRenderTarget(
GrMtlGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
MTLTextureDescriptor* texDesc,
GrMipMapsStatus mipMapsStatus) {
@@ -99,8 +99,8 @@
}
if (sampleCnt > 1) {
- id<MTLTexture> colorTexture = create_msaa_texture(gpu, desc, texture.pixelFormat,
- sampleCnt);
+ id<MTLTexture> colorTexture =
+ create_msaa_texture(gpu, dimensions, texture.pixelFormat, sampleCnt);
if (!colorTexture) {
return nullptr;
}
@@ -108,16 +108,16 @@
SkASSERT((MTLTextureUsageShaderRead|MTLTextureUsageRenderTarget) & colorTexture.usage);
}
return sk_sp<GrMtlTextureRenderTarget>(new GrMtlTextureRenderTarget(
- gpu, budgeted, desc, sampleCnt, colorTexture, texture, mipMapsStatus));
+ gpu, budgeted, dimensions, sampleCnt, colorTexture, texture, mipMapsStatus));
} else {
return sk_sp<GrMtlTextureRenderTarget>(
- new GrMtlTextureRenderTarget(gpu, budgeted, desc, texture, mipMapsStatus));
+ new GrMtlTextureRenderTarget(gpu, budgeted, dimensions, texture, mipMapsStatus));
}
}
sk_sp<GrMtlTextureRenderTarget> GrMtlTextureRenderTarget::MakeWrappedTextureRenderTarget(
GrMtlGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
id<MTLTexture> texture,
GrWrapCacheable cacheable) {
@@ -129,8 +129,8 @@
? GrMipMapsStatus::kDirty
: GrMipMapsStatus::kNotAllocated;
if (sampleCnt > 1) {
- id<MTLTexture> colorTexture = create_msaa_texture(gpu, desc, texture.pixelFormat,
- sampleCnt);
+ id<MTLTexture> colorTexture =
+ create_msaa_texture(gpu, dimensions, texture.pixelFormat, sampleCnt);
if (!colorTexture) {
return nullptr;
}
@@ -138,9 +138,9 @@
SkASSERT((MTLTextureUsageShaderRead|MTLTextureUsageRenderTarget) & colorTexture.usage);
}
return sk_sp<GrMtlTextureRenderTarget>(new GrMtlTextureRenderTarget(
- gpu, desc, sampleCnt, colorTexture, texture, mipMapsStatus, cacheable));
+ gpu, dimensions, sampleCnt, colorTexture, texture, mipMapsStatus, cacheable));
} else {
return sk_sp<GrMtlTextureRenderTarget>(
- new GrMtlTextureRenderTarget(gpu, desc, texture, mipMapsStatus, cacheable));
+ new GrMtlTextureRenderTarget(gpu, dimensions, texture, mipMapsStatus, cacheable));
}
}
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 9944693..77f60ee 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -402,9 +402,9 @@
std::unique_ptr<SkCanvas::Lattice::RectType[]> flags;
std::unique_ptr<SkColor[]> colors;
SkIRect subset;
- GrSurfaceDesc desc;
- desc.fWidth = random->nextRangeU(1, 1000);
- desc.fHeight = random->nextRangeU(1, 1000);
+ SkISize dims;
+ dims.fWidth = random->nextRangeU(1, 1000);
+ dims.fHeight = random->nextRangeU(1, 1000);
GrSurfaceOrigin origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin
: kBottomLeft_GrSurfaceOrigin;
const GrBackendFormat format =
@@ -413,7 +413,7 @@
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, GrColorType::kRGBA_8888);
auto proxy = context->priv().proxyProvider()->createProxy(format,
- desc,
+ dims,
swizzle,
GrRenderable::kNo,
1,
@@ -425,12 +425,12 @@
do {
if (random->nextBool()) {
- subset.fLeft = random->nextULessThan(desc.fWidth);
- subset.fRight = random->nextRangeU(subset.fLeft + 1, desc.fWidth);
- subset.fTop = random->nextULessThan(desc.fHeight);
- subset.fBottom = random->nextRangeU(subset.fTop + 1, desc.fHeight);
+ subset.fLeft = random->nextULessThan(dims.fWidth);
+ subset.fRight = random->nextRangeU(subset.fLeft + 1, dims.fWidth);
+ subset.fTop = random->nextULessThan(dims.fHeight);
+ subset.fBottom = random->nextRangeU(subset.fTop + 1, dims.fHeight);
} else {
- subset.setXYWH(0, 0, desc.fWidth, desc.fHeight);
+ subset.setXYWH(0, 0, dims.fWidth, dims.fHeight);
}
// SkCanvas::Lattice allows bounds to be null. However, SkCanvas creates a temp Lattice with
// a non-null bounds before creating a SkLatticeIter since SkLatticeIter requires a bounds.
@@ -458,7 +458,7 @@
lattice.fRectTypes = nullptr;
lattice.fColors = nullptr;
}
- } while (!SkLatticeIter::Valid(desc.fWidth, desc.fHeight, lattice));
+ } while (!SkLatticeIter::Valid(dims.fWidth, dims.fHeight, lattice));
SkRect dst;
dst.fLeft = random->nextRangeScalar(-2000.5f, 1000.f);
dst.fTop = random->nextRangeScalar(-2000.5f, 1000.f);
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 7cf6eab..d6b05be 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -1275,9 +1275,9 @@
#include "src/gpu/GrRecordingContextPriv.h"
GR_DRAW_OP_TEST_DEFINE(TextureOp) {
- GrSurfaceDesc desc;
- desc.fHeight = random->nextULessThan(90) + 10;
- desc.fWidth = random->nextULessThan(90) + 10;
+ SkISize dims;
+ dims.fHeight = random->nextULessThan(90) + 10;
+ dims.fWidth = random->nextULessThan(90) + 10;
auto origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
GrMipMapped mipMapped = random->nextBool() ? GrMipMapped::kYes : GrMipMapped::kNo;
SkBackingFit fit = SkBackingFit::kExact;
@@ -1291,7 +1291,7 @@
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
- format, desc, swizzle, GrRenderable::kNo, 1, origin, mipMapped, fit, SkBudgeted::kNo,
+ format, dims, swizzle, GrRenderable::kNo, 1, origin, mipMapped, fit, SkBudgeted::kNo,
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
SkRect rect = GrTest::TestRect(random);
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index ae15986..ff5f8ff 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -838,9 +838,6 @@
VK_FORMAT_R8G8B8A8_UNORM, 1, false, false)) {
return false;
}
- GrSurfaceDesc surfDesc;
- surfDesc.fWidth = width;
- surfDesc.fHeight = height;
VkImageUsageFlags usageFlags = VK_IMAGE_USAGE_SAMPLED_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
@@ -857,8 +854,8 @@
imageDesc.fUsageFlags = usageFlags;
imageDesc.fMemProps = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
- copyTexture = GrVkTexture::MakeNewTexture(this, SkBudgeted::kYes, surfDesc, imageDesc,
- GrMipMapsStatus::kNotAllocated);
+ copyTexture = GrVkTexture::MakeNewTexture(this, SkBudgeted::kYes, {width, height},
+ imageDesc, GrMipMapsStatus::kNotAllocated);
if (!copyTexture) {
return false;
}
@@ -995,7 +992,7 @@
////////////////////////////////////////////////////////////////////////////////
// TODO: make this take a GrMipMapped
-sk_sp<GrTexture> GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc,
+sk_sp<GrTexture> GrVkGpu::onCreateTexture(SkISize dimensions,
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -1027,8 +1024,8 @@
GrVkImage::ImageDesc imageDesc;
imageDesc.fImageType = VK_IMAGE_TYPE_2D;
imageDesc.fFormat = pixelFormat;
- imageDesc.fWidth = desc.fWidth;
- imageDesc.fHeight = desc.fHeight;
+ imageDesc.fWidth = dimensions.fWidth;
+ imageDesc.fHeight = dimensions.fHeight;
imageDesc.fLevels = mipLevelCount;
imageDesc.fSamples = 1;
imageDesc.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
@@ -1041,9 +1038,9 @@
sk_sp<GrVkTexture> tex;
if (renderable == GrRenderable::kYes) {
tex = GrVkTextureRenderTarget::MakeNewTextureRenderTarget(
- this, budgeted, desc, renderTargetSampleCnt, imageDesc, mipMapsStatus);
+ this, budgeted, dimensions, renderTargetSampleCnt, imageDesc, mipMapsStatus);
} else {
- tex = GrVkTexture::MakeNewTexture(this, budgeted, desc, imageDesc, mipMapsStatus);
+ tex = GrVkTexture::MakeNewTexture(this, budgeted, dimensions, imageDesc, mipMapsStatus);
}
if (!tex) {
@@ -1121,11 +1118,7 @@
? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
- GrSurfaceDesc desc;
- desc.fWidth = dimensions.width();
- desc.fHeight = dimensions.height();
- auto tex = GrVkTexture::MakeNewTexture(this, budgeted, desc, imageDesc,
- mipMapsStatus);
+ auto tex = GrVkTexture::MakeNewTexture(this, budgeted, dimensions, imageDesc, mipMapsStatus);
if (!tex) {
return nullptr;
}
@@ -1236,14 +1229,10 @@
return nullptr;
}
- GrSurfaceDesc surfDesc;
- surfDesc.fWidth = backendTex.width();
- surfDesc.fHeight = backendTex.height();
-
sk_sp<GrVkImageLayout> layout = backendTex.getGrVkImageLayout();
SkASSERT(layout);
- return GrVkTexture::MakeWrappedTexture(this, surfDesc, ownership, cacheable, ioType, imageInfo,
- std::move(layout));
+ return GrVkTexture::MakeWrappedTexture(this, backendTex.dimensions(), ownership, cacheable,
+ ioType, imageInfo, std::move(layout));
}
sk_sp<GrTexture> GrVkGpu::onWrapCompressedBackendTexture(const GrBackendTexture& beTex,
@@ -1267,13 +1256,9 @@
return nullptr;
}
- GrSurfaceDesc surfDesc;
- surfDesc.fWidth = beTex.width();
- surfDesc.fHeight = beTex.height();
-
sk_sp<GrVkImageLayout> layout = beTex.getGrVkImageLayout();
SkASSERT(layout);
- return GrVkTexture::MakeWrappedTexture(this, surfDesc, ownership, cacheable,
+ return GrVkTexture::MakeWrappedTexture(this, beTex.dimensions(), ownership, cacheable,
kRead_GrIOType, imageInfo, std::move(layout));
}
@@ -1303,16 +1288,14 @@
return nullptr;
}
- GrSurfaceDesc surfDesc;
- surfDesc.fWidth = backendTex.width();
- surfDesc.fHeight = backendTex.height();
sampleCnt = this->vkCaps().getRenderTargetSampleCount(sampleCnt, imageInfo.fFormat);
sk_sp<GrVkImageLayout> layout = backendTex.getGrVkImageLayout();
SkASSERT(layout);
- return GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget(
- this, surfDesc, sampleCnt, ownership, cacheable, imageInfo, std::move(layout));
+ return GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget(this, backendTex.dimensions(),
+ sampleCnt, ownership, cacheable,
+ imageInfo, std::move(layout));
}
sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT,
@@ -1342,14 +1325,10 @@
return nullptr;
}
- GrSurfaceDesc desc;
- desc.fWidth = backendRT.width();
- desc.fHeight = backendRT.height();
-
sk_sp<GrVkImageLayout> layout = backendRT.getGrVkImageLayout();
- sk_sp<GrVkRenderTarget> tgt =
- GrVkRenderTarget::MakeWrappedRenderTarget(this, desc, 1, info, std::move(layout));
+ sk_sp<GrVkRenderTarget> tgt = GrVkRenderTarget::MakeWrappedRenderTarget(
+ this, backendRT.dimensions(), 1, info, std::move(layout));
// We don't allow the client to supply a premade stencil buffer. We always create one if needed.
SkASSERT(!backendRT.stencilBits());
@@ -1380,10 +1359,6 @@
return nullptr;
}
- GrSurfaceDesc desc;
- desc.fWidth = tex.width();
- desc.fHeight = tex.height();
-
sampleCnt = this->vkCaps().getRenderTargetSampleCount(sampleCnt, imageInfo.fFormat);
if (!sampleCnt) {
return nullptr;
@@ -1392,7 +1367,7 @@
sk_sp<GrVkImageLayout> layout = tex.getGrVkImageLayout();
SkASSERT(layout);
- return GrVkRenderTarget::MakeWrappedRenderTarget(this, desc, sampleCnt, imageInfo,
+ return GrVkRenderTarget::MakeWrappedRenderTarget(this, tex.dimensions(), sampleCnt, imageInfo,
std::move(layout));
}
@@ -1412,11 +1387,7 @@
return nullptr;
}
- GrSurfaceDesc desc;
- desc.fWidth = imageInfo.width();
- desc.fHeight = imageInfo.height();
-
- return GrVkRenderTarget::MakeSecondaryCBRenderTarget(this, desc, vkInfo);
+ return GrVkRenderTarget::MakeSecondaryCBRenderTarget(this, imageInfo.dimensions(), vkInfo);
}
bool GrVkGpu::onRegenerateMipMapLevels(GrTexture* tex) {
@@ -2465,10 +2436,6 @@
}
// Make a new surface that is RGBA to copy the RGB surface into.
- GrSurfaceDesc surfDesc;
- surfDesc.fWidth = width;
- surfDesc.fHeight = height;
-
VkImageUsageFlags usageFlags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
VK_IMAGE_USAGE_SAMPLED_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
@@ -2486,7 +2453,8 @@
imageDesc.fMemProps = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
copySurface = GrVkTextureRenderTarget::MakeNewTextureRenderTarget(
- this, SkBudgeted::kYes, surfDesc, 1, imageDesc, GrMipMapsStatus::kNotAllocated);
+ this, SkBudgeted::kYes, {width, height}, 1, imageDesc,
+ GrMipMapsStatus::kNotAllocated);
if (!copySurface) {
return false;
}
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 9b0b583..3007ec1 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -185,7 +185,7 @@
GrProtected,
const BackendTextureData*) override;
- sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&,
+ sk_sp<GrTexture> onCreateTexture(SkISize,
const GrBackendFormat&,
GrRenderable,
int renderTargetSampleCnt,
diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp
index 4c7a327..cf136f3 100644
--- a/src/gpu/vk/GrVkRenderTarget.cpp
+++ b/src/gpu/vk/GrVkRenderTarget.cpp
@@ -23,7 +23,7 @@
// We're virtually derived from GrSurface (via GrRenderTarget) so its
// constructor must be explicitly called.
GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
@@ -31,10 +31,10 @@
sk_sp<GrVkImageLayout> msaaLayout,
const GrVkImageView* colorAttachmentView,
const GrVkImageView* resolveAttachmentView)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed)
// for the moment we only support 1:1 color to stencil
- , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, sampleCnt, info.fProtected)
+ , GrRenderTarget(gpu, dimensions, sampleCnt, info.fProtected)
, fColorAttachmentView(colorAttachmentView)
, fMSAAImage(new GrVkImage(msaaInfo, std::move(msaaLayout),
GrBackendObjectOwnership::kOwned))
@@ -49,7 +49,7 @@
// We're virtually derived from GrSurface (via GrRenderTarget) so its
// constructor must be explicitly called.
GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
@@ -58,10 +58,10 @@
const GrVkImageView* colorAttachmentView,
const GrVkImageView* resolveAttachmentView,
GrBackendObjectOwnership ownership)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, std::move(layout), ownership)
// for the moment we only support 1:1 color to stencil
- , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, sampleCnt, info.fProtected)
+ , GrRenderTarget(gpu, dimensions, sampleCnt, info.fProtected)
, fColorAttachmentView(colorAttachmentView)
, fMSAAImage(
new GrVkImage(msaaInfo, std::move(msaaLayout), GrBackendObjectOwnership::kOwned))
@@ -75,13 +75,13 @@
// We're virtually derived from GrSurface (via GrRenderTarget) so its
// constructor must be explicitly called.
GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* colorAttachmentView)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed)
- , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, 1, info.fProtected)
+ , GrRenderTarget(gpu, dimensions, 1, info.fProtected)
, fColorAttachmentView(colorAttachmentView)
, fMSAAImage(nullptr)
, fResolveAttachmentView(nullptr)
@@ -93,30 +93,29 @@
// We're virtually derived from GrSurface (via GrRenderTarget) so its
// constructor must be explicitly called.
GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* colorAttachmentView,
GrBackendObjectOwnership ownership)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, std::move(layout), ownership)
- , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, 1, info.fProtected)
+ , GrRenderTarget(gpu, dimensions, 1, info.fProtected)
, fColorAttachmentView(colorAttachmentView)
, fMSAAImage(nullptr)
, fResolveAttachmentView(nullptr)
, fCachedFramebuffer(nullptr)
- , fCachedSimpleRenderPass(nullptr) {
-}
+ , fCachedSimpleRenderPass(nullptr) {}
GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkRenderPass* renderPass,
VkCommandBuffer secondaryCommandBuffer)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed, true)
- , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, 1, info.fProtected)
+ , GrRenderTarget(gpu, dimensions, 1, info.fProtected)
, fColorAttachmentView(nullptr)
, fMSAAImage(nullptr)
, fResolveAttachmentView(nullptr)
@@ -128,7 +127,7 @@
}
sk_sp<GrVkRenderTarget> GrVkRenderTarget::MakeWrappedRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout) {
@@ -147,8 +146,8 @@
GrVkImage::ImageDesc msImageDesc;
msImageDesc.fImageType = VK_IMAGE_TYPE_2D;
msImageDesc.fFormat = pixelFormat;
- msImageDesc.fWidth = desc.fWidth;
- msImageDesc.fHeight = desc.fHeight;
+ msImageDesc.fWidth = dimensions.fWidth;
+ msImageDesc.fHeight = dimensions.fHeight;
msImageDesc.fLevels = 1;
msImageDesc.fSamples = sampleCnt;
msImageDesc.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
@@ -193,18 +192,18 @@
GrVkRenderTarget* vkRT;
if (sampleCnt > 1) {
- vkRT = new GrVkRenderTarget(gpu, desc, sampleCnt, info, std::move(layout), msInfo,
+ vkRT = new GrVkRenderTarget(gpu, dimensions, sampleCnt, info, std::move(layout), msInfo,
std::move(msLayout), colorAttachmentView,
resolveAttachmentView);
} else {
- vkRT = new GrVkRenderTarget(gpu, desc, info, std::move(layout), colorAttachmentView);
+ vkRT = new GrVkRenderTarget(gpu, dimensions, info, std::move(layout), colorAttachmentView);
}
return sk_sp<GrVkRenderTarget>(vkRT);
}
sk_sp<GrVkRenderTarget> GrVkRenderTarget::MakeSecondaryCBRenderTarget(
- GrVkGpu* gpu, const GrSurfaceDesc& desc, const GrVkDrawableInfo& vkInfo) {
+ GrVkGpu* gpu, SkISize dimensions, const GrVkDrawableInfo& vkInfo) {
// We only set the few properties of the GrVkImageInfo that we know like layout and format. The
// others we keep at the default "null" values.
GrVkImageInfo info;
@@ -224,7 +223,7 @@
return nullptr;
}
- GrVkRenderTarget* vkRT = new GrVkRenderTarget(gpu, desc, info, std::move(layout), rp,
+ GrVkRenderTarget* vkRT = new GrVkRenderTarget(gpu, dimensions, info, std::move(layout), rp,
vkInfo.fSecondaryCommandBuffer);
return sk_sp<GrVkRenderTarget>(vkRT);
diff --git a/src/gpu/vk/GrVkRenderTarget.h b/src/gpu/vk/GrVkRenderTarget.h
index 8224183..224c40c 100644
--- a/src/gpu/vk/GrVkRenderTarget.h
+++ b/src/gpu/vk/GrVkRenderTarget.h
@@ -32,11 +32,11 @@
class GrVkRenderTarget: public GrRenderTarget, public virtual GrVkImage {
public:
- static sk_sp<GrVkRenderTarget> MakeWrappedRenderTarget(GrVkGpu*, const GrSurfaceDesc&,
- int sampleCnt, const GrVkImageInfo&,
+ static sk_sp<GrVkRenderTarget> MakeWrappedRenderTarget(GrVkGpu*, SkISize, int sampleCnt,
+ const GrVkImageInfo&,
sk_sp<GrVkImageLayout>);
- static sk_sp<GrVkRenderTarget> MakeSecondaryCBRenderTarget(GrVkGpu*, const GrSurfaceDesc&,
+ static sk_sp<GrVkRenderTarget> MakeSecondaryCBRenderTarget(GrVkGpu*, SkISize,
const GrVkDrawableInfo& vkInfo);
~GrVkRenderTarget() override;
@@ -96,7 +96,7 @@
protected:
GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
@@ -107,7 +107,7 @@
GrBackendObjectOwnership);
GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* colorAttachmentView,
@@ -130,7 +130,7 @@
private:
GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
@@ -140,14 +140,13 @@
const GrVkImageView* resolveAttachmentView);
GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* colorAttachmentView);
-
GrVkRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkRenderPass* renderPass,
diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp
index b12411d..ca8a2ce 100644
--- a/src/gpu/vk/GrVkTexture.cpp
+++ b/src/gpu/vk/GrVkTexture.cpp
@@ -21,15 +21,14 @@
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
GrVkTexture::GrVkTexture(GrVkGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* view,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kOwned)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, info.fProtected,
- GrTextureType::k2D, mipMapsStatus)
+ , INHERITED(gpu, dimensions, info.fProtected, GrTextureType::k2D, mipMapsStatus)
, fTextureView(view)
, fDescSetCache(kMaxCachedDescSets) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount));
@@ -41,13 +40,13 @@
}
}
-GrVkTexture::GrVkTexture(GrVkGpu* gpu, const GrSurfaceDesc& desc, const GrVkImageInfo& info,
+GrVkTexture::GrVkTexture(GrVkGpu* gpu, SkISize dimensions, const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout, const GrVkImageView* view,
GrMipMapsStatus mipMapsStatus, GrBackendObjectOwnership ownership,
GrWrapCacheable cacheable, GrIOType ioType, bool isExternal)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, std::move(layout), ownership)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, info.fProtected,
+ , INHERITED(gpu, dimensions, info.fProtected,
isExternal ? GrTextureType::kExternal : GrTextureType::k2D, mipMapsStatus)
, fTextureView(view)
, fDescSetCache(kMaxCachedDescSets) {
@@ -60,16 +59,15 @@
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
GrVkTexture::GrVkTexture(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* view,
GrMipMapsStatus mipMapsStatus,
GrBackendObjectOwnership ownership)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, layout, ownership)
- , INHERITED(gpu, {desc.fWidth, desc.fHeight}, info.fProtected, GrTextureType::k2D,
- mipMapsStatus)
+ , INHERITED(gpu, dimensions, info.fProtected, GrTextureType::k2D, mipMapsStatus)
, fTextureView(view)
, fDescSetCache(kMaxCachedDescSets) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount));
@@ -79,7 +77,7 @@
}
sk_sp<GrVkTexture> GrVkTexture::MakeNewTexture(GrVkGpu* gpu, SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImage::ImageDesc& imageDesc,
GrMipMapsStatus mipMapsStatus) {
SkASSERT(imageDesc.fUsageFlags & VK_IMAGE_USAGE_SAMPLED_BIT);
@@ -98,12 +96,12 @@
}
sk_sp<GrVkImageLayout> layout(new GrVkImageLayout(info.fImageLayout));
- return sk_sp<GrVkTexture>(new GrVkTexture(gpu, budgeted, desc, info, std::move(layout),
+ return sk_sp<GrVkTexture>(new GrVkTexture(gpu, budgeted, dimensions, info, std::move(layout),
imageView, mipMapsStatus));
}
sk_sp<GrVkTexture> GrVkTexture::MakeWrappedTexture(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrWrapOwnership wrapOwnership,
GrWrapCacheable cacheable,
GrIOType ioType,
@@ -127,7 +125,7 @@
? GrBackendObjectOwnership::kBorrowed : GrBackendObjectOwnership::kOwned;
bool isExternal = info.fYcbcrConversionInfo.isValid() &&
(info.fYcbcrConversionInfo.fExternalFormat != 0);
- return sk_sp<GrVkTexture>(new GrVkTexture(gpu, desc, info, std::move(layout), imageView,
+ return sk_sp<GrVkTexture>(new GrVkTexture(gpu, dimensions, info, std::move(layout), imageView,
mipMapsStatus, ownership, cacheable, ioType,
isExternal));
}
diff --git a/src/gpu/vk/GrVkTexture.h b/src/gpu/vk/GrVkTexture.h
index 558eb4d..12e0dec 100644
--- a/src/gpu/vk/GrVkTexture.h
+++ b/src/gpu/vk/GrVkTexture.h
@@ -23,12 +23,16 @@
public:
static sk_sp<GrVkTexture> MakeNewTexture(GrVkGpu*,
SkBudgeted budgeted,
- const GrSurfaceDesc&,
+ SkISize dimensions,
const GrVkImage::ImageDesc&,
GrMipMapsStatus);
- static sk_sp<GrVkTexture> MakeWrappedTexture(GrVkGpu*, const GrSurfaceDesc&, GrWrapOwnership,
- GrWrapCacheable, GrIOType, const GrVkImageInfo&,
+ static sk_sp<GrVkTexture> MakeWrappedTexture(GrVkGpu*,
+ SkISize dimensions,
+ GrWrapOwnership,
+ GrWrapCacheable,
+ GrIOType,
+ const GrVkImageInfo&,
sk_sp<GrVkImageLayout>);
~GrVkTexture() override;
@@ -54,8 +58,13 @@
void addDescriptorSetToCache(const GrVkDescriptorSet*, GrSamplerState);
protected:
- GrVkTexture(GrVkGpu*, const GrSurfaceDesc&, const GrVkImageInfo&, sk_sp<GrVkImageLayout>,
- const GrVkImageView*, GrMipMapsStatus, GrBackendObjectOwnership);
+ GrVkTexture(GrVkGpu*,
+ SkISize dimensions,
+ const GrVkImageInfo&,
+ sk_sp<GrVkImageLayout>,
+ const GrVkImageView*,
+ GrMipMapsStatus,
+ GrBackendObjectOwnership);
GrVkGpu* getVkGpu() const;
@@ -69,10 +78,9 @@
void willRemoveLastRef() override;
private:
- GrVkTexture(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&, const GrVkImageInfo&,
- sk_sp<GrVkImageLayout> layout, const GrVkImageView* imageView,
- GrMipMapsStatus);
- GrVkTexture(GrVkGpu*, const GrSurfaceDesc&, const GrVkImageInfo&, sk_sp<GrVkImageLayout>,
+ GrVkTexture(GrVkGpu*, SkBudgeted, SkISize, const GrVkImageInfo&, sk_sp<GrVkImageLayout> layout,
+ const GrVkImageView* imageView, GrMipMapsStatus);
+ GrVkTexture(GrVkGpu*, SkISize, const GrVkImageInfo&, sk_sp<GrVkImageLayout>,
const GrVkImageView*, GrMipMapsStatus, GrBackendObjectOwnership, GrWrapCacheable,
GrIOType, bool isExternal);
diff --git a/src/gpu/vk/GrVkTextureRenderTarget.cpp b/src/gpu/vk/GrVkTextureRenderTarget.cpp
index bb51197..c7c2bdd 100644
--- a/src/gpu/vk/GrVkTextureRenderTarget.cpp
+++ b/src/gpu/vk/GrVkTextureRenderTarget.cpp
@@ -20,7 +20,7 @@
GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
@@ -30,12 +30,12 @@
const GrVkImageView* colorAttachmentView,
const GrVkImageView* resolveAttachmentView,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, layout, GrBackendObjectOwnership::kOwned)
- , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus,
+ , GrVkTexture(gpu, dimensions, info, layout, texView, mipMapsStatus,
GrBackendObjectOwnership::kOwned)
- , GrVkRenderTarget(gpu, desc, sampleCnt, info, layout, msaaInfo, std::move(msaaLayout),
- colorAttachmentView, resolveAttachmentView,
+ , GrVkRenderTarget(gpu, dimensions, sampleCnt, info, layout, msaaInfo,
+ std::move(msaaLayout), colorAttachmentView, resolveAttachmentView,
GrBackendObjectOwnership::kOwned) {
SkASSERT(info.fProtected == msaaInfo.fProtected);
this->registerWithCache(budgeted);
@@ -43,23 +43,23 @@
GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* texView,
const GrVkImageView* colorAttachmentView,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, layout, GrBackendObjectOwnership::kOwned)
- , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus,
+ , GrVkTexture(gpu, dimensions, info, layout, texView, mipMapsStatus,
GrBackendObjectOwnership::kOwned)
- , GrVkRenderTarget(gpu, desc, info, layout, colorAttachmentView,
+ , GrVkRenderTarget(gpu, dimensions, info, layout, colorAttachmentView,
GrBackendObjectOwnership::kOwned) {
this->registerWithCache(budgeted);
}
GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
@@ -71,17 +71,18 @@
GrMipMapsStatus mipMapsStatus,
GrBackendObjectOwnership ownership,
GrWrapCacheable cacheable)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, layout, ownership)
- , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, ownership)
- , GrVkRenderTarget(gpu, desc, sampleCnt, info, layout, msaaInfo, std::move(msaaLayout),
- colorAttachmentView, resolveAttachmentView, ownership) {
+ , GrVkTexture(gpu, dimensions, info, layout, texView, mipMapsStatus, ownership)
+ , GrVkRenderTarget(gpu, dimensions, sampleCnt, info, layout, msaaInfo,
+ std::move(msaaLayout), colorAttachmentView, resolveAttachmentView,
+ ownership) {
SkASSERT(info.fProtected == msaaInfo.fProtected);
this->registerWithCacheWrapped(cacheable);
}
GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* texView,
@@ -89,10 +90,10 @@
GrMipMapsStatus mipMapsStatus,
GrBackendObjectOwnership ownership,
GrWrapCacheable cacheable)
- : GrSurface(gpu, {desc.fWidth, desc.fHeight}, info.fProtected)
+ : GrSurface(gpu, dimensions, info.fProtected)
, GrVkImage(info, layout, ownership)
- , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, ownership)
- , GrVkRenderTarget(gpu, desc, info, layout, colorAttachmentView, ownership) {
+ , GrVkTexture(gpu, dimensions, info, layout, texView, mipMapsStatus, ownership)
+ , GrVkRenderTarget(gpu, dimensions, info, layout, colorAttachmentView, ownership) {
this->registerWithCacheWrapped(cacheable);
}
@@ -106,7 +107,7 @@
};
} // anonymous namespace
-static Views create_views(GrVkGpu* gpu, const GrSurfaceDesc& desc, int sampleCnt,
+static Views create_views(GrVkGpu* gpu, SkISize dimensions, int sampleCnt,
const GrVkImageInfo& info) {
VkImage image = info.fImage;
// Create the texture ImageView
@@ -126,8 +127,8 @@
GrVkImage::ImageDesc msImageDesc;
msImageDesc.fImageType = VK_IMAGE_TYPE_2D;
msImageDesc.fFormat = pixelFormat;
- msImageDesc.fWidth = desc.fWidth;
- msImageDesc.fHeight = desc.fHeight;
+ msImageDesc.fWidth = dimensions.fWidth;
+ msImageDesc.fHeight = dimensions.fHeight;
msImageDesc.fLevels = 1;
msImageDesc.fSamples = sampleCnt;
msImageDesc.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
@@ -175,7 +176,7 @@
sk_sp<GrVkTextureRenderTarget> GrVkTextureRenderTarget::MakeNewTextureRenderTarget(
GrVkGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImage::ImageDesc& imageDesc,
GrMipMapsStatus mipMapsStatus) {
@@ -188,26 +189,26 @@
}
sk_sp<GrVkImageLayout> layout(new GrVkImageLayout(info.fImageLayout));
- Views views = create_views(gpu, desc, sampleCnt, info);
+ Views views = create_views(gpu, dimensions, sampleCnt, info);
if (!views.colorAttachmentView) {
GrVkImage::DestroyImageInfo(gpu, &info);
return nullptr;
}
if (sampleCnt > 1) {
return sk_sp<GrVkTextureRenderTarget>(new GrVkTextureRenderTarget(
- gpu, budgeted, desc, sampleCnt, info, std::move(layout), views.imageView,
+ gpu, budgeted, dimensions, sampleCnt, info, std::move(layout), views.imageView,
views.msInfo, std::move(views.msLayout), views.colorAttachmentView,
views.resolveAttachmentView, mipMapsStatus));
} else {
return sk_sp<GrVkTextureRenderTarget>(new GrVkTextureRenderTarget(
- gpu, budgeted, desc, info, std::move(layout), views.imageView,
+ gpu, budgeted, dimensions, info, std::move(layout), views.imageView,
views.colorAttachmentView, mipMapsStatus));
}
}
sk_sp<GrVkTextureRenderTarget> GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget(
GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
GrWrapOwnership wrapOwnership,
GrWrapCacheable cacheable,
@@ -222,19 +223,19 @@
GrBackendObjectOwnership ownership = kBorrow_GrWrapOwnership == wrapOwnership
? GrBackendObjectOwnership::kBorrowed : GrBackendObjectOwnership::kOwned;
- Views views = create_views(gpu, desc, sampleCnt, info);
+ Views views = create_views(gpu, dimensions, sampleCnt, info);
if (!views.colorAttachmentView) {
return nullptr;
}
if (sampleCnt > 1) {
return sk_sp<GrVkTextureRenderTarget>(new GrVkTextureRenderTarget(
- gpu, desc, sampleCnt, info, std::move(layout), views.imageView, views.msInfo,
+ gpu, dimensions, sampleCnt, info, std::move(layout), views.imageView, views.msInfo,
std::move(views.msLayout), views.colorAttachmentView, views.resolveAttachmentView,
mipMapsStatus, ownership, cacheable));
} else {
return sk_sp<GrVkTextureRenderTarget>(new GrVkTextureRenderTarget(
- gpu, desc, info, std::move(layout), views.imageView, views.colorAttachmentView,
- mipMapsStatus, ownership, cacheable));
+ gpu, dimensions, info, std::move(layout), views.imageView,
+ views.colorAttachmentView, mipMapsStatus, ownership, cacheable));
}
}
diff --git a/src/gpu/vk/GrVkTextureRenderTarget.h b/src/gpu/vk/GrVkTextureRenderTarget.h
index 0771431..e319175 100644
--- a/src/gpu/vk/GrVkTextureRenderTarget.h
+++ b/src/gpu/vk/GrVkTextureRenderTarget.h
@@ -27,13 +27,13 @@
class GrVkTextureRenderTarget: public GrVkTexture, public GrVkRenderTarget {
public:
static sk_sp<GrVkTextureRenderTarget> MakeNewTextureRenderTarget(GrVkGpu*, SkBudgeted,
- const GrSurfaceDesc&,
+ SkISize dimensions,
int sampleCnt,
const GrVkImage::ImageDesc&,
GrMipMapsStatus);
static sk_sp<GrVkTextureRenderTarget> MakeWrappedTextureRenderTarget(GrVkGpu*,
- const GrSurfaceDesc&,
+ SkISize dimensions,
int sampleCnt,
GrWrapOwnership,
GrWrapCacheable,
@@ -59,7 +59,7 @@
// MSAA, not-wrapped
GrVkTextureRenderTarget(GrVkGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
@@ -73,7 +73,7 @@
// non-MSAA, not-wrapped
GrVkTextureRenderTarget(GrVkGpu* gpu,
SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* texView,
@@ -82,7 +82,7 @@
// MSAA, wrapped
GrVkTextureRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
int sampleCnt,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
@@ -97,7 +97,7 @@
// non-MSAA, wrapped
GrVkTextureRenderTarget(GrVkGpu* gpu,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
const GrVkImageView* texView,