Brief Task Overview
The goal of the VkDrawIndexedIndirectCommand is to allow us to reduce the draw calls that we need to make. This is also going to have a significant change to atlas::mesh_source.
Where there are consideration to redefining atlas::mesh_source:
struct mesh_source {
uint32_t index_count; // Number of indices to draw
uint32_t instance_count; // Number of instances (usually 1)
uint32_t first_index; // Offset into the index buffer
int32_t vertex_offset; // Offset added to vertex index
uint32_t first_instance; // ID of the first instance (becomes gl_InstanceIndex)
};
Rendering with a single draw call
This is a brief example for performing this draw operation.
std::array<VkDrawIndexedIndirectCommand, 3> draw_commands{};
// Entity 1
drawCommands[0] = {
.indexCount = 1024;
.instanceCount = 1,
.firstIndex = 0,
.vertexOffset = 0,
.firstInstance = 0, // Points to Manifest[0]
};
// Entity 2
drawCommands[1] = {
.indexCount = 512;
.instanceCount = 1,
.firstIndex = 0,
.vertexOffset = 0,
.firstInstance = 1, // Points to Manifest[1]
};
// Entity 3
drawCommands[2] = {
.indexCount = 2048,
.instanceCount = 1,
.firstIndex = 0,
.vertexOffset = 0,
.firstInstance = 2, // Points to Manifest[2]
};
std::span<const VkDrawIndexedIndirectCommand> draw_command_submissions = draw_commands;
const vk::buffer indirect_buffer = ...; // configured
uint32_t offset = 0;
// NOTE: these draw commands go to a VkBuffer handle
// must be configured with vk::buffer_usage::indirect_buffer_bit
vkCmdDrawIndexedIndirect(
command,
indirect_buffer,
offset,
static_cast<uint32_t>(draw_command_submission.size()),
static_cast<uint32_t>(draw_command_submission.size_bytes()));
Brief Task Overview
The goal of the
VkDrawIndexedIndirectCommandis to allow us to reduce the draw calls that we need to make. This is also going to have a significant change toatlas::mesh_source.Where there are consideration to redefining
atlas::mesh_source:Rendering with a single draw call
This is a brief example for performing this draw operation.