From dbea29e02c0c4daa614dd1d7f2d60efcae0b9e16 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 16 Mar 2017 17:58:41 +0100 Subject: [PATCH] - added missing memory barrier --- src/swrenderer/r_swcolormaps.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/swrenderer/r_swcolormaps.cpp b/src/swrenderer/r_swcolormaps.cpp index 306caf647..318ccead2 100644 --- a/src/swrenderer/r_swcolormaps.cpp +++ b/src/swrenderer/r_swcolormaps.cpp @@ -55,6 +55,7 @@ #include "templates.h" #include "r_utility.h" #include "r_renderer.h" +#include FDynamicColormap NormalLight; FDynamicColormap FullNormalLight; //[SP] Emulate GZDoom brightness @@ -95,10 +96,13 @@ static FDynamicColormap *CreateSpecialLights (PalEntry color, PalEntry fade, int colormap->Color = color; colormap->Fade = fade; colormap->Desaturate = desaturate; - NormalLight.Next = colormap; - colormap->Maps = new uint8_t[NUMCOLORMAPS*256]; colormap->BuildLights (); + + // Make sure colormap is fully built before making it publicly visible + std::atomic_thread_fence(std::memory_order_release); + NormalLight.Next = colormap; + return colormap; }