Add compute to D3D12 backend

This commit is contained in:
Austin Eng 2017-07-05 17:32:18 -04:00 committed by Austin Eng
parent dc6bb4a16c
commit 37d11539a4
3 changed files with 15 additions and 2 deletions

View File

@ -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());

View File

@ -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;

View File

@ -48,7 +48,7 @@ namespace d3d12 {
{ nullptr },
nullptr,
entryPoint.c_str(),
"cs_5_0",
"cs_5_1",
compileFlags,
0,
&compiledShader,