From 5cb6490aaa41cb58f0cf5b93004a5732bc812327 Mon Sep 17 00:00:00 2001 From: Indev Date: Fri, 6 Jun 2025 01:42:15 +0300 Subject: [PATCH] Make tiltlighting buffer thread_local --- src/r_draw_span.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/r_draw_span.c b/src/r_draw_span.c index 50612dc22..655b19479 100644 --- a/src/r_draw_span.c +++ b/src/r_draw_span.c @@ -15,6 +15,8 @@ // SPANS // ========================================================================== +#include + #define SPANSIZE 16 #define INVSPAN 0.0625f @@ -371,8 +373,8 @@ void R_DrawTiltedSpan(drawspandata_t* ds) float endz, endu, endv; UINT32 stepu, stepv; register UINT32 bit; - static INT32 *tiltlighting = NULL; - static INT32 oldviewwidth = 0; + thread_local static INT32 *tiltlighting = NULL; + thread_local static INT32 oldviewwidth = 0; // dont realloc every frame pls thx if (tiltlighting == NULL || oldviewwidth != viewwidth) @@ -518,8 +520,8 @@ void R_DrawTiltedTranslucentSpan(drawspandata_t* ds) float endz, endu, endv; UINT32 stepu, stepv; register UINT32 bit; - static INT32 *tiltlighting = NULL; - static INT32 oldviewwidth = 0; + thread_local static INT32 *tiltlighting = NULL; + thread_local static INT32 oldviewwidth = 0; // dont realloc every frame pls thx if (tiltlighting == NULL || oldviewwidth != viewwidth) @@ -666,8 +668,8 @@ void R_DrawTiltedTranslucentWaterSpan(drawspandata_t* ds) float endz, endu, endv; UINT32 stepu, stepv; register UINT32 bit; - static INT32 *tiltlighting = NULL; - static INT32 oldviewwidth = 0; + thread_local static INT32 *tiltlighting = NULL; + thread_local static INT32 oldviewwidth = 0; // dont realloc every frame pls thx if (tiltlighting == NULL || oldviewwidth != viewwidth) @@ -814,8 +816,8 @@ void R_DrawTiltedSplat(drawspandata_t* ds) float endz, endu, endv; UINT32 stepu, stepv; register UINT32 bit; - static INT32 *tiltlighting = NULL; - static INT32 oldviewwidth = 0; + thread_local static INT32 *tiltlighting = NULL; + thread_local static INT32 oldviewwidth = 0; // dont realloc every frame pls thx if (tiltlighting == NULL || oldviewwidth != viewwidth)