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 <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2019-08-05 12:57:09 -04:00 committed by Skia Commit-Bot
parent 2a558f5675
commit a9c2257810
16 changed files with 90 additions and 78 deletions

View File

@ -85,7 +85,7 @@ public:
const GrRenderTargetPriv renderTargetPriv() const; const GrRenderTargetPriv renderTargetPriv() const;
protected: protected:
GrRenderTarget(GrGpu*, const GrSurfaceDesc&, int sampleCount, GrProtected, GrRenderTarget(GrGpu*, const SkISize&, GrPixelConfig, int sampleCount, GrProtected,
GrStencilAttachment* = nullptr); GrStencilAttachment* = nullptr);
~GrRenderTarget() override; ~GrRenderTarget() override;

View File

@ -111,11 +111,11 @@ protected:
// Provides access to methods that should be public within Skia code. // Provides access to methods that should be public within Skia code.
friend class GrSurfacePriv; friend class GrSurfacePriv;
GrSurface(GrGpu* gpu, const GrSurfaceDesc& desc, GrProtected isProtected) GrSurface(GrGpu* gpu, const SkISize& size, GrPixelConfig config, GrProtected isProtected)
: INHERITED(gpu) : INHERITED(gpu)
, fConfig(desc.fConfig) , fConfig(config)
, fWidth(desc.fWidth) , fWidth(size.width())
, fHeight(desc.fHeight) , fHeight(size.height())
, fSurfaceFlags(GrInternalSurfaceFlags::kNone) , fSurfaceFlags(GrInternalSurfaceFlags::kNone)
, fIsProtected(isProtected) {} , fIsProtected(isProtected) {}

View File

@ -81,7 +81,7 @@ public:
inline const GrTexturePriv texturePriv() const; inline const GrTexturePriv texturePriv() const;
protected: protected:
GrTexture(GrGpu*, const GrSurfaceDesc&, GrProtected, GrTextureType, GrMipMapsStatus); GrTexture(GrGpu*, const SkISize&, GrPixelConfig, GrProtected, GrTextureType, GrMipMapsStatus);
virtual bool onStealBackendTexture(GrBackendTexture*, SkImage::BackendTextureReleaseProc*) = 0; virtual bool onStealBackendTexture(GrBackendTexture*, SkImage::BackendTextureReleaseProc*) = 0;

View File

