mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add draw indirect to Rendering Device
This commit is contained in:
parent
2be730a05b
commit
d36a872432
5 changed files with 183 additions and 0 deletions
|
@ -699,6 +699,16 @@ void RenderingDeviceGraph::_run_draw_list_command(RDD::CommandBufferID p_command
|
|||
driver->command_render_draw_indexed(p_command_buffer, draw_indexed_instruction->index_count, draw_indexed_instruction->instance_count, draw_indexed_instruction->first_index, 0, 0);
|
||||
instruction_data_cursor += sizeof(DrawListDrawIndexedInstruction);
|
||||
} break;
|
||||
case DrawListInstruction::TYPE_DRAW_INDIRECT: {
|
||||
const DrawListDrawIndirectInstruction *draw_indirect_instruction = reinterpret_cast<const DrawListDrawIndirectInstruction *>(instruction);
|
||||
driver->command_render_draw_indirect(p_command_buffer, draw_indirect_instruction->buffer, draw_indirect_instruction->offset, draw_indirect_instruction->draw_count, draw_indirect_instruction->stride);
|
||||
instruction_data_cursor += sizeof(DrawListDrawIndirectInstruction);
|
||||
} break;
|
||||
case DrawListInstruction::TYPE_DRAW_INDEXED_INDIRECT: {
|
||||
const DrawListDrawIndexedIndirectInstruction *draw_indexed_indirect_instruction = reinterpret_cast<const DrawListDrawIndexedIndirectInstruction *>(instruction);
|
||||
driver->command_render_draw_indexed_indirect(p_command_buffer, draw_indexed_indirect_instruction->buffer, draw_indexed_indirect_instruction->offset, draw_indexed_indirect_instruction->draw_count, draw_indexed_indirect_instruction->stride);
|
||||
instruction_data_cursor += sizeof(DrawListDrawIndexedIndirectInstruction);
|
||||
} break;
|
||||
case DrawListInstruction::TYPE_EXECUTE_COMMANDS: {
|
||||
const DrawListExecuteCommandsInstruction *execute_commands_instruction = reinterpret_cast<const DrawListExecuteCommandsInstruction *>(instruction);
|
||||
driver->command_buffer_execute_secondary(p_command_buffer, execute_commands_instruction->command_buffer);
|
||||
|
@ -1178,6 +1188,16 @@ void RenderingDeviceGraph::_print_draw_list(const uint8_t *p_instruction_data, u
|
|||
print_line("\tDRAW INDICES", draw_indexed_instruction->index_count, "INSTANCES", draw_indexed_instruction->instance_count, "FIRST INDEX", draw_indexed_instruction->first_index);
|
||||
instruction_data_cursor += sizeof(DrawListDrawIndexedInstruction);
|
||||
} break;
|
||||
case DrawListInstruction::TYPE_DRAW_INDIRECT: {
|
||||
const DrawListDrawIndirectInstruction *draw_indirect_instruction = reinterpret_cast<const DrawListDrawIndirectInstruction *>(instruction);
|
||||
print_line("\tDRAW INDIRECT BUFFER ID", itos(draw_indirect_instruction->buffer.id), "OFFSET", draw_indirect_instruction->offset, "DRAW COUNT", draw_indirect_instruction->draw_count, "STRIDE", draw_indirect_instruction->stride);
|
||||
instruction_data_cursor += sizeof(DrawListDrawIndirectInstruction);
|
||||
} break;
|
||||
case DrawListInstruction::TYPE_DRAW_INDEXED_INDIRECT: {
|
||||
const DrawListDrawIndexedIndirectInstruction *draw_indexed_indirect_instruction = reinterpret_cast<const DrawListDrawIndexedIndirectInstruction *>(instruction);
|
||||
print_line("\tDRAW INDEXED INDIRECT BUFFER ID", itos(draw_indexed_indirect_instruction->buffer.id), "OFFSET", draw_indexed_indirect_instruction->offset, "DRAW COUNT", draw_indexed_indirect_instruction->draw_count, "STRIDE", draw_indexed_indirect_instruction->stride);
|
||||
instruction_data_cursor += sizeof(DrawListDrawIndexedIndirectInstruction);
|
||||
} break;
|
||||
case DrawListInstruction::TYPE_EXECUTE_COMMANDS: {
|
||||
print_line("\tEXECUTE COMMANDS");
|
||||
instruction_data_cursor += sizeof(DrawListExecuteCommandsInstruction);
|
||||
|
@ -1596,6 +1616,26 @@ void RenderingDeviceGraph::add_draw_list_draw_indexed(uint32_t p_index_count, ui
|
|||
instruction->first_index = p_first_index;
|
||||
}
|
||||
|
||||
void RenderingDeviceGraph::add_draw_list_draw_indirect(RDD::BufferID p_buffer, uint32_t p_offset, uint32_t p_draw_count, uint32_t p_stride) {
|
||||
DrawListDrawIndirectInstruction *instruction = reinterpret_cast<DrawListDrawIndirectInstruction *>(_allocate_draw_list_instruction(sizeof(DrawListDrawIndirectInstruction)));
|
||||
instruction->type = DrawListInstruction::TYPE_DRAW_INDIRECT;
|
||||
instruction->buffer = p_buffer;
|
||||
instruction->offset = p_offset;
|
||||
instruction->draw_count = p_draw_count;
|
||||
instruction->stride = p_stride;
|
||||
draw_instruction_list.stages.set_flag(RDD::PIPELINE_STAGE_DRAW_INDIRECT_BIT);
|
||||
}
|
||||
|
||||
void RenderingDeviceGraph::add_draw_list_draw_indexed_indirect(RDD::BufferID p_buffer, uint32_t p_offset, uint32_t p_draw_count, uint32_t p_stride) {
|
||||
DrawListDrawIndexedIndirectInstruction *instruction = reinterpret_cast<DrawListDrawIndexedIndirectInstruction *>(_allocate_draw_list_instruction(sizeof(DrawListDrawIndexedIndirectInstruction)));
|
||||
instruction->type = DrawListInstruction::TYPE_DRAW_INDEXED_INDIRECT;
|
||||
instruction->buffer = p_buffer;
|
||||
instruction->offset = p_offset;
|
||||
instruction->draw_count = p_draw_count;
|
||||
instruction->stride = p_stride;
|
||||
draw_instruction_list.stages.set_flag(RDD::PIPELINE_STAGE_DRAW_INDIRECT_BIT);
|
||||
}
|
||||
|
||||
void RenderingDeviceGraph::add_draw_list_execute_commands(RDD::CommandBufferID p_command_buffer) {
|
||||
DrawListExecuteCommandsInstruction *instruction = reinterpret_cast<DrawListExecuteCommandsInstruction *>(_allocate_draw_list_instruction(sizeof(DrawListExecuteCommandsInstruction)));
|
||||
instruction->type = DrawListInstruction::TYPE_EXECUTE_COMMANDS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue