mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-25 22:05:20 -04:00
DRS updates
* Introduce drs_skip_frame flag, skip DRS after resolution switch, wipe, save game, window event. * Move V_InitFlexTranTable to R_Init (don't want to skip DRS for it). * Disable DRS when menu is active. * Tweak DRS parameters.
This commit is contained in:
parent
3afbc9141d
commit
e6c8b4d56e
@ -575,14 +575,6 @@ static void AM_clearLastMark(void)
|
|||||||
|
|
||||||
void AM_enableSmoothLines(void)
|
void AM_enableSmoothLines(void)
|
||||||
{
|
{
|
||||||
static boolean precalc_once = true;
|
|
||||||
|
|
||||||
if (precalc_once && map_smooth_lines)
|
|
||||||
{
|
|
||||||
V_InitFlexTranTable();
|
|
||||||
precalc_once = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
AM_drawFline = map_smooth_lines ? AM_drawFline_Smooth : AM_drawFline_Vanilla;
|
AM_drawFline = map_smooth_lines ? AM_drawFline_Smooth : AM_drawFline_Vanilla;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ void D_Display (void)
|
|||||||
}
|
}
|
||||||
while (!done);
|
while (!done);
|
||||||
|
|
||||||
I_ResetTargetRefresh(); // reset after wipe
|
drs_skip_frame = true; // skip DRS after wipe
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "m_snapshot.h"
|
#include "m_snapshot.h"
|
||||||
#include "m_swap.h" // [FG] LONG
|
#include "m_swap.h" // [FG] LONG
|
||||||
#include "i_input.h"
|
#include "i_input.h"
|
||||||
|
#include "i_video.h"
|
||||||
#include "m_array.h"
|
#include "m_array.h"
|
||||||
|
|
||||||
#define SAVEGAMESIZE 0x20000
|
#define SAVEGAMESIZE 0x20000
|
||||||
@ -2155,6 +2156,8 @@ static void G_DoSaveGame(void)
|
|||||||
if (name) free(name);
|
if (name) free(name);
|
||||||
|
|
||||||
M_SetQuickSaveSlot(savegameslot);
|
M_SetQuickSaveSlot(savegameslot);
|
||||||
|
|
||||||
|
drs_skip_frame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void G_DoLoadGame(void)
|
static void G_DoLoadGame(void)
|
||||||
|
@ -108,6 +108,8 @@ boolean screenvisible = true;
|
|||||||
|
|
||||||
boolean window_focused = true;
|
boolean window_focused = true;
|
||||||
|
|
||||||
|
boolean drs_skip_frame;
|
||||||
|
|
||||||
void *I_GetSDLWindow(void)
|
void *I_GetSDLWindow(void)
|
||||||
{
|
{
|
||||||
return screen;
|
return screen;
|
||||||
@ -249,6 +251,8 @@ static void HandleWindowEvent(SDL_WindowEvent *event)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drs_skip_frame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [FG] fullscreen toggle from Chocolate Doom 3.0
|
// [FG] fullscreen toggle from Chocolate Doom 3.0
|
||||||
@ -471,7 +475,7 @@ static void UpdateRender(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t frametime_withoutpresent;
|
static uint64_t frametime_start, frametime_withoutpresent;
|
||||||
static int targetrefresh;
|
static int targetrefresh;
|
||||||
|
|
||||||
static void ResetResolution(int height);
|
static void ResetResolution(int height);
|
||||||
@ -482,13 +486,18 @@ void I_DynamicResolution(void)
|
|||||||
static int frame_counter;
|
static int frame_counter;
|
||||||
static double averagepercent;
|
static double averagepercent;
|
||||||
|
|
||||||
if (resolution_mode != RES_DRS || frametime_withoutpresent == 0 ||
|
if (resolution_mode != RES_DRS || frametime_withoutpresent == 0 || menuactive)
|
||||||
// Skip if frame time is too long (e.g. window event).
|
|
||||||
frametime_withoutpresent > 100000)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (drs_skip_frame)
|
||||||
|
{
|
||||||
|
frametime_start = frametime_withoutpresent = 0;
|
||||||
|
drs_skip_frame = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 1.25 milliseconds for SDL render present
|
// 1.25 milliseconds for SDL render present
|
||||||
double target = (1.0 / targetrefresh) - 0.00125;
|
double target = (1.0 / targetrefresh) - 0.00125;
|
||||||
double actual = frametime_withoutpresent / 1000000.0;
|
double actual = frametime_withoutpresent / 1000000.0;
|
||||||
@ -498,9 +507,8 @@ void I_DynamicResolution(void)
|
|||||||
#define DRS_MIN_HEIGHT 400
|
#define DRS_MIN_HEIGHT 400
|
||||||
#define DRS_DELTA 0.1
|
#define DRS_DELTA 0.1
|
||||||
#define DRS_GREATER (1 + DRS_DELTA)
|
#define DRS_GREATER (1 + DRS_DELTA)
|
||||||
#define DRS_LESS (1 - DRS_DELTA)
|
#define DRS_LESS (1 - DRS_DELTA / 10.0)
|
||||||
// 50px step to make scaling artefacts less noticeable.
|
#define DRS_STEP (SCREENHEIGHT / 2)
|
||||||
#define DRS_STEP (SCREENHEIGHT / 4)
|
|
||||||
|
|
||||||
int newheight = 0;
|
int newheight = 0;
|
||||||
int oldheight = video.height;
|
int oldheight = video.height;
|
||||||
@ -513,7 +521,7 @@ void I_DynamicResolution(void)
|
|||||||
|
|
||||||
if (actualpercent > DRS_GREATER)
|
if (actualpercent > DRS_GREATER)
|
||||||
{
|
{
|
||||||
double reduction = (actualpercent - DRS_GREATER ) * 0.2;
|
double reduction = (actualpercent - DRS_GREATER ) * 0.4;
|
||||||
newheight = (int)MAX(DRS_MIN_HEIGHT, oldheight - oldheight * reduction);
|
newheight = (int)MAX(DRS_MIN_HEIGHT, oldheight - oldheight * reduction);
|
||||||
}
|
}
|
||||||
else if (averagepercent < DRS_LESS && frame_counter > targetrefresh)
|
else if (averagepercent < DRS_LESS && frame_counter > targetrefresh)
|
||||||
@ -553,8 +561,6 @@ static void CreateUpscaledTexture(boolean force);
|
|||||||
|
|
||||||
void I_FinishUpdate(void)
|
void I_FinishUpdate(void)
|
||||||
{
|
{
|
||||||
static uint64_t frametime_start;
|
|
||||||
|
|
||||||
if (noblit)
|
if (noblit)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1090,6 +1096,8 @@ static void ResetResolution(int height)
|
|||||||
I_InitDiskFlash();
|
I_InitDiskFlash();
|
||||||
|
|
||||||
I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height);
|
I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height);
|
||||||
|
|
||||||
|
drs_skip_frame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateUpscaledTexture(boolean force)
|
static void CreateUpscaledTexture(boolean force)
|
||||||
@ -1206,8 +1214,6 @@ static void ResetLogicalSize(void)
|
|||||||
|
|
||||||
void I_ResetTargetRefresh(void)
|
void I_ResetTargetRefresh(void)
|
||||||
{
|
{
|
||||||
frametime_withoutpresent = 0; // skip DRS one frame
|
|
||||||
|
|
||||||
if (uncapped)
|
if (uncapped)
|
||||||
{
|
{
|
||||||
targetrefresh = (fpslimit >= TICRATE) ? fpslimit : native_refresh_rate;
|
targetrefresh = (fpslimit >= TICRATE) ? fpslimit : native_refresh_rate;
|
||||||
|
@ -69,6 +69,8 @@ void I_ToggleVsync(void); // [JN] Calls native SDL vsync toggle
|
|||||||
|
|
||||||
void I_DynamicResolution(void);
|
void I_DynamicResolution(void);
|
||||||
|
|
||||||
|
extern boolean drs_skip_frame;
|
||||||
|
|
||||||
extern char *sdl_renderdriver;
|
extern char *sdl_renderdriver;
|
||||||
|
|
||||||
extern boolean use_vsync; // killough 2/8/98: controls whether vsync is called
|
extern boolean use_vsync; // killough 2/8/98: controls whether vsync is called
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "r_voxel.h"
|
#include "r_voxel.h"
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "am_map.h"
|
#include "v_flextran.h"
|
||||||
#include "st_stuff.h"
|
#include "st_stuff.h"
|
||||||
|
|
||||||
// killough: viewangleoffset is a legacy from the pre-v1.2 days, when Doom
|
// killough: viewangleoffset is a legacy from the pre-v1.2 days, when Doom
|
||||||
@ -557,6 +557,7 @@ void R_Init (void)
|
|||||||
R_InitLightTables();
|
R_InitLightTables();
|
||||||
R_InitSkyMap();
|
R_InitSkyMap();
|
||||||
R_InitTranslationTables();
|
R_InitTranslationTables();
|
||||||
|
V_InitFlexTranTable();
|
||||||
|
|
||||||
// [FG] spectre drawing mode
|
// [FG] spectre drawing mode
|
||||||
R_SetFuzzColumnMode();
|
R_SetFuzzColumnMode();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user