From 591af1ab95604031413c9f00bba05b42269ec6ef Mon Sep 17 00:00:00 2001 From: Eidolon Date: Mon, 29 Jan 2024 19:21:43 -0600 Subject: [PATCH] Add parallelsoftware cvar In the rare case where kernel thread scheduling causes hitching issues (SteamOS?), there should be an option to dynamically toggle multithread dispatch of plane drawing. --- src/cvars.cpp | 1 + src/menus/options-video-1.c | 3 +++ src/r_plane.cpp | 2 +- src/screen.h | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cvars.cpp b/src/cvars.cpp index 4f4ab8e16..112263f81 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -423,6 +423,7 @@ consvar_t cv_pauseifunfocused = Player("pauseifunfocused", "Yes").yes_no(); extern CV_PossibleValue_t cv_renderer_t[]; consvar_t cv_renderer = Player("renderer", "Software").flags(CV_NOLUA).values(cv_renderer_t).onchange(SCR_ChangeRenderer); +consvar_t cv_parallelsoftware = Player("parallelsoftware", "On").on_off(); consvar_t cv_renderview = Player("renderview", "On").on_off().dont_save(); consvar_t cv_rollingdemos = Player("rollingdemos", "On").on_off(); diff --git a/src/menus/options-video-1.c b/src/menus/options-video-1.c index f02135b10..a1e1dcecc 100644 --- a/src/menus/options-video-1.c +++ b/src/menus/options-video-1.c @@ -59,6 +59,9 @@ menuitem_t OPTIONS_Video[] = {IT_STRING | IT_CVAR, "Enable Skyboxes", "Turning this off may improve performance, but reduces courses' background details.", NULL, {.cvar = &cv_skybox}, 0, 0}, + {IT_STRING | IT_CVAR, "Parallel Software", "Uses multiple CPU cores for the software renderer if available, for a FPS boost.", + NULL, {.cvar = &cv_parallelsoftware}, 0, 0}, + #ifdef HWRENDER {IT_NOTHING|IT_SPACE, NULL, NULL, NULL, {NULL}, 0, 0}, diff --git a/src/r_plane.cpp b/src/r_plane.cpp index fa4081632..5f43a5872 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -666,7 +666,7 @@ void R_DrawPlanes(void) if (pl->ffloor != NULL || pl->polyobj != NULL) continue; - R_DrawSinglePlane(&ds, pl, true); + R_DrawSinglePlane(&ds, pl, cv_parallelsoftware.value); } } } diff --git a/src/screen.h b/src/screen.h index c8a2e1062..cbfe01724 100644 --- a/src/screen.h +++ b/src/screen.h @@ -136,6 +136,7 @@ extern UINT8 *scr_borderpatch; // patch used to fill the view borders extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_renderhitbox, cv_fullscreen; extern consvar_t cv_vhseffect, cv_shittyscreen; +extern consvar_t cv_parallelsoftware; // wait for page flipping to end or not extern consvar_t cv_vidwait;