*頂点シェーダ *ピクセルシェーダ *ジオメトリシェーダ *ハルシェーダ *ドメインシェーダ *計算シェーダ
//一番シンプル m_rootSignature = RootSignature::CreateSimple();
namespace RootSignature {
static inline ComPtr<ID3D12RootSignature> CreateDirect(const CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC& desc) {
auto device = App::GetID3D12Device();
D3D12_FEATURE_DATA_ROOT_SIGNATURE featureData = {};
featureData.HighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_1;
if (FAILED(device->CheckFeatureSupport(D3D12_FEATURE_ROOT_SIGNATURE, &featureData, sizeof(featureData))))
{
featureData.HighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_0;
}
ComPtr<ID3DBlob> signature;
ComPtr<ID3DBlob> error;
ComPtr<ID3D12RootSignature> ret;
ThrowIfFailed(D3DX12SerializeVersionedRootSignature(&desc, featureData.HighestVersion, &signature, &error),
L"ルートシグネチャのシリアライズに失敗しました",
L"D3DX12SerializeVersionedRootSignature(&rootSignatureDesc, featureData.HighestVersion, &signature, &error)",
L"RootSignature::CreateDirect()"
);
ThrowIfFailed(
device->CreateRootSignature(0, signature->GetBufferPointer(),
signature->GetBufferSize(), IID_PPV_ARGS(&ret)),
L"ルートシグネチャの作成に失敗しました",
L"device->CreateRootSignature()",
L"RootSignature::CreateDirect()"
);
return ret;
}
//一番シンプルなルートシグネチャ
static inline ComPtr<ID3D12RootSignature> CreateSimple() {
CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC rootSignatureDesc;
rootSignatureDesc.Init_1_1(
0,
nullptr,
0,
nullptr,
D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT
);
return CreateDirect(rootSignatureDesc);
}
//中略
}
inline void Init_1_1( UINT numParameters, //パラメータの数 _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER1* _pParameters, //パラメータのポインタ UINT numStaticSamplers = 0, //スタティックサンプラーの数 _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr, //スタティックサンプラーのポインタ D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE //フラグ
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE