blob: fce4084aa8afc22fb72b02f35251676425274432 [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 White9d421922019-08-14 15:07:42 -040016 int sampleCnt,
Stephen Whitef03c1162020-01-28 12:39:45 -050017 const GrDawnTextureInfo& textureInfo,
Brian Salomona6db5102020-07-21 09:56:23 -040018 GrMipmapStatus mipmapStatus)
Greg Daniel4cb29332020-01-23 10:07:02 -050019 : GrSurface(gpu, dimensions, GrProtected::kNo)
Stephen Whitef63d8b72020-09-29 13:15:43 -040020 , GrDawnTexture(gpu, dimensions, textureInfo, mipmapStatus)
Stephen Whitef03c1162020-01-28 12:39:45 -050021 , GrDawnRenderTarget(gpu, dimensions, sampleCnt,
22 GrDawnRenderTargetInfo(textureInfo)) {}
Stephen White9d421922019-08-14 15:07:42 -040023
24bool GrDawnTextureRenderTarget::canAttemptStencilAttachment() const {
25 return true;
26}
27
28size_t GrDawnTextureRenderTarget::onGpuMemorySize() const {
Stephen White729c78d2019-10-14 12:42:59 -040029 const GrCaps& caps = *this->getGpu()->caps();
Brian Salomon9f2b86c2019-10-22 10:37:46 -040030 return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
Brian Salomon4cfae3b2020-07-23 10:33:24 -040031 1, // FIXME: for MSAA
32 this->mipmapped());
Stephen White9d421922019-08-14 15:07:42 -040033}