Merge branch 'backup-gr_screentextures' of https://git.do.srb2.org/Lonsfor_/Kart-Public into Galaxy

This commit is contained in:
Galactice committed 2022-11-08 11:07:20 -05:00
1 parent 7190f1ccf5
commit a6357faaf0
3 files changed
+35

No files matched your search

+2
View File
@@ -249,6 +249,8 @@ enum hwdsetspecialstate
HWD_SET_TEXTUREFILTERMODE,
HWD_SET_TEXTUREANISOTROPICMODE,
HWD_SET_SCREEN_TEXTURES,
HWD_NUMSTATE
};
typedef enum hwdsetspecialstate hwdspecialstate_t;
+19
View File
@@ -59,6 +59,7 @@ struct hwdriver_s hwdriver;
static void CV_filtermode_ONChange(void);
static void CV_anisotropic_ONChange(void);
static void CV_screentextures_ONChange(void);
static CV_PossibleValue_t grfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"},
{HWD_SET_TEXTUREFILTER_BILINEAR, "Bilinear"}, {HWD_SET_TEXTUREFILTER_TRILINEAR, "Trilinear"},
@@ -93,6 +94,15 @@ static INT32 bsp_culling_distances[] = {(1024+512)*FRACUNIT, (2048+512)*FRACUNIT
(6144+512)*FRACUNIT, (8192+512)*FRACUNIT, (12288+512)*FRACUNIT, (16384+512)*FRACUNIT};
static INT32 current_bsp_culling_distance = 0;
// The current screen texture implementation is inefficient and disabling it can result in significant
// performance gains on lower end hardware. The game is still quite playable without this functionality.
// Features that break when disabling this:
// - water and heat wave effects
// - intermission background
// - full screen scaling (use native resolution or windowed mode to avoid this)
consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff,
CV_screentextures_ONChange, 0, NULL, NULL, 0, 0, NULL};
static void CV_filtermode_ONChange(void)
{
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value);
@@ -103,6 +113,11 @@ static void CV_anisotropic_ONChange(void)
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value);
}
static void CV_screentextures_ONChange(void)
{
HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_grscreentextures.value);
}
// ==========================================================================
// Globals
// ==========================================================================
@@ -4949,6 +4964,7 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_grsolvetjoin);
CV_RegisterVar(&cv_grbatching);
CV_RegisterVar(&cv_grscreentextures);
CV_RegisterVar(&cv_grrenderdistance);
}
@@ -5092,6 +5108,9 @@ void HWR_DoPostProcessor(player_t *player)
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
}
if (!cv_grscreentextures.value) // screen textures are needed for the rest of the effects
return;
// Capture the screen for intermission and screen waving
if(gamestate != GS_INTERMISSION)
HWD.pfnMakeScreenTexture();
+14
View File
@@ -545,6 +545,8 @@ static boolean gl_shaderprogramchanged = true;
static boolean gl_batching = false;// are we currently collecting batches?
static INT32 gl_enable_screen_textures = 1;
// 13062019
typedef enum
{
@@ -2665,6 +2667,10 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
Flush(); //??? if we want to change filter mode by texture, remove this
break;
case HWD_SET_SCREEN_TEXTURES:
gl_enable_screen_textures = Value;
break;
default:
break;
}
@@ -3168,6 +3174,8 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
16.0f, -16.0f, 6.0f
};
if (!gl_enable_screen_textures) return;
// look for power of two that is large enough for the screen
while (texsize < screen_width || texsize < screen_height)
texsize <<= 1;
@@ -3441,6 +3449,8 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
INT32 texsize = 512;
boolean firstTime = (screentexture == 0);
if (!gl_enable_screen_textures) return;
// look for power of two that is large enough for the screen
while (texsize < screen_width || texsize < screen_height)
texsize <<= 1;
@@ -3469,6 +3479,8 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
INT32 texsize = 512;
boolean firstTime = (finalScreenTexture == 0);
if (!gl_enable_screen_textures) return;
// look for power of two that is large enough for the screen
while (texsize < screen_width || texsize < screen_height)
texsize <<= 1;
@@ -3503,6 +3515,8 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
float off[12];
float fix[8];
if (!gl_enable_screen_textures) return;
// look for power of two that is large enough for the screen
while (texsize < screen_width || texsize < screen_height)
texsize <<= 1;