From 2a082ff2425505eb965cd9ce6f7a1716a63f694c Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 3 Jan 2015 13:50:11 -0800 Subject: [PATCH] Tracking bytes used in the scratch buffer. --- src/xenia/gpu/gl4/command_processor.cc | 3 +++ src/xenia/gpu/gl4/command_processor.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index 61d3f283f..92978df92 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -1361,6 +1361,7 @@ bool CommandProcessor::IssueDraw(DrawCommand* draw_command) { // Allocate a state data block. // Everything the shaders access lives here. auto allocation = scratch_buffer_.Acquire(sizeof(UniformDataBlock)); + scratch_buffer_stats_.total_state_data_size += sizeof(UniformDataBlock); cmd.state_data = reinterpret_cast(allocation.host_ptr); if (!cmd.state_data) { PLOGE("Unable to allocate uniform data buffer"); @@ -2117,6 +2118,7 @@ CommandProcessor::UpdateStatus CommandProcessor::PopulateIndexBuffer( cmd.index_count * (info.format == IndexFormat::kInt32 ? sizeof(uint32_t) : sizeof(uint16_t)); auto allocation = scratch_buffer_.Acquire(total_size); + scratch_buffer_stats_.total_indices_size += total_size; if (info.format == IndexFormat::kInt32) { poly::copy_and_swap_32_aligned( @@ -2177,6 +2179,7 @@ CommandProcessor::UpdateStatus CommandProcessor::PopulateVertexBuffers( assert_not_zero(fetch->size); auto allocation = scratch_buffer_.Acquire(fetch->size * sizeof(uint32_t)); + scratch_buffer_stats_.total_vertices_size += fetch->size * sizeof(uint32_t); // Copy and byte swap the entire buffer. // We could be smart about this to save GPU bandwidth by building a CRC diff --git a/src/xenia/gpu/gl4/command_processor.h b/src/xenia/gpu/gl4/command_processor.h index 2433e964e..5962fb212 100644 --- a/src/xenia/gpu/gl4/command_processor.h +++ b/src/xenia/gpu/gl4/command_processor.h @@ -308,8 +308,15 @@ class CommandProcessor { GLuint point_list_geometry_program_; GLuint rect_list_geometry_program_; GLuint quad_list_geometry_program_; + TextureCache texture_cache_; + CircularBuffer scratch_buffer_; + struct ScratchBufferStats { + size_t total_state_data_size = 0; + size_t total_indices_size = 0; + size_t total_vertices_size = 0; + } scratch_buffer_stats_; DrawCommand draw_command_;