From 3c64a242bb4ec6b9802d35430ed9066ec1a6cdb0 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 4 Nov 2019 02:56:30 +1000 Subject: [PATCH] GPU: Fix incorrect parsing of polyline commands --- src/core/gpu_commands.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/gpu_commands.cpp b/src/core/gpu_commands.cpp index bdd77bd6a..53d70cc03 100644 --- a/src/core/gpu_commands.cpp +++ b/src/core/gpu_commands.cpp @@ -192,7 +192,7 @@ bool GPU::HandleRenderCommand(const u32*& command_ptr, u32 command_size) // polyline goes until we hit the termination code num_vertices = 0; bool found_terminator = false; - for (u32 pos = 1 + BoolToUInt32(!rc.shading_enable); pos < command_size; pos += words_per_vertex) + for (u32 pos = 1 + BoolToUInt32(rc.shading_enable); pos < command_size; pos += words_per_vertex) { if (command_ptr[pos] == 0x55555555) { @@ -204,13 +204,14 @@ bool GPU::HandleRenderCommand(const u32*& command_ptr, u32 command_size) } if (!found_terminator) return false; + + total_words = words_per_vertex * num_vertices + BoolToUInt32(!rc.shading_enable) + 1; } else { num_vertices = 2; + total_words = words_per_vertex * num_vertices + BoolToUInt32(!rc.shading_enable); } - - total_words = words_per_vertex * num_vertices + BoolToUInt8(!rc.shading_enable); } break;