• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/ganesh/dawn/GrDawnTextureRenderTarget.h"
9 
10 #include "include/core/SkTraceMemoryDump.h"
11 #include "src/gpu/ganesh/GrTexture.h"
12 #include "src/gpu/ganesh/dawn/GrDawnGpu.h"
13 
GrDawnTextureRenderTarget(GrDawnGpu * gpu,SkISize dimensions,int sampleCnt,const GrDawnTextureInfo & textureInfo,GrMipmapStatus mipmapStatus,std::string_view label)14 GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu,
15                                                      SkISize dimensions,
16                                                      int sampleCnt,
17                                                      const GrDawnTextureInfo& textureInfo,
18                                                      GrMipmapStatus mipmapStatus,
19                                                      std::string_view label)
20         : GrSurface(gpu, dimensions, GrProtected::kNo, label)
21         , GrDawnTexture(gpu, dimensions, textureInfo, mipmapStatus, label)
22         , GrDawnRenderTarget(
23                   gpu, dimensions, sampleCnt, GrDawnRenderTargetInfo(textureInfo), label) {}
24 
canAttemptStencilAttachment(bool useMSAASurface) const25 bool GrDawnTextureRenderTarget::canAttemptStencilAttachment(bool useMSAASurface) const {
26     SkASSERT(useMSAASurface == (this->numSamples() > 1));
27     return true;
28 }
29 
onGpuMemorySize() const30 size_t GrDawnTextureRenderTarget::onGpuMemorySize() const {
31     return GrSurface::ComputeSize(this->backendFormat(), this->dimensions(),
32                                   1,  // FIXME: for MSAA
33                                   this->mipmapped());
34 }
35