HACK: move semaphores into the drawplane loop, to fix a few visual glitches

a bit of slowdown, but i have no clue what exactly causes shit, so this is the best solution for now i guess
This commit is contained in:
Alug committed 2025-06-07 01:18:50 +02:00
1 parent fc0636aa5f
commit fc8216809a
2 files changed
+8 -15

No files matched your search

-14
View File
@@ -1006,7 +1006,6 @@ static void R_SetFov(fixed_t playerfov)
R_SetSkyScale();
}
//
// R_Init
//
@@ -1388,8 +1387,6 @@ void R_RenderPlayerView(player_t *player)
Portal_InitList();
srb2::ThreadPool::Sema tp_sema;
PS_START_TIMING(ps_skyboxtime);
if (skybox && skyVisible)
{
@@ -1402,7 +1399,6 @@ void R_RenderPlayerView(player_t *player)
#ifdef FLOORSPLATS
R_ClearVisibleFloorSplats();
#endif
srb2::g_main_threadpool->begin_sema();
R_RenderViewpoint(&masks[nummasks - 1], false);
R_ClipSprites();
@@ -1411,9 +1407,6 @@ void R_RenderPlayerView(player_t *player)
R_DrawVisibleFloorSplats();
#endif
// well sometimes synchronization is off and may result in some visual glitching, oh well
tp_sema = srb2::g_main_threadpool->end_sema();
srb2::g_main_threadpool->notify_sema(tp_sema);
srb2::g_main_threadpool->wait_sema(tp_sema);
R_DrawMasked(masks, nummasks);
}
PS_STOP_TIMING(ps_skyboxtime);
@@ -1450,10 +1443,6 @@ void R_RenderPlayerView(player_t *player)
ps_numbspcalls.value.i = ps_numpolyobjects.value.i = ps_numdrawnodes.value.i = 0;
PS_START_TIMING(ps_bsptime);
tp_sema = srb2::g_main_threadpool->end_sema();
srb2::g_main_threadpool->notify_sema(tp_sema);
srb2::g_main_threadpool->wait_sema(tp_sema);
srb2::g_main_threadpool->begin_sema();
R_RenderViewpoint(&masks[nummasks - 1], true);
PS_STOP_TIMING(ps_bsptime);
@@ -1505,9 +1494,6 @@ void R_RenderPlayerView(player_t *player)
PS_START_TIMING(ps_sw_planetime);
R_DrawPlanes();
tp_sema = srb2::g_main_threadpool->end_sema();
srb2::g_main_threadpool->notify_sema(tp_sema);
srb2::g_main_threadpool->wait_sema(tp_sema);
PS_STOP_TIMING(ps_sw_planetime);
#ifdef FLOORSPLATS
R_DrawVisibleFloorSplats();
+8 -1
View File
@@ -13,6 +13,8 @@
/// while maintaining a per column clipping list only.
/// Moreover, the sky areas have to be determined.
#include <algorithm>
#include "doomdef.h"
#include "console.h"
#include "g_game.h"
@@ -29,8 +31,8 @@
#include "p_tick.h"
#include "r_fps.h"
#include "r_portal.h"
#include "core/thread_pool.h"
#include <algorithm>
static void R_SetSlopePlaneVectors(drawspandata_t* ds, visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff, float fudge);
static void R_SetTiltedSpan(drawspandata_t* ds, INT32 span);
@@ -769,11 +771,13 @@ void R_DrawPlanes(void)
visplane_t *pl;
INT32 i;
drawspandata_t ds = {};
srb2::ThreadPool::Sema tp_sema;
R_UpdatePlaneRipple(&ds);
for (i = 0; i < MAXVISPLANES; i++, pl++)
{
srb2::g_main_threadpool->begin_sema();
for (pl = visplanes[i]; pl; pl = pl->next)
{
if (pl->ffloor != NULL || pl->polyobj != NULL)
@@ -781,6 +785,9 @@ void R_DrawPlanes(void)
R_DrawSinglePlane(&ds, pl, cv_parallelsoftware.value);
}
tp_sema = srb2::g_main_threadpool->end_sema();
srb2::g_main_threadpool->notify_sema(tp_sema);
srb2::g_main_threadpool->wait_sema(tp_sema);
}
}