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" |
| 11 | #include "include/gpu/GrContext.h" |
| 12 | #include "src/gpu/GrTexturePriv.h" |
| 13 | #include "src/gpu/dawn/GrDawnGpu.h" |
| 14 | |
| 15 | GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu, |
Brian Salomon | 9f2b86c | 2019-10-22 10:37:46 -0400 | [diff] [blame] | 16 | const SkISize& dimensions, |
Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 17 | GrPixelConfig config, |
Stephen White | 3cc8d4f | 2019-10-30 09:56:23 -0400 | [diff] [blame^] | 18 | wgpu::TextureView textureView, |
Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 19 | int sampleCnt, |
| 20 | const GrDawnImageInfo& info, |
| 21 | GrMipMapsStatus mipMapsStatus) |
Brian Salomon | 9f2b86c | 2019-10-22 10:37:46 -0400 | [diff] [blame] | 22 | : GrSurface(gpu, dimensions, config, GrProtected::kNo) |
| 23 | , GrDawnTexture(gpu, dimensions, config, textureView, info, mipMapsStatus) |
| 24 | , GrDawnRenderTarget(gpu, dimensions, config, sampleCnt, info) {} |
Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 25 | |
| 26 | bool GrDawnTextureRenderTarget::canAttemptStencilAttachment() const { |
| 27 | return true; |
| 28 | } |
| 29 | |
| 30 | size_t GrDawnTextureRenderTarget::onGpuMemorySize() const { |
Stephen White | 729c78d | 2019-10-14 12:42:59 -0400 | [diff] [blame] | 31 | const GrCaps& caps = *this->getGpu()->caps(); |
Brian Salomon | 9f2b86c | 2019-10-22 10:37:46 -0400 | [diff] [blame] | 32 | return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(), |
Stephen White | 9d42192 | 2019-08-14 15:07:42 -0400 | [diff] [blame] | 33 | 1, // FIXME: for MSAA |
| 34 | this->texturePriv().mipMapped()); |
| 35 | } |