@ -19,9 +19,10 @@
#include "src/gpu/GrStencilAttachment.h" #include "src/gpu/GrStencilAttachment.h"
#include "src/gpu/GrStencilSettings.h" #include "src/gpu/GrStencilSettings.h"
GrRenderTarget::GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc, int sampleCount, GrRenderTarget::GrRenderTarget(GrGpu* gpu, const SkISize& size, GrPixelConfig config,
GrProtected isProtected, GrStencilAttachment* stencil) int sampleCount, GrProtected isProtected,
: INHERITED(gpu, desc, isProtected) GrStencilAttachment* stencil)
: INHERITED(gpu, size, config, isProtected)
, fSampleCnt(sampleCount) , fSampleCnt(sampleCount)
, fSamplePatternKey(GrSamplePatternDictionary::kInvalidSamplePatternKey) , fSamplePatternKey(GrSamplePatternDictionary::kInvalidSamplePatternKey)
, fStencilAttachment(stencil) { , fStencilAttachment(stencil) {

View File

@ -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) GrTextureType textureType, GrMipMapsStatus mipMapsStatus)
: INHERITED(gpu, desc, isProtected) : INHERITED(gpu, size, config, isProtected)
, fTextureType(textureType) , fTextureType(textureType)
, fMipMapsStatus(mipMapsStatus) { , fMipMapsStatus(mipMapsStatus) {
if (GrMipMapsStatus::kNotAllocated == fMipMapsStatus) { if (GrMipMapsStatus::kNotAllocated == fMipMapsStatus) {

View File

@ -16,8 +16,9 @@ GrDawnRenderTarget::GrDawnRenderTarget(GrDawnGpu* gpu,
int sampleCnt, int sampleCnt,
const GrDawnImageInfo& info, const GrDawnImageInfo& info,
GrBackendObjectOwnership ownership) GrBackendObjectOwnership ownership)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrRenderTarget(gpu, desc, sampleCnt, GrProtected::kNo) , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt,
GrProtected::kNo)
, fInfo(info) { , fInfo(info) {
this->registerWithCacheWrapped(GrWrapCacheable::kNo); this->registerWithCacheWrapped(GrWrapCacheable::kNo);
} }

View File

@ -25,8 +25,9 @@ GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu,
GrGLenum format, GrGLenum format,
const IDDesc& idDesc, const IDDesc& idDesc,
GrGLStencilAttachment* stencil) GrGLStencilAttachment* stencil)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, INHERITED(gpu, desc, sampleCount, GrProtected::kNo, stencil) { , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCount, GrProtected::kNo,
stencil) {
this->setFlags(gpu->glCaps(), idDesc); this->setFlags(gpu->glCaps(), idDesc);
this->init(desc, format, idDesc); this->init(desc, format, idDesc);
this->registerWithCacheWrapped(GrWrapCacheable::kNo); this->registerWithCacheWrapped(GrWrapCacheable::kNo);
@ -34,8 +35,8 @@ GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu,
GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, int sampleCount, GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, int sampleCount,
GrGLenum format, const IDDesc& idDesc) GrGLenum format, const IDDesc& idDesc)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, INHERITED(gpu, desc, sampleCount, GrProtected::kNo) { , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCount, GrProtected::kNo) {
this->setFlags(gpu->glCaps(), idDesc); this->setFlags(gpu->glCaps(), idDesc);
this->init(desc, format, idDesc); this->init(desc, format, idDesc);
} }

View File

