Debian Codegraph @

src/gpu/ganesh/d3d/GrD3DPipeline.h

raw
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 #ifndef GrD3DPipeline_DEFINED
9 #define GrD3DPipeline_DEFINED
10
11 #include "include/gpu/ganesh/d3d/GrD3DTypes.h"
12 #include "src/gpu/ganesh/GrManagedResource.h"
13
14 class GrD3DPipeline : public GrManagedResource {
15 public:
16 static sk_sp<GrD3DPipeline> Make(gr_cp<ID3D12PipelineState> pipelineState) {
17 if (!pipelineState) {
18 return nullptr;
19 }
20 return sk_sp<GrD3DPipeline>(new GrD3DPipeline(std::move(pipelineState)));
21 }
22 #ifdef SK_TRACE_MANAGED_RESOURCES
23 /** Output a human-readable dump of this resource's information
24 */
25 void dumpInfo() const override {
26 SkDebugf("GrD3DPipeline: %p (%d refs)\n", fPipelineState.get(), this->getRefCnt());
27 }
28 #endif
29
30 // This will be called right before this class is destroyed and there is no reason to explicitly
31 // release the fPipelineState cause the gr_cp will handle that in the dtor.
32 void freeGPUData() const override {}
33
34 ID3D12PipelineState* d3dPipelineState() const { return fPipelineState.get(); }
35
36 private:
37 GrD3DPipeline(gr_cp<ID3D12PipelineState> pipelineState)
38 : fPipelineState(std::move(pipelineState)) {
39 }
40
41 gr_cp<ID3D12PipelineState> fPipelineState;
42
43 using INHERITED = GrManagedResource;
44 };
45
46 #endif