[D3D12] Refactor compute pipeline creation

This commit is contained in:
Triang3l
2018-08-26 00:56:41 +03:00
parent 791c275fab
commit 79d43bb943
4 changed files with 52 additions and 54 deletions

View File

@@ -41,6 +41,22 @@ ID3D12RootSignature* CreateRootSignature(
return root_signature;
}
ID3D12PipelineState* CreateComputePipeline(
ID3D12Device* device, const void* shader, size_t shader_size,
ID3D12RootSignature* root_signature) {
D3D12_COMPUTE_PIPELINE_STATE_DESC desc;
desc.pRootSignature = root_signature;
desc.CS.pShaderBytecode = shader;
desc.CS.BytecodeLength = shader_size;
desc.NodeMask = 0;
desc.CachedPSO.pCachedBlob = nullptr;
desc.CachedPSO.CachedBlobSizeInBytes = 0;
desc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
ID3D12PipelineState* pipeline = nullptr;
device->CreateComputePipelineState(&desc, IID_PPV_ARGS(&pipeline));
return pipeline;
}
} // namespace util
} // namespace d3d12
} // namespace ui

View File

@@ -30,6 +30,11 @@ inline bool ReleaseAndNull(T& object) {
ID3D12RootSignature* CreateRootSignature(ID3D12Device* device,
const D3D12_ROOT_SIGNATURE_DESC& desc);
ID3D12PipelineState* CreateComputePipeline(ID3D12Device* device,
const void* shader,
size_t shader_size,
ID3D12RootSignature* root_signature);
} // namespace util
} // namespace d3d12
} // namespace ui