From 84854b2ad8ee6142ca6e18eabb5805d52968e085 Mon Sep 17 00:00:00 2001 From: PS Date: Sat, 30 Jan 2021 14:09:19 -0800 Subject: [PATCH] Fixed issue with the ring buffer's write incrementation. --- src/app/blumen_lumen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/blumen_lumen.cpp b/src/app/blumen_lumen.cpp index 667b997..caf3147 100644 --- a/src/app/blumen_lumen.cpp +++ b/src/app/blumen_lumen.cpp @@ -151,10 +151,6 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context) (BLState->OutgoingMsgQueue.WriteHead < BLState->OutgoingMsgQueue.ReadHead)) { u32 WriteIndex = BLState->OutgoingMsgQueue.WriteHead; - if (BLState->OutgoingMsgQueue.WriteHead >= BLUMEN_MESSAGE_QUEUE_COUNT) - { - BLState->OutgoingMsgQueue.WriteHead = 0; - } gs_data* Msg = BLState->OutgoingMsgQueue.Buffers + WriteIndex; if (Msg->Size == 0) @@ -174,6 +170,10 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context) // 3. Network Thread sends the message at 0 // 4. Main Thread sets the message at 0 BLState->OutgoingMsgQueue.WriteHead += 1; + if (BLState->OutgoingMsgQueue.WriteHead >= BLUMEN_MESSAGE_QUEUE_COUNT) + { + BLState->OutgoingMsgQueue.WriteHead = 0; + } } }