blob: 8ad4314f78d938942009843dff8871d95b32419e [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"
Brian Salomon4cfae3b2020-07-23 10:33:24 -040011#include "src/gpu/GrTexture.h"
Stephen White9d421922019-08-14 15:07:42 -040012#include "src/gpu/dawn/GrDawnGpu.h"
13
14GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu,
Robert Phillips2716daf2020-01-23 12:53:42 -050015 SkISize dimensions,
Stephen White3cc8d4f2019-10-30 09:56:23 -040016 wgpu::TextureView textureView,
Stephen White9d421922019-08-14 15:07:42 -040017 int sampleCnt,
Stephen Whitef03c1162020-01-28 12:39:45 -050018 const GrDawnTextureInfo& textureInfo,
Brian Salomona6db5102020-07-21 09:56:23 -040019 GrMipmapStatus mipmapStatus)
Greg Daniel4cb29332020-01-23 10:07:02 -050020 : GrSurface(gpu, dimensions, GrProtected::kNo)
Brian Salomona6db5102020-07-21 09:56:23 -040021 , GrDawnTexture(gpu, dimensions, textureView, textureInfo, mipmapStatus)
Stephen Whitef03c1162020-01-28 12:39:45 -050022 , GrDawnRenderTarget(gpu, dimensions, sampleCnt,
23 GrDawnRenderTargetInfo(textureInfo)) {}
Stephen White9d421922019-08-14 15:07:42 -040024
25bool GrDawnTextureRenderTarget::canAttemptStencilAttachment() const {
26 return true;
27}
28
29size_t GrDawnTextureRenderTarget::onGpuMemorySize() const {
Stephen White729c78d2019-10-14 12:42:59 -040030 const GrCaps& caps = *this->getGpu()->caps();
Brian Salomon9f2b86c2019-10-22 10:37:46 -040031 return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
Brian Salomon4cfae3b2020-07-23 10:33:24 -040032 1, // FIXME: for MSAA
33 this->mipmapped());
Stephen White9d421922019-08-14 15:07:42 -040034}