1 /*
2 * Copyright 2019 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "src/gpu/dawn/GrDawnRenderTarget.h"
9
10 #include "include/gpu/GrBackendSurface.h"
11 #include "src/gpu/dawn/GrDawnGpu.h"
12 #include "src/gpu/dawn/GrDawnUtil.h"
13
GrDawnRenderTarget(GrDawnGpu * gpu,const SkISize & size,GrPixelConfig config,int sampleCnt,const GrDawnImageInfo & info)14 GrDawnRenderTarget::GrDawnRenderTarget(GrDawnGpu* gpu,
15 const SkISize& size,
16 GrPixelConfig config,
17 int sampleCnt,
18 const GrDawnImageInfo& info)
19 : GrSurface(gpu, size, config, GrProtected::kNo)
20 , GrRenderTarget(gpu, size, config, sampleCnt, GrProtected::kNo)
21 , fInfo(info) {
22 }
23
24 sk_sp<GrDawnRenderTarget>
MakeWrapped(GrDawnGpu * gpu,const SkISize & size,GrPixelConfig config,int sampleCnt,const GrDawnImageInfo & info)25 GrDawnRenderTarget::MakeWrapped(GrDawnGpu* gpu,
26 const SkISize& size,
27 GrPixelConfig config,
28 int sampleCnt,
29 const GrDawnImageInfo& info) {
30 sk_sp<GrDawnRenderTarget> rt(new GrDawnRenderTarget(gpu, size, config, sampleCnt, info));
31 rt->registerWithCacheWrapped(GrWrapCacheable::kNo);
32 return rt;
33 }
34
completeStencilAttachment()35 bool GrDawnRenderTarget::completeStencilAttachment() {
36 return true;
37 }
38
~GrDawnRenderTarget()39 GrDawnRenderTarget::~GrDawnRenderTarget() {
40 }
41
onRelease()42 void GrDawnRenderTarget::onRelease() {
43 INHERITED::onRelease();
44 }
45
onAbandon()46 void GrDawnRenderTarget::onAbandon() {
47 INHERITED::onAbandon();
48 }
49
getBackendRenderTarget() const50 GrBackendRenderTarget GrDawnRenderTarget::getBackendRenderTarget() const {
51 return GrBackendRenderTarget(this->width(), this->height(), this->numSamples(),
52 this->numSamples(), fInfo);
53 }
54
backendFormat() const55 GrBackendFormat GrDawnRenderTarget::backendFormat() const {
56 return GrBackendFormat::MakeDawn(fInfo.fFormat);
57 }
58