From 79179c28ef7758099cfccf5acce33d3eae3ffe1c Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Fri, 2 Jan 2015 18:21:39 -0800 Subject: [PATCH] Experimenting with index ranges. Look unused by d3d :( --- src/xenia/gpu/gl4/command_processor.cc | 9 ++++++++- src/xenia/gpu/gl4/command_processor.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index 50b562051..d22c9527b 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -1311,8 +1311,15 @@ void CommandProcessor::PrepareDraw(DrawCommand* draw_command) { cmd.index_count = 0; cmd.index_buffer.address = nullptr; - // Generic stuff. + // Starting index when drawing indexed. cmd.start_index = regs[XE_GPU_REG_VGT_INDX_OFFSET].u32; + + // Min/max index ranges. This is often [0,FFFF|FFFFFF], but if it's not we + // can use it to do a glDrawRangeElements. + cmd.min_index = regs[XE_GPU_REG_VGT_MIN_VTX_INDX].u32; + cmd.max_index = regs[XE_GPU_REG_VGT_MAX_VTX_INDX].u32; + + // ? cmd.base_vertex = 0; cmd.state_data = nullptr; diff --git a/src/xenia/gpu/gl4/command_processor.h b/src/xenia/gpu/gl4/command_processor.h index 0d5a39c64..5a98fefaf 100644 --- a/src/xenia/gpu/gl4/command_processor.h +++ b/src/xenia/gpu/gl4/command_processor.h @@ -79,6 +79,8 @@ static_assert(sizeof(UniformDataBlock) <= 16 * 1024, struct DrawCommand { PrimitiveType prim_type; uint32_t start_index; + uint32_t min_index; + uint32_t max_index; uint32_t index_count; uint32_t base_vertex;