• 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 "include/gpu/GrContext.h"
12 #include "src/gpu/GrTexturePriv.h"
13 #include "src/gpu/dawn/GrDawnGpu.h"
14 
GrDawnTextureRenderTarget(GrDawnGpu * gpu,const SkISize & size,GrPixelConfig config,dawn::TextureView textureView,int sampleCnt,const GrDawnImageInfo & info,GrMipMapsStatus mipMapsStatus)15 GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu,
16                                                      const SkISize& size,
17                                                      GrPixelConfig config,
18                                                      dawn::TextureView textureView,
19                                                      int sampleCnt,
20                                                      const GrDawnImageInfo& info,
21                                                      GrMipMapsStatus mipMapsStatus)
22         : GrSurface(gpu, size, config, GrProtected::kNo)
23         , GrDawnTexture(gpu, size, config, textureView, info, mipMapsStatus)
24         , GrDawnRenderTarget(gpu, size, config, sampleCnt, info) {
25 }
26 
canAttemptStencilAttachment() const27 bool GrDawnTextureRenderTarget::canAttemptStencilAttachment() const {
28     return true;
29 }
30 
onGpuMemorySize() const31 size_t GrDawnTextureRenderTarget::onGpuMemorySize() const {
32     return GrSurface::ComputeSize(this->config(), this->width(), this->height(),
33                                   1, // FIXME: for MSAA
34                                   this->texturePriv().mipMapped());
35 }
36