@ -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. // Because this class is virtually derived from GrSurface we must explicitly call its constructor.
GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc, GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
const IDDesc& idDesc, GrMipMapsStatus mipMapsStatus) const IDDesc& idDesc, GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, INHERITED(gpu, desc, GrProtected::kNo, TextureTypeFromTarget(idDesc.fInfo.fTarget), , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo,
mipMapsStatus) TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus)
, fParameters(sk_make_sp<GrGLTextureParameters>()) { , fParameters(sk_make_sp<GrGLTextureParameters>()) {
this->init(desc, idDesc); this->init(desc, idDesc);
this->registerWithCache(budgeted); this->registerWithCache(budgeted);
@ -61,9 +61,9 @@ GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc&
GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, GrMipMapsStatus mipMapsStatus, GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, GrMipMapsStatus mipMapsStatus,
const IDDesc& idDesc, sk_sp<GrGLTextureParameters> parameters, const IDDesc& idDesc, sk_sp<GrGLTextureParameters> parameters,
GrWrapCacheable cacheable, GrIOType ioType) GrWrapCacheable cacheable, GrIOType ioType)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, INHERITED(gpu, desc, GrProtected::kNo, TextureTypeFromTarget(idDesc.fInfo.fTarget), , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo,
mipMapsStatus) TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus)
, fParameters(std::move(parameters)) { , fParameters(std::move(parameters)) {
SkASSERT(fParameters); SkASSERT(fParameters);
this->init(desc, idDesc); 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, GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc,
sk_sp<GrGLTextureParameters> parameters, GrMipMapsStatus mipMapsStatus) sk_sp<GrGLTextureParameters> parameters, GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, INHERITED(gpu, desc, GrProtected::kNo, TextureTypeFromTarget(idDesc.fInfo.fTarget), , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo,
mipMapsStatus) { TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus) {
SkASSERT(parameters || idDesc.fOwnership == GrBackendObjectOwnership::kOwned); SkASSERT(parameters || idDesc.fOwnership == GrBackendObjectOwnership::kOwned);
fParameters = parameters ? std::move(parameters) : sk_make_sp<GrGLTextureParameters>(); fParameters = parameters ? std::move(parameters) : sk_make_sp<GrGLTextureParameters>();
this->init(desc, idDesc); this->init(desc, idDesc);

View File

@ -19,7 +19,7 @@ GrGLTextureRenderTarget::GrGLTextureRenderTarget(GrGLGpu* gpu,
const GrGLTexture::IDDesc& texIDDesc, const GrGLTexture::IDDesc& texIDDesc,
const GrGLRenderTarget::IDDesc& rtIDDesc, const GrGLRenderTarget::IDDesc& rtIDDesc,
GrMipMapsStatus mipMapsStatus) GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrGLTexture(gpu, desc, texIDDesc, nullptr, mipMapsStatus) , GrGLTexture(gpu, desc, texIDDesc, nullptr, mipMapsStatus)
, GrGLRenderTarget(gpu, desc, sampleCount, texIDDesc.fInfo.fFormat, rtIDDesc) { , GrGLRenderTarget(gpu, desc, sampleCount, texIDDesc.fInfo.fFormat, rtIDDesc) {
this->registerWithCache(budgeted); this->registerWithCache(budgeted);
@ -33,7 +33,7 @@ GrGLTextureRenderTarget::GrGLTextureRenderTarget(GrGLGpu* gpu,
const GrGLRenderTarget::IDDesc& rtIDDesc, const GrGLRenderTarget::IDDesc& rtIDDesc,
GrWrapCacheable cacheable, GrWrapCacheable cacheable,
GrMipMapsStatus mipMapsStatus) 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) , GrGLTexture(gpu, desc, texIDDesc, std::move(parameters), mipMapsStatus)
, GrGLRenderTarget(gpu, desc, sampleCount, texIDDesc.fInfo.fFormat, rtIDDesc) { , GrGLRenderTarget(gpu, desc, sampleCount, texIDDesc.fInfo.fFormat, rtIDDesc) {
this->registerWithCacheWrapped(cacheable); this->registerWithCacheWrapped(cacheable);

View File

@ -51,8 +51,9 @@ protected:
// constructor for subclasses // constructor for subclasses
GrMockTexture(GrMockGpu* gpu, const GrSurfaceDesc& desc, GrProtected isProtected, GrMockTexture(GrMockGpu* gpu, const GrSurfaceDesc& desc, GrProtected isProtected,
GrMipMapsStatus mipMapsStatus, const GrMockTextureInfo& info) GrMipMapsStatus mipMapsStatus, const GrMockTextureInfo& info)
: GrSurface(gpu, desc, isProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected)
, INHERITED(gpu, desc, isProtected, GrTextureType::k2D, mipMapsStatus) , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected,
GrTextureType::k2D, mipMapsStatus)
, fInfo(info) {} , fInfo(info) {}
void onRelease() override { void onRelease() override {
@ -77,8 +78,8 @@ class GrMockRenderTarget : public GrRenderTarget {
public: public:
GrMockRenderTarget(GrMockGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc, GrMockRenderTarget(GrMockGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
int sampleCnt, GrProtected isProtected, const GrMockRenderTargetInfo& info) int sampleCnt, GrProtected isProtected, const GrMockRenderTargetInfo& info)
: GrSurface(gpu, desc, isProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected)
, INHERITED(gpu, desc, sampleCnt, isProtected) , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, isProtected)
, fInfo(info) { , fInfo(info) {
this->registerWithCache(budgeted); this->registerWithCache(budgeted);
} }
@ -86,8 +87,8 @@ public:
enum Wrapped { kWrapped }; enum Wrapped { kWrapped };
GrMockRenderTarget(GrMockGpu* gpu, Wrapped, const GrSurfaceDesc& desc, int sampleCnt, GrMockRenderTarget(GrMockGpu* gpu, Wrapped, const GrSurfaceDesc& desc, int sampleCnt,
GrProtected isProtected, const GrMockRenderTargetInfo& info) GrProtected isProtected, const GrMockRenderTargetInfo& info)
: GrSurface(gpu, desc, isProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected)
, INHERITED(gpu, desc, sampleCnt, isProtected) , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, isProtected)
, fInfo(info) { , fInfo(info) {
this->registerWithCacheWrapped(GrWrapCacheable::kNo); this->registerWithCacheWrapped(GrWrapCacheable::kNo);
} }
@ -122,8 +123,8 @@ protected:
// constructor for subclasses // constructor for subclasses
GrMockRenderTarget(GrMockGpu* gpu, const GrSurfaceDesc& desc, int sampleCnt, GrMockRenderTarget(GrMockGpu* gpu, const GrSurfaceDesc& desc, int sampleCnt,
GrProtected isProtected, const GrMockRenderTargetInfo& info) GrProtected isProtected, const GrMockRenderTargetInfo& info)
: GrSurface(gpu, desc, isProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected)
, INHERITED(gpu, desc, sampleCnt, isProtected) , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, isProtected)
, fInfo(info) {} , fInfo(info) {}
private: private:
@ -139,7 +140,7 @@ public:
int sampleCnt, GrProtected isProtected, GrMipMapsStatus mipMapsStatus, int sampleCnt, GrProtected isProtected, GrMipMapsStatus mipMapsStatus,
const GrMockTextureInfo& texInfo, const GrMockTextureInfo& texInfo,
const GrMockRenderTargetInfo& rtInfo) const GrMockRenderTargetInfo& rtInfo)
: GrSurface(gpu, desc, isProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected)
, GrMockTexture(gpu, desc, isProtected, mipMapsStatus, texInfo) , GrMockTexture(gpu, desc, isProtected, mipMapsStatus, texInfo)
, GrMockRenderTarget(gpu, desc, sampleCnt, isProtected, rtInfo) { , GrMockRenderTarget(gpu, desc, sampleCnt, isProtected, rtInfo) {
this->registerWithCache(budgeted); this->registerWithCache(budgeted);
@ -150,7 +151,7 @@ public:
GrProtected isProtected, GrMipMapsStatus mipMapsStatus, GrProtected isProtected, GrMipMapsStatus mipMapsStatus,
const GrMockTextureInfo& texInfo, const GrMockTextureInfo& texInfo,
const GrMockRenderTargetInfo& rtInfo, GrWrapCacheable cacheble) const GrMockRenderTargetInfo& rtInfo, GrWrapCacheable cacheble)
: GrSurface(gpu, desc, isProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, isProtected)
, GrMockTexture(gpu, desc, isProtected, mipMapsStatus, texInfo) , GrMockTexture(gpu, desc, isProtected, mipMapsStatus, texInfo)
, GrMockRenderTarget(gpu, desc, sampleCnt, isProtected, rtInfo) { , GrMockRenderTarget(gpu, desc, sampleCnt, isProtected, rtInfo) {
this->registerWithCacheWrapped(cacheble); this->registerWithCacheWrapped(cacheble);

View File

@ -21,8 +21,9 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
id<MTLTexture> colorTexture, id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture, id<MTLTexture> resolveTexture,
Wrapped) Wrapped)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrRenderTarget(gpu, desc, sampleCnt, GrProtected::kNo) , GrRenderTarget(
gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, GrProtected::kNo)
, fColorTexture(colorTexture) , fColorTexture(colorTexture)
, fResolveTexture(resolveTexture) { , fResolveTexture(resolveTexture) {
SkASSERT(sampleCnt > 1); SkASSERT(sampleCnt > 1);
@ -33,8 +34,8 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
id<MTLTexture> colorTexture, id<MTLTexture> colorTexture,
Wrapped) Wrapped)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrRenderTarget(gpu, desc, 1, GrProtected::kNo) , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, 1, GrProtected::kNo)
, fColorTexture(colorTexture) , fColorTexture(colorTexture)
, fResolveTexture(nil) { , fResolveTexture(nil) {
this->registerWithCacheWrapped(GrWrapCacheable::kNo); this->registerWithCacheWrapped(GrWrapCacheable::kNo);
@ -46,8 +47,9 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
int sampleCnt, int sampleCnt,
id<MTLTexture> colorTexture, id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture) id<MTLTexture> resolveTexture)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrRenderTarget(gpu, desc, sampleCnt, GrProtected::kNo) , GrRenderTarget(
gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, sampleCnt, GrProtected::kNo)
, fColorTexture(colorTexture) , fColorTexture(colorTexture)
, fResolveTexture(resolveTexture) { , fResolveTexture(resolveTexture) {
SkASSERT(sampleCnt > 1); SkASSERT(sampleCnt > 1);
@ -56,8 +58,8 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu, GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
id<MTLTexture> colorTexture) id<MTLTexture> colorTexture)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrRenderTarget(gpu, desc, 1, GrProtected::kNo) , GrRenderTarget(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, 1, GrProtected::kNo)
, fColorTexture(colorTexture) , fColorTexture(colorTexture)
, fResolveTexture(nil) {} , fResolveTexture(nil) {}

View File

@ -20,8 +20,9 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
id<MTLTexture> texture, id<MTLTexture> texture,
GrMipMapsStatus mipMapsStatus) GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, INHERITED(gpu, desc, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus) , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo,
GrTextureType::k2D, mipMapsStatus)
, fTexture(texture) { , fTexture(texture) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount)); SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
this->registerWithCache(budgeted); this->registerWithCache(budgeted);
@ -34,8 +35,9 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
GrMipMapsStatus mipMapsStatus, GrMipMapsStatus mipMapsStatus,
GrWrapCacheable cacheable, GrWrapCacheable cacheable,
GrIOType ioType) GrIOType ioType)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, INHERITED(gpu, desc, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus) , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo,
GrTextureType::k2D, mipMapsStatus)
, fTexture(texture) { , fTexture(texture) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount)); SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
if (ioType == kRead_GrIOType) { if (ioType == kRead_GrIOType) {
@ -48,8 +50,9 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
id<MTLTexture> texture, id<MTLTexture> texture,
GrMipMapsStatus mipMapsStatus) GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, INHERITED(gpu, desc, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus) , INHERITED(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo,
GrTextureType::k2D, mipMapsStatus)
, fTexture(texture) { , fTexture(texture) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount)); SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
} }

