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);
}
} else {
if (batch_state_.indexed) {
glMultiDrawElementsIndirect(prim_type, batch_state_.index_type,
indirect_offset, batch_state_.draw_count,
batch_state_.command_stride);
if (batch_state_.draw_count == 1) {
// Fast path for one draw. Removes MDI overhead when not required.
if (batch_state_.indexed) {
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 {
glMultiDrawArraysIndirect(prim_type, indirect_offset,
batch_state_.draw_count,
batch_state_.command_stride);
// Full multi-draw.
if (batch_state_.indexed) {
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) {
XELOGD("NtYieldExecution()");
//XELOGD("NtYieldExecution()");
XThread* thread = XThread::GetCurrentThread();
X_STATUS result = thread->Delay(0, 0, 0);
SHIM_SET_RETURN_64(0);