2 * Copyright 2020 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrD3DRootSignature_DEFINED
9 #define GrD3DRootSignature_DEFINED
11 #include "include/gpu/d3d/GrD3DTypes.h"
12 #include "src/gpu/ganesh/GrManagedResource.h"
16 class GrD3DRootSignature : public GrManagedResource {
18 static sk_sp<GrD3DRootSignature> Make(GrD3DGpu* gpu, int numTextureSamplers, int numUAVs);
20 enum class ParamIndex {
21 kConstantBufferView = 0,
22 kShaderViewDescriptorTable = 1,
23 kSamplerDescriptorTable = 2,
25 kLast = kSamplerDescriptorTable
27 inline static constexpr unsigned int kParamIndexCount = (unsigned int)(ParamIndex::kLast) + 1;
29 bool isCompatible(int numTextureSamplers, int numUAVs) const;
31 ID3D12RootSignature* rootSignature() const { return fRootSignature.get(); }
33 #ifdef SK_TRACE_MANAGED_RESOURCES
34 /** Output a human-readable dump of this resource's information
36 void dumpInfo() const override {
37 SkDebugf("GrD3DRootSignature: %p, numTextures: %d (%d refs)\n",
38 fRootSignature.get(), fNumTextureSamplers, this->getRefCnt());
43 GrD3DRootSignature(gr_cp<ID3D12RootSignature> rootSig, int numTextureSamplers, int numUAVs);
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.
47 void freeGPUData() const override {}
49 gr_cp<ID3D12RootSignature> fRootSignature;
50 int fNumTextureSamplers;