blob: 16c54c802ce42a350f642e556e6dd3280605c6e5 [file] [log] [blame]
Stephen White985741a2019-07-18 11:43:45 -04001/*
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
Mike Klein52337de2019-07-25 09:00:52 -05008#include "src/gpu/dawn/GrDawnRenderTarget.h"
Stephen White985741a2019-07-18 11:43:45 -04009
10#include "include/gpu/GrBackendSurface.h"
11#include "src/gpu/dawn/GrDawnGpu.h"
12#include "src/gpu/dawn/GrDawnUtil.h"
13
14GrDawnRenderTarget::GrDawnRenderTarget(GrDawnGpu* gpu,
Stephen White0850dcd2019-08-13 15:28:47 -040015 const SkISize& size,
16 GrPixelConfig config,
Brian Salomon27b4d8d2019-07-22 14:23:45 -040017 int sampleCnt,
Stephen White0850dcd2019-08-13 15:28:47 -040018 const GrDawnImageInfo& info)
19 : GrSurface(gpu, size, config, GrProtected::kNo)
20 , GrRenderTarget(gpu, size, config, sampleCnt, GrProtected::kNo)
21 , fInfo(info) {
Stephen White985741a2019-07-18 11:43:45 -040022}
23
24sk_sp<GrDawnRenderTarget>
25GrDawnRenderTarget::MakeWrapped(GrDawnGpu* gpu,
Stephen White0850dcd2019-08-13 15:28:47 -040026 const SkISize& size,
27 GrPixelConfig config,
Brian Salomon27b4d8d2019-07-22 14:23:45 -040028 int sampleCnt,
Stephen White985741a2019-07-18 11:43:45 -040029 const GrDawnImageInfo& info) {
Stephen White0850dcd2019-08-13 15:28:47 -040030 sk_sp<GrDawnRenderTarget> rt(new GrDawnRenderTarget(gpu, size, config, sampleCnt, info));
31 rt->registerWithCacheWrapped(GrWrapCacheable::kNo);
32 return rt;
Stephen White985741a2019-07-18 11:43:45 -040033}
34
35bool GrDawnRenderTarget::completeStencilAttachment() {
36 return true;
37}
38
39GrDawnRenderTarget::~GrDawnRenderTarget() {
40}
41
42void GrDawnRenderTarget::onRelease() {
43 INHERITED::onRelease();
44}
45
46void GrDawnRenderTarget::onAbandon() {
47 INHERITED::onAbandon();
48}
49
50GrBackendRenderTarget GrDawnRenderTarget::getBackendRenderTarget() const {
51 return GrBackendRenderTarget(this->width(), this->height(), this->numSamples(),
52 this->numSamples(), fInfo);
53}
54
55GrBackendFormat GrDawnRenderTarget::backendFormat() const {
56 return GrBackendFormat::MakeDawn(fInfo.fFormat);
57}