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 | #ifndef GrDawnTextureRenderTarget_DEFINED |
| 9 | #define GrDawnTextureRenderTarget_DEFINED |
| 10 | |
| 11 | #include "src/gpu/dawn/GrDawnRenderTarget.h" |
| 12 | #include "src/gpu/dawn/GrDawnTexture.h" |
| 13 | |
| 14 | class GrDawnGpu; |
| 15 | |
| 16 | #ifdef SK_BUILD_FOR_WIN |
| 17 | // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via dominance. |
| 18 | #pragma warning(push) |
| 19 | #pragma warning(disable: 4250) |
| 20 | #endif |
| 21 | |
| 22 | class GrDawnTextureRenderTarget : public GrDawnTexture, public GrDawnRenderTarget { |
| 23 | public: |
| 24 | GrDawnTextureRenderTarget(GrDawnGpu* gpu, |
| 25 | const SkISize& size, |
| 26 | GrPixelConfig config, |
| 27 | const dawn::TextureView textureView, |
| 28 | int sampleCnt, |
| 29 | const GrDawnImageInfo& info, |
| 30 | GrMipMapsStatus mipMapsStatus); |
| 31 | |
| 32 | bool canAttemptStencilAttachment() const override; |
| 33 | |
| 34 | GrBackendFormat backendFormat() const override { return GrDawnTexture::backendFormat(); } |
| 35 | |
| 36 | protected: |
| 37 | void onAbandon() override { |
| 38 | GrDawnRenderTarget::onAbandon(); |
| 39 | GrDawnTexture::onAbandon(); |
| 40 | } |
| 41 | |
| 42 | void onRelease() override { |
| 43 | GrDawnRenderTarget::onRelease(); |
| 44 | GrDawnTexture::onRelease(); |
| 45 | } |
| 46 | |
| 47 | private: |
| 48 | size_t onGpuMemorySize() const override; |
| 49 | }; |
| 50 | |
| 51 | #ifdef SK_BUILD_FOR_WIN |
| 52 | #pragma warning(pop) |
| 53 | #endif |
| 54 | |
| 55 | #endif |