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