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