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:
parent
2a558f5675
commit
a9c2257810
@ -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;
|
||||
|
||||
|
@ -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) {}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<GrGLTextureParameters>()) {
|
||||
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<GrGLTextureParameters> 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<GrGLTextureParameters> 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<GrGLTextureParameters>();
|
||||
this->init(desc, idDesc);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -21,8 +21,9 @@ GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
|
||||
id<MTLTexture> colorTexture,
|
||||
id<MTLTexture> 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<MTLTexture> 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<MTLTexture> colorTexture,
|
||||
id<MTLTexture> 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<MTLTexture> 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) {}
|
||||
|
||||
|
@ -20,8 +20,9 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
|
||||
const GrSurfaceDesc& desc,
|
||||
id<MTLTexture> 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<MTLTexture> 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));
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ GrMtlTextureRenderTarget::GrMtlTextureRenderTarget(GrMtlGpu* gpu,
|
||||
id<MTLTexture> colorTexture,
|
||||
id<MTLTexture> 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<MTLTexture> 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<MTLTexture> 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<MTLTexture> 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);
|
||||
|
@ -31,10 +31,10 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
|
||||
sk_sp<GrVkImageLayout> 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<GrVkImageLayout> 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<GrVkImageLayout> 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<GrVkImageLayout> 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)
|
||||
|
@ -25,9 +25,10 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
sk_sp<GrVkImageLayout> 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<GrVkImageLayout> 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));
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user