• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GrD3DRootSignature_DEFINED
9 #define GrD3DRootSignature_DEFINED
10 
11 #include "include/gpu/d3d/GrD3DTypes.h"
12 #include "src/gpu/GrManagedResource.h"
13 
14 class GrD3DGpu;
15 
16 class GrD3DRootSignature : public GrManagedResource {
17 public:
18     static sk_sp<GrD3DRootSignature> Make(GrD3DGpu* gpu, int numTextureSamplers, int numUAVs);
19 
20     enum class ParamIndex {
21         kConstantBufferView = 0,
22         kShaderViewDescriptorTable = 1,
23         kSamplerDescriptorTable = 2,
24 
25         kLast = kSamplerDescriptorTable
26     };
27     static constexpr unsigned int kParamIndexCount = (unsigned int)(ParamIndex::kLast) + 1;
28 
29     bool isCompatible(int numTextureSamplers, int numUAVs) const;
30 
rootSignature()31     ID3D12RootSignature* rootSignature() const { return fRootSignature.get(); }
32 
33 #ifdef SK_TRACE_MANAGED_RESOURCES
34     /** Output a human-readable dump of this resource's information
35     */
dumpInfo()36     void dumpInfo() const override {
37         SkDebugf("GrD3DRootSignature: %p, numTextures: %d (%d refs)\n",
38                  fRootSignature.get(), fNumTextureSamplers, this->getRefCnt());
39     }
40 #endif
41 
42 private:
43     GrD3DRootSignature(gr_cp<ID3D12RootSignature> rootSig, int numTextureSamplers, int numUAVs);
44 
45     // This will be called right before this class is destroyed and there is no reason to explicitly
46     // release the fRootSignature cause the gr_cp will handle that in the dtor.
freeGPUData()47     void freeGPUData() const override {}
48 
49     gr_cp<ID3D12RootSignature> fRootSignature;
50     int fNumTextureSamplers;
51     int fNumUAVs;
52 };
53 
54 #endif
55