Add Vulkan / D3D12 indirect buffer flags

Adds missing flags for the indirect usage in vulkan and d3d12.

Bug: dawn:169
Change-Id: I786ea56faaefcbd10100dae40c7893bbc6d5d0ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8061
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
This commit is contained in:
Idan Raiter 2019-06-12 16:35:09 +00:00 committed by Commit Bot service account
parent 17738b6d8c
commit 0e646e95e0
3 changed files with 15 additions and 3 deletions

View File

@ -51,6 +51,9 @@ namespace dawn_native { namespace d3d12 {
if (usage & dawn::BufferUsageBit::Storage) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
if (usage & dawn::BufferUsageBit::Indirect) {
resourceState |= D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT;
}
return resourceState;
}

View File

@ -44,6 +44,9 @@ namespace dawn_native { namespace vulkan {
if (usage & dawn::BufferUsageBit::Storage) {
flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
if (usage & dawn::BufferUsageBit::Indirect) {
flags |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT;
}
return flags;
}
@ -65,6 +68,9 @@ namespace dawn_native { namespace vulkan {
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
if (usage & dawn::BufferUsageBit::Indirect) {
flags |= VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT;
}
return flags;
}
@ -96,6 +102,9 @@ namespace dawn_native { namespace vulkan {
if (usage & dawn::BufferUsageBit::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
if (usage & dawn::BufferUsageBit::Indirect) {
flags |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
}
return flags;
}

View File

@ -468,13 +468,13 @@ namespace dawn_native { namespace vulkan {
} break;
case Command::DispatchIndirect: {
DispatchIndirectCmd* Dispatch = mCommands.NextCommand<DispatchIndirectCmd>();
VkBuffer indirectBuffer = ToBackend(Dispatch->indirectBuffer)->GetHandle();
DispatchIndirectCmd* dispatch = mCommands.NextCommand<DispatchIndirectCmd>();
VkBuffer indirectBuffer = ToBackend(dispatch->indirectBuffer)->GetHandle();
descriptorSets.Flush(device, commands, VK_PIPELINE_BIND_POINT_COMPUTE);
device->fn.CmdDispatchIndirect(
commands, indirectBuffer,
static_cast<VkDeviceSize>(Dispatch->indirectOffset));
static_cast<VkDeviceSize>(dispatch->indirectOffset));
} break;
case Command::SetBindGroup: {