Add compute to D3D12 backend
This commit is contained in:
parent
dc6bb4a16c
commit
37d11539a4
|
@ -25,6 +25,16 @@ namespace backend {
|
|||
namespace d3d12 {
|
||||
|
||||
namespace {
|
||||
D3D12_RESOURCE_FLAGS D3D12ResourceFlags(nxt::BufferUsageBit usage) {
|
||||
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
|
||||
|
||||
if (usage & nxt::BufferUsageBit::Storage) {
|
||||
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
D3D12_RESOURCE_STATES D3D12BufferUsage(nxt::BufferUsageBit usage) {
|
||||
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
|
||||
|
||||
|
@ -72,7 +82,7 @@ namespace d3d12 {
|
|||
resourceDescriptor.SampleDesc.Count = 1;
|
||||
resourceDescriptor.SampleDesc.Quality = 0;
|
||||
resourceDescriptor.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
|
||||
resourceDescriptor.Flags = D3D12_RESOURCE_FLAG_NONE;
|
||||
resourceDescriptor.Flags = D3D12ResourceFlags(GetAllowedUsage());
|
||||
|
||||
auto heapType = D3D12HeapType(GetAllowedUsage());
|
||||
auto bufferUsage = D3D12BufferUsage(GetUsage());
|
||||
|
|
|
@ -488,6 +488,9 @@ namespace d3d12 {
|
|||
ComputePipeline* pipeline = ToBackend(cmd->pipeline).Get();
|
||||
PipelineLayout* layout = ToBackend(pipeline->GetLayout());
|
||||
|
||||
commandList->SetComputeRootSignature(layout->GetRootSignature().Get());
|
||||
commandList->SetPipelineState(pipeline->GetPipelineState().Get());
|
||||
|
||||
// TODO(enga@google.com): Implement compute pipelines
|
||||
bindingTracker.SetInheritedBindGroups(commandList, lastLayout, layout);
|
||||
lastLayout = layout;
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace d3d12 {
|
|||
{ nullptr },
|
||||
nullptr,
|
||||
entryPoint.c_str(),
|
||||
"cs_5_0",
|
||||
"cs_5_1",
|
||||
compileFlags,
|
||||
0,
|
||||
&compiledShader,
|
||||
|
|
Loading…
Reference in New Issue