blob: d94fd24f4984a82782770583acd1b403a2f3bb61 [file] [log] [blame]
Stephen White9d421922019-08-14 15:07:42 -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
8#include "src/gpu/dawn/GrDawnTextureRenderTarget.h"
9
10#include "include/core/SkTraceMemoryDump.h"
11#include "include/gpu/GrContext.h"
12#include "src/gpu/GrTexturePriv.h"
13#include "src/gpu/dawn/GrDawnGpu.h"
14
15GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu,
Brian Salomon9f2b86c2019-10-22 10:37:46 -040016 const SkISize& dimensions,
Stephen White9d421922019-08-14 15:07:42 -040017 GrPixelConfig config,
Stephen White3cc8d4f2019-10-30 09:56:23 -040018 wgpu::TextureView textureView,
Stephen White9d421922019-08-14 15:07:42 -040019 int sampleCnt,
20 const GrDawnImageInfo& info,
21 GrMipMapsStatus mipMapsStatus)
Brian Salomon9f2b86c2019-10-22 10:37:46 -040022 : GrSurface(gpu, dimensions, config, GrProtected::kNo)
23 , GrDawnTexture(gpu, dimensions, config, textureView, info, mipMapsStatus)
24 , GrDawnRenderTarget(gpu, dimensions, config, sampleCnt, info) {}
Stephen White9d421922019-08-14 15:07:42 -040025
26bool GrDawnTextureRenderTarget::canAttemptStencilAttachment() const {
27 return true;
28}
29
30size_t GrDawnTextureRenderTarget::onGpuMemorySize() const {
Stephen White729c78d2019-10-14 12:42:59 -040031 const GrCaps& caps = *this->getGpu()->caps();
Brian Salomon9f2b86c2019-10-22 10:37:46 -040032 return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
Stephen White9d421922019-08-14 15:07:42 -040033 1, // FIXME: for MSAA
34 this->texturePriv().mipMapped());
35}