View File

@ -20,7 +20,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
id<MTLTexture> colorTexture, id<MTLTexture> colorTexture,
id<MTLTexture> resolveTexture, id<MTLTexture> resolveTexture,
GrMipMapsStatus mipMapsStatus) GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrMtlTexture(gpu, desc, resolveTexture, mipMapsStatus) , GrMtlTexture(gpu, desc, resolveTexture, mipMapsStatus)
, GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, resolveTexture) { , GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, resolveTexture) {
this->registerWithCache(budgeted); this->registerWithCache(budgeted);
@ -31,7 +31,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
id<MTLTexture> colorTexture, id<MTLTexture> colorTexture,
GrMipMapsStatus mipMapsStatus) GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrMtlTexture(gpu, desc, colorTexture, mipMapsStatus) , GrMtlTexture(gpu, desc, colorTexture, mipMapsStatus)
, GrMtlRenderTarget(gpu, desc, colorTexture) { , GrMtlRenderTarget(gpu, desc, colorTexture) {
this->registerWithCache(budgeted); this->registerWithCache(budgeted);
@ -44,7 +44,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
id<MTLTexture> resolveTexture, id<MTLTexture> resolveTexture,
GrMipMapsStatus mipMapsStatus, GrMipMapsStatus mipMapsStatus,
GrWrapCacheable cacheable) GrWrapCacheable cacheable)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrMtlTexture(gpu, desc, resolveTexture, mipMapsStatus) , GrMtlTexture(gpu, desc, resolveTexture, mipMapsStatus)
, GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, resolveTexture) { , GrMtlRenderTarget(gpu, desc, sampleCnt, colorTexture, resolveTexture) {
this->registerWithCacheWrapped(cacheable); this->registerWithCacheWrapped(cacheable);
@ -55,7 +55,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
id<MTLTexture> colorTexture, id<MTLTexture> colorTexture,
GrMipMapsStatus mipMapsStatus, GrMipMapsStatus mipMapsStatus,
GrWrapCacheable cacheable) GrWrapCacheable cacheable)
: GrSurface(gpu, desc, GrProtected::kNo) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, GrProtected::kNo)
, GrMtlTexture(gpu, desc, colorTexture, mipMapsStatus) , GrMtlTexture(gpu, desc, colorTexture, mipMapsStatus)
, GrMtlRenderTarget(gpu, desc, colorTexture) { , GrMtlRenderTarget(gpu, desc, colorTexture) {
this->registerWithCacheWrapped(cacheable); this->registerWithCacheWrapped(cacheable);

View File

@ -31,10 +31,10 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
sk_sp<GrVkImageLayout> msaaLayout, sk_sp<GrVkImageLayout> msaaLayout,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView,
const GrVkImageView* resolveAttachmentView) 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) , GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed)
// for the moment we only support 1:1 color to stencil // 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) , fColorAttachmentView(colorAttachmentView)
, fMSAAImage(new GrVkImage(msaaInfo, std::move(msaaLayout), , fMSAAImage(new GrVkImage(msaaInfo, std::move(msaaLayout),
GrBackendObjectOwnership::kOwned)) GrBackendObjectOwnership::kOwned))
@ -59,13 +59,13 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView,
const GrVkImageView* resolveAttachmentView, const GrVkImageView* resolveAttachmentView,
GrBackendObjectOwnership ownership) GrBackendObjectOwnership ownership)
: GrSurface(gpu, desc, info.fProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected)
, GrVkImage(info, std::move(layout), ownership) , GrVkImage(info, std::move(layout), ownership)
// for the moment we only support 1:1 color to stencil // 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) , fColorAttachmentView(colorAttachmentView)
, fMSAAImage(new GrVkImage(msaaInfo, std::move(msaaLayout), , fMSAAImage(
GrBackendObjectOwnership::kOwned)) new GrVkImage(msaaInfo, std::move(msaaLayout), GrBackendObjectOwnership::kOwned))
, fResolveAttachmentView(resolveAttachmentView) , fResolveAttachmentView(resolveAttachmentView)
, fFramebuffer(nullptr) , fFramebuffer(nullptr)
, fCachedSimpleRenderPass(nullptr) { , fCachedSimpleRenderPass(nullptr) {
@ -81,9 +81,9 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
const GrVkImageInfo& info, const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout,
const GrVkImageView* colorAttachmentView) 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) , 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) , fColorAttachmentView(colorAttachmentView)
, fMSAAImage(nullptr) , fMSAAImage(nullptr)
, fResolveAttachmentView(nullptr) , fResolveAttachmentView(nullptr)
@ -101,9 +101,9 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView,
GrBackendObjectOwnership ownership) GrBackendObjectOwnership ownership)
: GrSurface(gpu, desc, info.fProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected)
, GrVkImage(info, std::move(layout), ownership) , 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) , fColorAttachmentView(colorAttachmentView)
, fMSAAImage(nullptr) , fMSAAImage(nullptr)
, fResolveAttachmentView(nullptr) , fResolveAttachmentView(nullptr)
@ -118,9 +118,9 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout,
const GrVkRenderPass* renderPass, const GrVkRenderPass* renderPass,
VkCommandBuffer secondaryCommandBuffer) 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) , 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) , fColorAttachmentView(nullptr)
, fMSAAImage(nullptr) , fMSAAImage(nullptr)
, fResolveAttachmentView(nullptr) , fResolveAttachmentView(nullptr)

