1cb93a386Sopenharmony_ci/* 2cb93a386Sopenharmony_ci * Copyright 2018 Google Inc. 3cb93a386Sopenharmony_ci * 4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be 5cb93a386Sopenharmony_ci * found in the LICENSE file. 6cb93a386Sopenharmony_ci */ 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ci#ifndef GrMtlTextureRenderTarget_DEFINED 9cb93a386Sopenharmony_ci#define GrMtlTextureRenderTarget_DEFINED 10cb93a386Sopenharmony_ci 11cb93a386Sopenharmony_ci#include "src/gpu/mtl/GrMtlRenderTarget.h" 12cb93a386Sopenharmony_ci#include "src/gpu/mtl/GrMtlTexture.h" 13cb93a386Sopenharmony_ci 14cb93a386Sopenharmony_ciclass GrMtlTextureRenderTarget: public GrMtlTexture, public GrMtlRenderTarget { 15cb93a386Sopenharmony_cipublic: 16cb93a386Sopenharmony_ci static sk_sp<GrMtlTextureRenderTarget> MakeNewTextureRenderTarget(GrMtlGpu*, 17cb93a386Sopenharmony_ci SkBudgeted, 18cb93a386Sopenharmony_ci SkISize, 19cb93a386Sopenharmony_ci int sampleCnt, 20cb93a386Sopenharmony_ci MTLPixelFormat, 21cb93a386Sopenharmony_ci uint32_t mipLevels, 22cb93a386Sopenharmony_ci GrMipmapStatus); 23cb93a386Sopenharmony_ci 24cb93a386Sopenharmony_ci static sk_sp<GrMtlTextureRenderTarget> MakeWrappedTextureRenderTarget(GrMtlGpu*, 25cb93a386Sopenharmony_ci SkISize, 26cb93a386Sopenharmony_ci int sampleCnt, 27cb93a386Sopenharmony_ci id<MTLTexture>, 28cb93a386Sopenharmony_ci GrWrapCacheable); 29cb93a386Sopenharmony_ci GrBackendFormat backendFormat() const override { 30cb93a386Sopenharmony_ci return GrMtlTexture::backendFormat(); 31cb93a386Sopenharmony_ci } 32cb93a386Sopenharmony_ci 33cb93a386Sopenharmony_ciprotected: 34cb93a386Sopenharmony_ci void onAbandon() override { 35cb93a386Sopenharmony_ci GrMtlRenderTarget::onAbandon(); 36cb93a386Sopenharmony_ci GrMtlTexture::onAbandon(); 37cb93a386Sopenharmony_ci } 38cb93a386Sopenharmony_ci 39cb93a386Sopenharmony_ci void onRelease() override { 40cb93a386Sopenharmony_ci GrMtlRenderTarget::onRelease(); 41cb93a386Sopenharmony_ci GrMtlTexture::onRelease(); 42cb93a386Sopenharmony_ci } 43cb93a386Sopenharmony_ci 44cb93a386Sopenharmony_ciprivate: 45cb93a386Sopenharmony_ci GrMtlTextureRenderTarget(GrMtlGpu* gpu, 46cb93a386Sopenharmony_ci SkBudgeted budgeted, 47cb93a386Sopenharmony_ci SkISize, 48cb93a386Sopenharmony_ci sk_sp<GrMtlAttachment> texture, 49cb93a386Sopenharmony_ci sk_sp<GrMtlAttachment> colorAttachment, 50cb93a386Sopenharmony_ci sk_sp<GrMtlAttachment> resolveAttachment, 51cb93a386Sopenharmony_ci GrMipmapStatus); 52cb93a386Sopenharmony_ci 53cb93a386Sopenharmony_ci GrMtlTextureRenderTarget(GrMtlGpu* gpu, 54cb93a386Sopenharmony_ci SkISize, 55cb93a386Sopenharmony_ci sk_sp<GrMtlAttachment> texture, 56cb93a386Sopenharmony_ci sk_sp<GrMtlAttachment> colorAttachment, 57cb93a386Sopenharmony_ci sk_sp<GrMtlAttachment> resolveAttachment, 58cb93a386Sopenharmony_ci GrMipmapStatus, 59cb93a386Sopenharmony_ci GrWrapCacheable cacheable); 60cb93a386Sopenharmony_ci 61cb93a386Sopenharmony_ci size_t onGpuMemorySize() const override; 62cb93a386Sopenharmony_ci}; 63cb93a386Sopenharmony_ci 64cb93a386Sopenharmony_ci#endif 65