Fast-pathing MDI's that have only one draw.

This commit is contained in:
Ben Vanik 2015-01-04 14:23:28 -08:00
parent 4fcf9c6229
commit 55c4488ab2
2 changed files with 27 additions and 8 deletions

View File

@ -335,14 +335,33 @@ bool DrawBatcher::Flush(FlushMode mode) {
batch_state_.command_stride, vertex_buffer_count); batch_state_.command_stride, vertex_buffer_count);
} }
} else { } else {
if (batch_state_.indexed) { if (batch_state_.draw_count == 1) {
glMultiDrawElementsIndirect(prim_type, batch_state_.index_type, // Fast path for one draw. Removes MDI overhead when not required.
indirect_offset, batch_state_.draw_count, if (batch_state_.indexed) {
batch_state_.command_stride); auto& cmd = active_draw_.draw_elements_cmd;
glDrawElementsInstancedBaseVertexBaseInstance(
prim_type, cmd->count, batch_state_.index_type,
reinterpret_cast<void*>(
uintptr_t(cmd->first_index) *
(batch_state_.index_type == GL_UNSIGNED_SHORT ? 2 : 4)),
cmd->instance_count, cmd->base_vertex, cmd->base_instance);
} else {
auto& cmd = active_draw_.draw_arrays_cmd;
glDrawArraysInstancedBaseInstance(prim_type, cmd->first_index,
cmd->count, cmd->instance_count,
cmd->base_instance);
}
} else { } else {
glMultiDrawArraysIndirect(prim_type, indirect_offset, // Full multi-draw.
batch_state_.draw_count, if (batch_state_.indexed) {
batch_state_.command_stride); glMultiDrawElementsIndirect(prim_type, batch_state_.index_type,
indirect_offset, batch_state_.draw_count,
batch_state_.command_stride);
} else {
glMultiDrawArraysIndirect(prim_type, indirect_offset,
batch_state_.draw_count,
batch_state_.command_stride);
}
} }
} }

View File

@ -287,7 +287,7 @@ SHIM_CALL KeDelayExecutionThread_shim(PPCContext* ppc_state,
} }
SHIM_CALL NtYieldExecution_shim(PPCContext* ppc_state, KernelState* state) { SHIM_CALL NtYieldExecution_shim(PPCContext* ppc_state, KernelState* state) {
XELOGD("NtYieldExecution()"); //XELOGD("NtYieldExecution()");
XThread* thread = XThread::GetCurrentThread(); XThread* thread = XThread::GetCurrentThread();
X_STATUS result = thread->Delay(0, 0, 0); X_STATUS result = thread->Delay(0, 0, 0);
SHIM_SET_RETURN_64(0); SHIM_SET_RETURN_64(0);