View File

@ -25,9 +25,10 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout,
const GrVkImageView* view, const GrVkImageView* view,
GrMipMapsStatus mipMapsStatus) GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, info.fProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected)
, GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kOwned) , 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) { , fTextureView(view) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount)); SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount));
this->registerWithCache(budgeted); this->registerWithCache(budgeted);
@ -40,9 +41,10 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, const GrSurfaceDesc& desc, const GrVkImag
sk_sp<GrVkImageLayout> layout, const GrVkImageView* view, sk_sp<GrVkImageLayout> layout, const GrVkImageView* view,
GrMipMapsStatus mipMapsStatus, GrBackendObjectOwnership ownership, GrMipMapsStatus mipMapsStatus, GrBackendObjectOwnership ownership,
GrWrapCacheable cacheable, GrIOType ioType) 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) , 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) { , fTextureView(view) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount)); SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount));
if (ioType == kRead_GrIOType) { if (ioType == kRead_GrIOType) {
@ -59,9 +61,10 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
const GrVkImageView* view, const GrVkImageView* view,
GrMipMapsStatus mipMapsStatus, GrMipMapsStatus mipMapsStatus,
GrBackendObjectOwnership ownership) GrBackendObjectOwnership ownership)
: GrSurface(gpu, desc, info.fProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected)
, GrVkImage(info, layout, ownership) , 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) { , fTextureView(view) {
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount)); SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount));
} }

