Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 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" |
Brian Salomon | 4cfae3b | 2020-07-23 10:33:24 -0400 | [diff] [blame] | 11 | #include "src/gpu/GrTexture.h" |
Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 12 | #include "src/gpu/dawn/GrDawnGpu.h" |
| 13 | |
| 14 | GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu, |
Robert Phillips | 2716daf | 2020-01-23 12:53:42 -0500 | [diff] [blame] | 15 | SkISize dimensions, |
Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 16 | int sampleCnt, |
Stephen White | f03c116 | 2020-01-28 12:39:45 -0500 | [diff] [blame] | 17 | const GrDawnTextureInfo& textureInfo, |
Brian Salomon | a6db510 | 2020-07-21 09:56:23 -0400 | [diff] [blame] | 18 | GrMipmapStatus mipmapStatus) |
Greg Daniel | 4cb2933 | 2020-01-23 10:07:02 -0500 | [diff] [blame] | 19 | : GrSurface(gpu, dimensions, GrProtected::kNo) |
Stephen White | f63d8b7 | 2020-09-29 13:15:43 -0400 | [diff] [blame^] | 20 | , GrDawnTexture(gpu, dimensions, textureInfo, mipmapStatus) |
Stephen White | f03c116 | 2020-01-28 12:39:45 -0500 | [diff] [blame] | 21 | , GrDawnRenderTarget(gpu, dimensions, sampleCnt, |
| 22 | GrDawnRenderTargetInfo(textureInfo)) {} |
Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 23 | |
| 24 | bool GrDawnTextureRenderTarget::canAttemptStencilAttachment() const { |
| 25 | return true; |
| 26 | } |
| 27 | |
| 28 | size_t GrDawnTextureRenderTarget::onGpuMemorySize() const { |
Stephen White | 729c78d | 2019-10-14 12:42:59 -0400 | [diff] [blame] | 29 | const GrCaps& caps = *this->getGpu()->caps(); |
Brian Salomon | 9f2b86c | 2019-10-22 10:37:46 -0400 | [diff] [blame] | 30 | return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(), |
Brian Salomon | 4cfae3b | 2020-07-23 10:33:24 -0400 | [diff] [blame] | 31 | 1, // FIXME: for MSAA |
| 32 | this->mipmapped()); |
Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 33 | } |