Add pipeline layout support for graphics PSOs
This commit is contained in:
@@ -523,14 +523,19 @@ RHIPipelineState* D3D12Device::CreatePipelineState(const GraphicsPipelineDesc& d
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* rootSignature = CreateRootSignature({});
|
||||
if (rootSignature == nullptr) {
|
||||
delete pso;
|
||||
return nullptr;
|
||||
D3D12RootSignature* rootSignature = nullptr;
|
||||
if (desc.pipelineLayout != nullptr) {
|
||||
auto* pipelineLayout = static_cast<D3D12PipelineLayout*>(desc.pipelineLayout);
|
||||
pso->SetRootSignature(pipelineLayout->GetRootSignature());
|
||||
} else {
|
||||
rootSignature = CreateRootSignature({});
|
||||
if (rootSignature == nullptr) {
|
||||
delete pso;
|
||||
return nullptr;
|
||||
}
|
||||
pso->SetRootSignature(rootSignature->GetRootSignature());
|
||||
}
|
||||
|
||||
pso->SetRootSignature(rootSignature->GetRootSignature());
|
||||
|
||||
D3D12Shader vertexShader;
|
||||
D3D12Shader fragmentShader;
|
||||
D3D12Shader geometryShader;
|
||||
@@ -539,8 +544,10 @@ RHIPipelineState* D3D12Device::CreatePipelineState(const GraphicsPipelineDesc& d
|
||||
const bool geometryCompiled = !hasGeometryShader || CompileD3D12Shader(desc.geometryShader, geometryShader);
|
||||
|
||||
if (!vertexCompiled || !fragmentCompiled || !geometryCompiled) {
|
||||
rootSignature->Shutdown();
|
||||
delete rootSignature;
|
||||
if (rootSignature != nullptr) {
|
||||
rootSignature->Shutdown();
|
||||
delete rootSignature;
|
||||
}
|
||||
delete pso;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -551,8 +558,10 @@ RHIPipelineState* D3D12Device::CreatePipelineState(const GraphicsPipelineDesc& d
|
||||
hasGeometryShader ? geometryShader.GetD3D12Bytecode() : D3D12_SHADER_BYTECODE{});
|
||||
pso->EnsureValid();
|
||||
|
||||
rootSignature->Shutdown();
|
||||
delete rootSignature;
|
||||
if (rootSignature != nullptr) {
|
||||
rootSignature->Shutdown();
|
||||
delete rootSignature;
|
||||
}
|
||||
|
||||
if (!pso->IsValid()) {
|
||||
delete pso;
|
||||
|
||||
Reference in New Issue
Block a user