View File

@ -30,7 +30,7 @@ GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView,
const GrVkImageView* resolveAttachmentView, const GrVkImageView* resolveAttachmentView,
GrMipMapsStatus mipMapsStatus) GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, info.fProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected)
, GrVkImage(info, layout, GrBackendObjectOwnership::kOwned) , GrVkImage(info, layout, GrBackendObjectOwnership::kOwned)
, GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus,
GrBackendObjectOwnership::kOwned) GrBackendObjectOwnership::kOwned)
@ -49,7 +49,7 @@ GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu,
const GrVkImageView* texView, const GrVkImageView* texView,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView,
GrMipMapsStatus mipMapsStatus) GrMipMapsStatus mipMapsStatus)
: GrSurface(gpu, desc, info.fProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected)
, GrVkImage(info, layout, GrBackendObjectOwnership::kOwned) , GrVkImage(info, layout, GrBackendObjectOwnership::kOwned)
, GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus,
GrBackendObjectOwnership::kOwned) GrBackendObjectOwnership::kOwned)
@ -71,7 +71,7 @@ GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu,
GrMipMapsStatus mipMapsStatus, GrMipMapsStatus mipMapsStatus,
GrBackendObjectOwnership ownership, GrBackendObjectOwnership ownership,
GrWrapCacheable cacheable) GrWrapCacheable cacheable)
: GrSurface(gpu, desc, info.fProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected)
, GrVkImage(info, layout, ownership) , GrVkImage(info, layout, ownership)
, GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, ownership) , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, ownership)
, GrVkRenderTarget(gpu, desc, sampleCnt, info, layout, msaaInfo, std::move(msaaLayout), , GrVkRenderTarget(gpu, desc, sampleCnt, info, layout, msaaInfo, std::move(msaaLayout),
@ -89,7 +89,7 @@ GrVkTextureRenderTarget::GrVkTextureRenderTarget(GrVkGpu* gpu,
GrMipMapsStatus mipMapsStatus, GrMipMapsStatus mipMapsStatus,
GrBackendObjectOwnership ownership, GrBackendObjectOwnership ownership,
GrWrapCacheable cacheable) GrWrapCacheable cacheable)
: GrSurface(gpu, desc, info.fProtected) : GrSurface(gpu, {desc.fWidth, desc.fHeight}, desc.fConfig, info.fProtected)
, GrVkImage(info, layout, ownership) , GrVkImage(info, layout, ownership)
, GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, ownership) , GrVkTexture(gpu, desc, info, layout, texView, mipMapsStatus, ownership)
, GrVkRenderTarget(gpu, desc, info, layout, colorAttachmentView, ownership) { , GrVkRenderTarget(gpu, desc, info, layout, colorAttachmentView, ownership) {