Flutter Engine
The Flutter Engine
GrD3DTextureRenderTarget.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
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
9#ifndef GrD3DTextureRenderTarget_DEFINED
10#define GrD3DTextureRenderTarget_DEFINED
11
15
16class GrD3DGpu;
17
18#ifdef SK_BUILD_FOR_WIN
19// Windows gives bogus warnings about inheriting asTexture/asRenderTarget via dominance.
20#pragma warning(push)
21#pragma warning(disable: 4250)
22#endif
23
25
27public:
31 int sampleCnt,
32 const D3D12_RESOURCE_DESC&,
35 std::string_view label);
36
40
41 GrBackendFormat backendFormat() const override { return this->getBackendFormat(); }
42
43protected:
44 void onAbandon() override {
45 // In order to correctly handle calling texture idle procs, GrD3DTexture must go first.
48 }
49
50 void onRelease() override {
51 // In order to correctly handle calling texture idle procs, GrD3DTexture must go first.
54 }
55
56private:
57 // MSAA, not-wrapped
59 skgpu::Budgeted budgeted,
64 const GrD3DTextureResourceInfo& msaaInfo,
67 const GrD3DDescriptorHeap::CPUHandle& resolveRenderTargetView,
69 std::string_view label);
70
71 // non-MSAA, not-wrapped
73 skgpu::Budgeted budgeted,
78 const GrD3DDescriptorHeap::CPUHandle& renderTargetView,
80 std::string_view label);
81
82 // MSAA, wrapped
88 const GrD3DTextureResourceInfo& msaaInfo,
91 const GrD3DDescriptorHeap::CPUHandle& resolveRenderTargetView,
94 std::string_view label);
95
96 // non-MSAA, wrapped
102 const GrD3DDescriptorHeap::CPUHandle& renderTargetView,
105 std::string_view label);
106
107 // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuffer's memory.
108 size_t onGpuMemorySize() const override;
109
110 void onSetLabel() override;
111
112 // In Direct3D we call the release proc after we are finished with the underlying
113 // GrD3DImage::Resource object (which occurs after the GPU has finished all work on it).
114 void onSetRelease(sk_sp<RefCntedReleaseProc> releaseHelper) override {
115 // Forward the release proc on to GrD3DImage
116 this->setResourceRelease(std::move(releaseHelper));
117 }
118};
119
120#ifdef SK_BUILD_FOR_WIN
121#pragma warning(pop)
122#endif
123
124#endif
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
GrWrapCacheable
Definition: GrTypesPriv.h:85
GrMipmapStatus
Definition: GrTypesPriv.h:523
void onRelease() override
void onAbandon() override
D3D12_CPU_DESCRIPTOR_HANDLE colorRenderTargetView() const
static sk_sp< GrD3DTextureRenderTarget > MakeWrappedTextureRenderTarget(GrD3DGpu *, SkISize dimensions, int sampleCnt, GrWrapCacheable, const GrD3DTextureResourceInfo &, sk_sp< GrD3DResourceState >)
GrBackendFormat backendFormat() const override
static sk_sp< GrD3DTextureRenderTarget > MakeNewTextureRenderTarget(GrD3DGpu *, skgpu::Budgeted, SkISize dimensions, int sampleCnt, const D3D12_RESOURCE_DESC &, GrProtected isProtected, GrMipmapStatus, std::string_view label)
GrBackendFormat getBackendFormat() const
void setResourceRelease(sk_sp< GrSurface::RefCntedReleaseProc > releaseHelper)
void onRelease() override
D3D12_CPU_DESCRIPTOR_HANDLE shaderResourceView()
Definition: GrD3DTexture.h:45
void onAbandon() override
SkISize dimensions() const
Definition: GrSurface.h:27
bool isProtected() const
Definition: GrSurface.h:87
AtkStateType state
Budgeted
Definition: GpuTypes.h:35
Protected
Definition: GpuTypes.h:61
Definition: SkSize.h:16