From a9c22578101f54290c878cb6d0265dc0b853b61d Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Mon, 5 Aug 2019 12:57:09 -0400 Subject: [PATCH] Pass size and GrPixelConfig to GrSurface/Texture/RenderTarget constructors Change-Id: I4421354453a22a0a2853fc3cd64199f76b70c9f2 Bug: skia:6718 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232556 Reviewed-by: Robert Phillips Commit-Queue: Robert Phillips Auto-Submit: Brian Salomon --- include/gpu/GrRenderTarget.h | 2 +- include/gpu/GrSurface.h | 8 ++++---- include/gpu/GrTexture.h | 2 +- src/gpu/GrRenderTarget.cpp | 7 ++++--- src/gpu/GrTexture.cpp | 4 ++-- src/gpu/dawn/GrDawnRenderTarget.cpp | 5 +++-- src/gpu/gl/GrGLRenderTarget.cpp | 9 +++++---- src/gpu/gl/GrGLTexture.cpp | 18 +++++++++--------- src/gpu/gl/GrGLTextureRenderTarget.cpp | 4 ++-- src/gpu/mock/GrMockTexture.h | 21 +++++++++++---------- src/gpu/mtl/GrMtlRenderTarget.mm | 18 ++++++++++-------- src/gpu/mtl/GrMtlTexture.mm | 15 +++++++++------ src/gpu/mtl/GrMtlTextureRenderTarget.mm | 8 ++++---- src/gpu/vk/GrVkRenderTarget.cpp | 24 ++++++++++++------------ src/gpu/vk/GrVkTexture.cpp | 15 +++++++++------ src/gpu/vk/GrVkTextureRenderTarget.cpp | 8 ++++---- 16 files changed, 90 insertions(+), 78 deletions(-) diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h index 5fd07931fd..2c330dadf4 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -85,7 +85,7 @@ public: const GrRenderTargetPriv renderTargetPriv() const; protected: - GrRenderTarget(GrGpu*, const GrSurfaceDesc&, int sampleCount, GrProtected, + GrRenderTarget(GrGpu*, const SkISize&, GrPixelConfig, int sampleCount, GrProtected, GrStencilAttachment* = nullptr); ~GrRenderTarget() override; diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h index a928d5ef94..ab84d65c65 100644 --- a/include/gpu/GrSurface.h +++ b/include/gpu/GrSurface.h @@ -111,11 +111,11 @@ protected: // Provides access to methods that should be public within Skia code. friend class GrSurfacePriv; - GrSurface(GrGpu* gpu, const GrSurfaceDesc& desc, GrProtected isProtected) + GrSurface(GrGpu* gpu, const SkISize& size, GrPixelConfig config, GrProtected isProtected) : INHERITED(gpu) - , fConfig(desc.fConfig) - , fWidth(desc.fWidth) - , fHeight(desc.fHeight) + , fConfig(config) + , fWidth(size.width()) + , fHeight(size.height()) , fSurfaceFlags(GrInternalSurfaceFlags::kNone) , fIsProtected(isProtected) {} diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h index 09304d7eb6..6285938fca 100644 --- a/include/gpu/GrTexture.h +++ b/include/gpu/GrTexture.h @@ -81,7 +81,7 @@ public: inline const GrTexturePriv texturePriv() const; protected: - GrTexture(GrGpu*, const GrSurfaceDesc&, GrProtected, GrTextureType, GrMipMapsStatus); + GrTexture(GrGpu*, const SkISize&, GrPixelConfig, GrProtected, GrTextureType, GrMipMapsStatus); virtual bool onStealBackendTexture(GrBackendTexture*, SkImage::BackendTextureReleaseProc*) = 0; diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp index 7777cb6cca..62935d3819 100644 --- a/src/gpu/GrRenderTarget.cpp +++ b/src/gpu/GrRenderTarget.cpp @@ -19,9 +19,10 @@ #include "src/gpu/GrStencilAttachment.h" #include "src/gpu/GrStencilSettings.h" -GrRenderTarget::GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc, int sampleCount, - GrProtected isProtected, GrStencilAttachment* stencil) - : INHERITED(gpu, desc, isProtected) +GrRenderTarget::GrRenderTarget(GrGpu* gpu, const SkISize& size, GrPixelConfig config, + int sampleCount, GrProtected isProtected, + GrStencilAttachment* stencil) + : INHERITED(gpu, size, config, isProtected) , fSampleCnt(sampleCount) , fSamplePatternKey(GrSamplePatternDictionary::kInvalidSamplePatternKey) , fStencilAttachment(stencil) { diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp index 627c50789e..c3dacaa9a0 100644 --- a/src/gpu/GrTexture.cpp +++ b/src/gpu/GrTexture.cpp @@ -36,9 +36,9 @@ size_t GrTexture::onGpuMemorySize() const { } ///////////////////////////////////////////////////////////////////////////// -GrTexture::GrTexture(GrGpu* gpu, const GrSurfaceDesc& desc, GrProtected isProtected, +GrTexture::GrTexture(GrGpu* gpu, const SkISize& size, GrPixelConfig config, GrProtected isProtected, GrTextureType textureType, GrMipMapsStatus mipMapsStatus) - : INHERITED(gpu, desc, isProtected) + : INHERITED(gpu, size, config, isProtected) , fTextureType(textureType) , fMipMapsStatus(mipMapsStatus) { if (GrMipMapsStatus::kNotAllocated == fMipMapsStatus) { diff --git a/src/gpu/dawn/GrDawnRenderTarget.cpp b/src/gpu/dawn/GrDawnRenderTarget.cpp index 467049d519..0a204732cd 100644 --- a/src/gpu/dawn/GrDawnRenderTarget.cpp +++ b/src/gpu/dawn/GrDawnRenderTarget.cpp @@ -16,8 +16,9 @@ GrDawnRenderTarget::GrDawnRenderTarget(GrDawnGpu* gpu, int sampleCnt, const GrDawnImageInfo& info, GrBackendObjectOwnership ownership) - : GrSurface(gpu, desc, GrProtected::kNo) - , GrRenderTarget(gpu, desc, sampleCnt, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, + GrProtected::kNo) , fInfo(info) { this->registerWithCacheWrapped(GrWrapCacheable::kNo); } diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp index 104b6e9c5d..a7784e9c82 100644 --- a/src/gpu/gl/GrGLRenderTarget.cpp +++ b/src/gpu/gl/GrGLRenderTarget.cpp @@ -25,8 +25,9 @@ GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, GrGLenum format, const IDDesc& idDesc, GrGLStencilAttachment* stencil) - : GrSurface(gpu, desc, GrProtected::kNo) - , INHERITED(gpu, desc, sampleCount, GrProtected::kNo, stencil) { + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCount, GrProtected::kNo, + stencil) { this->setFlags(gpu->glCaps(), idDesc); this->init(desc, format, idDesc); this->registerWithCacheWrapped(GrWrapCacheable::kNo); @@ -34,8 +35,8 @@ GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, int sampleCount, GrGLenum format, const IDDesc& idDesc) - : GrSurface(gpu, desc, GrProtected::kNo) - , INHERITED(gpu, desc, sampleCount, GrProtected::kNo) { + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCount, GrProtected::kNo) { this->setFlags(gpu->glCaps(), idDesc); this->init(desc, format, idDesc); } diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index ff25b38ef1..d5caef5b1e 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -47,9 +47,9 @@ static inline GrGLenum target_from_texture_type(GrTextureType type) { // Because this class is virtually derived from GrSurface we must explicitly call its constructor. GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc, const IDDesc& idDesc, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, GrProtected::kNo) - , INHERITED(gpu, desc, GrProtected::kNo, TextureTypeFromTarget(idDesc.fInfo.fTarget), - mipMapsStatus) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo, + TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus) , fParameters(sk_make_sp()) { this->init(desc, idDesc); this->registerWithCache(budgeted); @@ -61,9 +61,9 @@ GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, GrMipMapsStatus mipMapsStatus, const IDDesc& idDesc, sk_sp parameters, GrWrapCacheable cacheable, GrIOType ioType) - : GrSurface(gpu, desc, GrProtected::kNo) - , INHERITED(gpu, desc, GrProtected::kNo, TextureTypeFromTarget(idDesc.fInfo.fTarget), - mipMapsStatus) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo, + TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus) , fParameters(std::move(parameters)) { SkASSERT(fParameters); this->init(desc, idDesc); @@ -75,9 +75,9 @@ GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, GrMipMapsStatu GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, sk_sp parameters, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, GrProtected::kNo) - , INHERITED(gpu, desc, GrProtected::kNo, TextureTypeFromTarget(idDesc.fInfo.fTarget), - mipMapsStatus) { + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo, + TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus) { SkASSERT(parameters || idDesc.fOwnership == GrBackendObjectOwnership::kOwned); fParameters = parameters ? std::move(parameters) : sk_make_sp(); this->init(desc, idDesc); diff --git a/src/gpu/gl/GrGLTextureRenderTarget.cpp b/src/gpu/gl/GrGLTextureRenderTarget.cpp index de86e9f4c1..35ce13dea5 100644 --- a/src/gpu/gl/GrGLTextureRenderTarget.cpp +++ b/src/gpu/gl/GrGLTextureRenderTarget.cpp @@ -19,7 +19,7 @@ GrGLTextureRenderTarget::GrGLTextureRenderTarget(GrGLGpu* gpu, const GrGLTexture::IDDesc& texIDDesc, const GrGLRenderTarget::IDDesc& rtIDDesc, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) , GrGLTexture(gpu, desc, texIDDesc, nullptr, mipMapsStatus) , GrGLRenderTarget(gpu, desc, sampleCount, texIDDesc.fInfo.fFormat, rtIDDesc) { this->registerWithCache(budgeted); @@ -33,7 +33,7 @@ GrGLTextureRenderTarget::GrGLTextureRenderTarget(GrGLGpu* gpu, const GrGLRenderTarget::IDDesc& rtIDDesc, GrWrapCacheable cacheable, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) , GrGLTexture(gpu, desc, texIDDesc, std::move(parameters), mipMapsStatus) , GrGLRenderTarget(gpu, desc, sampleCount, texIDDesc.fInfo.fFormat, rtIDDesc) { this->registerWithCacheWrapped(cacheable); diff --git a/src/gpu/mock/GrMockTexture.h b/src/gpu/mock/GrMockTexture.h index 7406cedb09..5061f2b700 100644 --- a/src/gpu/mock/GrMockTexture.h +++ b/src/gpu/mock/GrMockTexture.h @@ -51,8 +51,9 @@ protected: // constructor for subclasses GrMockTexture(GrMockGpu* gpu, const GrSurfaceDesc& desc, GrProtected isProtected, GrMipMapsStatus mipMapsStatus, const GrMockTextureInfo& info) - : GrSurface(gpu, desc, isProtected) - , INHERITED(gpu, desc, isProtected, GrTextureType::k2D, mipMapsStatus) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected, + GrTextureType::k2D, mipMapsStatus) , fInfo(info) {} void onRelease() override { @@ -77,8 +78,8 @@ class GrMockRenderTarget : public GrRenderTarget { public: GrMockRenderTarget(GrMockGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc, int sampleCnt, GrProtected isProtected, const GrMockRenderTargetInfo& info) - : GrSurface(gpu, desc, isProtected) - , INHERITED(gpu, desc, sampleCnt, isProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, isProtected) , fInfo(info) { this->registerWithCache(budgeted); } @@ -86,8 +87,8 @@ public: enum Wrapped { kWrapped }; GrMockRenderTarget(GrMockGpu* gpu, Wrapped, const GrSurfaceDesc& desc, int sampleCnt, GrProtected isProtected, const GrMockRenderTargetInfo& info) - : GrSurface(gpu, desc, isProtected) - , INHERITED(gpu, desc, sampleCnt, isProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, isProtected) , fInfo(info) { this->registerWithCacheWrapped(GrWrapCacheable::kNo); } @@ -122,8 +123,8 @@ protected: // constructor for subclasses GrMockRenderTarget(GrMockGpu* gpu, const GrSurfaceDesc& desc, int sampleCnt, GrProtected isProtected, const GrMockRenderTargetInfo& info) - : GrSurface(gpu, desc, isProtected) - , INHERITED(gpu, desc, sampleCnt, isProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, isProtected) , fInfo(info) {} private: @@ -139,7 +140,7 @@ public: int sampleCnt, GrProtected isProtected, GrMipMapsStatus mipMapsStatus, const GrMockTextureInfo& texInfo, const GrMockRenderTargetInfo& rtInfo) - : GrSurface(gpu, desc, isProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected) , GrMockTexture(gpu, desc, isProtected, mipMapsStatus, texInfo) , GrMockRenderTarget(gpu, desc, sampleCnt, isProtected, rtInfo) { this->registerWithCache(budgeted); @@ -150,7 +151,7 @@ public: GrProtected isProtected, GrMipMapsStatus mipMapsStatus, const GrMockTextureInfo& texInfo, const GrMockRenderTargetInfo& rtInfo, GrWrapCacheable cacheble) - : GrSurface(gpu, desc, isProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected) , GrMockTexture(gpu, desc, isProtected, mipMapsStatus, texInfo) , GrMockRenderTarget(gpu, desc, sampleCnt, isProtected, rtInfo) { this->registerWithCacheWrapped(cacheble); diff --git a/src/gpu/mtl/GrMtlRenderTarget.mm b/src/gpu/mtl/GrMtlRenderTarget.mm index 123715ba75..4fd6104582 100644 --- a/src/gpu/mtl/GrMtlRenderTarget.mm +++ b/src/gpu/mtl/GrMtlRenderTarget.mm @@ -21,8 +21,9 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu, id colorTexture, id resolveTexture, Wrapped) - : GrSurface(gpu, desc, GrProtected::kNo) - , GrRenderTarget(gpu, desc, sampleCnt, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , GrRenderTarget( + gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, GrProtected::kNo) , fColorTexture(colorTexture) , fResolveTexture(resolveTexture) { SkASSERT(sampleCnt > 1); @@ -33,8 +34,8 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu, const GrSurfaceDesc& desc, id colorTexture, Wrapped) - : GrSurface(gpu, desc, GrProtected::kNo) - , GrRenderTarget(gpu, desc, 1, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, 1, GrProtected::kNo) , fColorTexture(colorTexture) , fResolveTexture(nil) { this->registerWithCacheWrapped(GrWrapCacheable::kNo); @@ -46,8 +47,9 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu, int sampleCnt, id colorTexture, id resolveTexture) - : GrSurface(gpu, desc, GrProtected::kNo) - , GrRenderTarget(gpu, desc, sampleCnt, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , GrRenderTarget( + gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, GrProtected::kNo) , fColorTexture(colorTexture) , fResolveTexture(resolveTexture) { SkASSERT(sampleCnt > 1); @@ -56,8 +58,8 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu, GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu, const GrSurfaceDesc& desc, id colorTexture) - : GrSurface(gpu, desc, GrProtected::kNo) - , GrRenderTarget(gpu, desc, 1, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, 1, GrProtected::kNo) , fColorTexture(colorTexture) , fResolveTexture(nil) {} diff --git a/src/gpu/mtl/GrMtlTexture.mm b/src/gpu/mtl/GrMtlTexture.mm index 6b27862c6f..a55b066598 100644 --- a/src/gpu/mtl/GrMtlTexture.mm +++ b/src/gpu/mtl/GrMtlTexture.mm @@ -20,8 +20,9 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu, const GrSurfaceDesc& desc, id texture, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, GrProtected::kNo) - , INHERITED(gpu, desc, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo, + GrTextureType::k2D, mipMapsStatus) , fTexture(texture) { SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount)); this->registerWithCache(budgeted); @@ -34,8 +35,9 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu, GrMipMapsStatus mipMapsStatus, GrWrapCacheable cacheable, GrIOType ioType) - : GrSurface(gpu, desc, GrProtected::kNo) - , INHERITED(gpu, desc, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo, + GrTextureType::k2D, mipMapsStatus) , fTexture(texture) { SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount)); if (ioType == kRead_GrIOType) { @@ -48,8 +50,9 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu, const GrSurfaceDesc& desc, id texture, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, GrProtected::kNo) - , INHERITED(gpu, desc, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo, + GrTextureType::k2D, mipMapsStatus) , fTexture(texture) { SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount)); } diff --git a/src/gpu/mtl/GrMtlTextureRenderTarget.mm b/src/gpu/mtl/GrMtlTextureRenderTarget.mm index 768b57d349..593a970b8b 100644 --- a/src/gpu/mtl/GrMtlTextureRenderTarget.mm +++ b/src/gpu/mtl/GrMtlTextureRenderTarget.mm @@ -20,7 +20,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu, id colorTexture, id resolveTexture, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) , GrMtlTexture(gpu, desc, resolveTexture, mipMapsStatus) , GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, resolveTexture) { this->registerWithCache(budgeted); @@ -31,7 +31,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu, const GrSurfaceDesc& desc, id colorTexture, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) , GrMtlTexture(gpu, desc, colorTexture, mipMapsStatus) , GrMtlRenderTarget(gpu, desc, colorTexture) { this->registerWithCache(budgeted); @@ -44,7 +44,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu, id resolveTexture, GrMipMapsStatus mipMapsStatus, GrWrapCacheable cacheable) - : GrSurface(gpu, desc, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) , GrMtlTexture(gpu, desc, resolveTexture, mipMapsStatus) , GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, resolveTexture) { this->registerWithCacheWrapped(cacheable); @@ -55,7 +55,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu, id colorTexture, GrMipMapsStatus mipMapsStatus, GrWrapCacheable cacheable) - : GrSurface(gpu, desc, GrProtected::kNo) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo) , GrMtlTexture(gpu, desc, colorTexture, mipMapsStatus) , GrMtlRenderTarget(gpu, desc, colorTexture) { this->registerWithCacheWrapped(cacheable); diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp index b57e4d0448..788362b419 100644 --- a/src/gpu/vk/GrVkRenderTarget.cpp +++ b/src/gpu/vk/GrVkRenderTarget.cpp @@ -31,10 +31,10 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, sk_sp msaaLayout, const GrVkImageView* colorAttachmentView, const GrVkImageView* resolveAttachmentView) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed) // for the moment we only support 1:1 color to stencil - , GrRenderTarget(gpu, desc, sampleCnt, info.fProtected) + , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, info.fProtected) , fColorAttachmentView(colorAttachmentView) , fMSAAImage(new GrVkImage(msaaInfo, std::move(msaaLayout), GrBackendObjectOwnership::kOwned)) @@ -59,13 +59,13 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, const GrVkImageView* colorAttachmentView, const GrVkImageView* resolveAttachmentView, GrBackendObjectOwnership ownership) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, std::move(layout), ownership) // for the moment we only support 1:1 color to stencil - , GrRenderTarget(gpu, desc, sampleCnt, info.fProtected) + , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, info.fProtected) , fColorAttachmentView(colorAttachmentView) - , fMSAAImage(new GrVkImage(msaaInfo, std::move(msaaLayout), - GrBackendObjectOwnership::kOwned)) + , fMSAAImage( + new GrVkImage(msaaInfo, std::move(msaaLayout), GrBackendObjectOwnership::kOwned)) , fResolveAttachmentView(resolveAttachmentView) , fFramebuffer(nullptr) , fCachedSimpleRenderPass(nullptr) { @@ -81,9 +81,9 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, const GrVkImageInfo& info, sk_sp layout, const GrVkImageView* colorAttachmentView) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed) - , GrRenderTarget(gpu, desc, 1, info.fProtected) + , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, 1, info.fProtected) , fColorAttachmentView(colorAttachmentView) , fMSAAImage(nullptr) , fResolveAttachmentView(nullptr) @@ -101,9 +101,9 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, sk_sp layout, const GrVkImageView* colorAttachmentView, GrBackendObjectOwnership ownership) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, std::move(layout), ownership) - , GrRenderTarget(gpu, desc, 1, info.fProtected) + , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, 1, info.fProtected) , fColorAttachmentView(colorAttachmentView) , fMSAAImage(nullptr) , fResolveAttachmentView(nullptr) @@ -118,9 +118,9 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, sk_sp layout, const GrVkRenderPass* renderPass, VkCommandBuffer secondaryCommandBuffer) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed, true) - , GrRenderTarget(gpu, desc, 1, info.fProtected) + , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, 1, info.fProtected) , fColorAttachmentView(nullptr) , fMSAAImage(nullptr) , fResolveAttachmentView(nullptr) diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp index d30a3bd095..d42af7b196 100644 --- a/src/gpu/vk/GrVkTexture.cpp +++ b/src/gpu/vk/GrVkTexture.cpp @@ -25,9 +25,10 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, sk_sp layout, const GrVkImageView* view, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kOwned) - , INHERITED(gpu, desc, info.fProtected, GrTextureType::k2D, mipMapsStatus) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected, + GrTextureType::k2D, mipMapsStatus) , fTextureView(view) { SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount)); this->registerWithCache(budgeted); @@ -40,9 +41,10 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, const GrSurfaceDesc& desc, const GrVkImag sk_sp layout, const GrVkImageView* view, GrMipMapsStatus mipMapsStatus, GrBackendObjectOwnership ownership, GrWrapCacheable cacheable, GrIOType ioType) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, std::move(layout), ownership) - , INHERITED(gpu, desc, info.fProtected, GrTextureType::k2D, mipMapsStatus) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected, + GrTextureType::k2D, mipMapsStatus) , fTextureView(view) { SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount)); if (ioType == kRead_GrIOType) { @@ -59,9 +61,10 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, const GrVkImageView* view, GrMipMapsStatus mipMapsStatus, GrBackendObjectOwnership ownership) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, layout, ownership) - , INHERITED(gpu, desc, info.fProtected, GrTextureType::k2D, mipMapsStatus) + , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected, + GrTextureType::k2D, mipMapsStatus) , fTextureView(view) { SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount)); } diff --git a/src/gpu/vk/GrVkTextureRenderTarget.cpp b/src/gpu/vk/GrVkTextureRenderTarget.cpp index dc93aaa65a..2288db29f1 100644 --- a/src/gpu/vk/GrVkTextureRenderTarget.cpp +++ b/src/gpu/vk/GrVkTextureRenderTarget.cpp @@ -30,7 +30,7 @@ GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu, const GrVkImageView* colorAttachmentView, const GrVkImageView* resolveAttachmentView, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, layout, GrBackendObjectOwnership::kOwned) , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, GrBackendObjectOwnership::kOwned) @@ -49,7 +49,7 @@ GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu, const GrVkImageView* texView, const GrVkImageView* colorAttachmentView, GrMipMapsStatus mipMapsStatus) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, layout, GrBackendObjectOwnership::kOwned) , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, GrBackendObjectOwnership::kOwned) @@ -71,7 +71,7 @@ GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu, GrMipMapsStatus mipMapsStatus, GrBackendObjectOwnership ownership, GrWrapCacheable cacheable) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, layout, ownership) , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, ownership) , GrVkRenderTarget(gpu, desc, sampleCnt, info, layout, msaaInfo, std::move(msaaLayout), @@ -89,7 +89,7 @@ GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu, GrMipMapsStatus mipMapsStatus, GrBackendObjectOwnership ownership, GrWrapCacheable cacheable) - : GrSurface(gpu, desc, info.fProtected) + : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected) , GrVkImage(info, layout, ownership) , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, ownership) , GrVkRenderTarget(gpu, desc, info, layout, colorAttachmentView, ownership) {