From 42efc7334e5e5dc0419b020b4db36777bc647be4 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 12 Jun 2016 00:50:43 +0200 Subject: [PATCH] Fix missing particles in true color mode --- src/r_draw.h | 7 +++++-- src/r_draw_rgba.cpp | 5 +++++ src/r_things.cpp | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/r_draw.h b/src/r_draw.h index d192dc5e4..55ad8a0ca 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -570,12 +570,15 @@ public: } } - // Redirects all drawing commands to worker threads until Finish is called + // Redirects all drawing commands to worker threads until End is called // Begin/End blocks can be nested. static void Begin(); - // Wait until all worker threads finished executing commands + // End redirection and wait until all worker threads finished executing static void End(); + + // Waits until all worker threads finished executing + static void WaitForWorkers(); }; #endif diff --git a/src/r_draw_rgba.cpp b/src/r_draw_rgba.cpp index 979dc0743..af8487964 100644 --- a/src/r_draw_rgba.cpp +++ b/src/r_draw_rgba.cpp @@ -97,6 +97,11 @@ void DrawerCommandQueue::End() queue->threaded_render--; } +void DrawerCommandQueue::WaitForWorkers() +{ + Instance()->Finish(); +} + void DrawerCommandQueue::Finish() { auto queue = Instance(); diff --git a/src/r_things.cpp b/src/r_things.cpp index 933d50e46..0c5e17b7c 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -2686,6 +2686,8 @@ void R_DrawParticle_RGBA(vissprite_t *vis) int countbase = vis->x2 - x1; R_DrawMaskedSegsBehindParticle(vis); + + DrawerCommandQueue::WaitForWorkers(); uint32_t fg = shade_pal_index_simple(color, calc_light_multiplier(LIGHTSCALE(0, vis->Style.ColormapNum << FRACBITS))); uint32_t fg_red = (fg >> 16) & 0xff;