Vulkan: Implement Draw* commands

This commit is contained in:
Corentin Wallez 2018-01-09 07:52:38 -08:00 committed by Corentin Wallez
parent 88d85fbaac
commit 49450b5644
1 changed files with 15 additions and 0 deletions

View File

@ -114,6 +114,21 @@ namespace backend { namespace vulkan {
dstBuffer, 1, &region); dstBuffer, 1, &region);
} break; } break;
case Command::DrawArrays: {
DrawArraysCmd* draw = mCommands.NextCommand<DrawArraysCmd>();
device->fn.CmdDraw(commands, draw->vertexCount, draw->instanceCount,
draw->firstVertex, draw->firstInstance);
} break;
case Command::DrawElements: {
DrawElementsCmd* draw = mCommands.NextCommand<DrawElementsCmd>();
uint32_t vertexOffset = 0;
device->fn.CmdDrawIndexed(commands, draw->indexCount, draw->instanceCount,
draw->firstIndex, vertexOffset, draw->firstInstance);
} break;
case Command::SetIndexBuffer: { case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = mCommands.NextCommand<SetIndexBufferCmd>(); SetIndexBufferCmd* cmd = mCommands.NextCommand<SetIndexBufferCmd>();
VkBuffer indexBuffer = ToBackend(cmd->buffer)->GetHandle(); VkBuffer indexBuffer = ToBackend(cmd->buffer)->GetHandle();