From bb15d2f62ff6d5a9468f1a85d9640d9758263e94 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Fri, 2 Jan 2015 17:44:15 -0800 Subject: [PATCH] Faster profiler drawing. --- src/xenia/gpu/gl4/gl4_profiler_display.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/xenia/gpu/gl4/gl4_profiler_display.cc b/src/xenia/gpu/gl4/gl4_profiler_display.cc index 21929ab48..37d4b1f67 100644 --- a/src/xenia/gpu/gl4/gl4_profiler_display.cc +++ b/src/xenia/gpu/gl4/gl4_profiler_display.cc @@ -389,7 +389,7 @@ GL4ProfilerDisplay::Vertex* GL4ProfilerDisplay::BeginVertices(size_t count) { void GL4ProfilerDisplay::EndVertices(GLenum prim_type) { size_t vertex_count = current_allocation_.length / sizeof(Vertex); - if (false&&draw_command_count_ && + if (draw_command_count_ && draw_commands_[draw_command_count_ - 1].prim_type == prim_type) { // Coalesce. auto& prev_command = draw_commands_[draw_command_count_ - 1]; @@ -419,10 +419,10 @@ void GL4ProfilerDisplay::Flush() { void GL4ProfilerDisplay::DrawBox(int x0, int y0, int x1, int y1, uint32_t color, BoxType type) { + auto v = BeginVertices(6); if (type == BoxType::kFlat) { color = ((color & 0xff) << 16) | ((color >> 16) & 0xff) | (0xff00ff00 & color); - auto v = BeginVertices(6); Q0(v, x, (float)x0); Q0(v, y, (float)y0); Q0(v, color, color); @@ -443,7 +443,6 @@ void GL4ProfilerDisplay::DrawBox(int x0, int y0, int x1, int y1, uint32_t color, Q3(v, color, color); Q3(v, u, 2.0f); Q3(v, v, 2.0f); - EndVertices(GL_TRIANGLES); } else { uint32_t r = 0xff & (color >> 16); uint32_t g = 0xff & (color >> 8); @@ -460,7 +459,6 @@ void GL4ProfilerDisplay::DrawBox(int x0, int y0, int x1, int y1, uint32_t color, uint32_t b1 = 0xff & ((b + nMin) / 2); uint32_t color0 = (r0 << 0) | (g0 << 8) | (b0 << 16) | (0xff000000 & color); uint32_t color1 = (r1 << 0) | (g1 << 8) | (b1 << 16) | (0xff000000 & color); - auto v = BeginVertices(6); Q0(v, x, (float)x0); Q0(v, y, (float)y0); Q0(v, color, color0); @@ -481,8 +479,8 @@ void GL4ProfilerDisplay::DrawBox(int x0, int y0, int x1, int y1, uint32_t color, Q3(v, color, color1); Q3(v, u, 2.0f); Q3(v, v, 3.0f); - EndVertices(GL_TRIANGLES); } + EndVertices(GL_TRIANGLES); } void GL4ProfilerDisplay::DrawLine2D(uint32_t count, float* vertices, @@ -511,6 +509,10 @@ void GL4ProfilerDisplay::DrawLine2D(uint32_t count, float* vertices, void GL4ProfilerDisplay::DrawText(int x, int y, uint32_t color, const char* text, size_t text_length) { + if (!text_length) { + return; + } + const float fOffsetU = 5.0f / 1024.0f; float fX = (float)x; float fY = (float)y;