mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Add support for changing the refresh rate in SDL builds. Should also fix non-SDL builds.
git-svn-id: https://svn.eduke32.com/eduke32@5621 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
463b90bcd3
commit
66e6bbff0d
7 changed files with 34 additions and 6 deletions
|
@ -9,6 +9,8 @@
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "baselayer.h"
|
#include "baselayer.h"
|
||||||
|
|
||||||
|
extern int32_t maxrefreshfreq;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HWND win_gethwnd(void);
|
HWND win_gethwnd(void);
|
||||||
HINSTANCE win_gethinstance(void);
|
HINSTANCE win_gethinstance(void);
|
||||||
|
|
|
@ -12,6 +12,7 @@ extern uint32_t maxrefreshfreq;
|
||||||
extern int32_t glusecds;
|
extern int32_t glusecds;
|
||||||
|
|
||||||
extern char di_disabled;
|
extern char di_disabled;
|
||||||
|
extern char forcegl;
|
||||||
|
|
||||||
HWND win_gethwnd(void);
|
HWND win_gethwnd(void);
|
||||||
HINSTANCE win_gethinstance(void);
|
HINSTANCE win_gethinstance(void);
|
||||||
|
|
|
@ -101,6 +101,7 @@ extern int32_t curbrightness, gammabrightness;
|
||||||
char nogl=0;
|
char nogl=0;
|
||||||
static int32_t vsync_render=0;
|
static int32_t vsync_render=0;
|
||||||
#endif
|
#endif
|
||||||
|
int32_t maxrefreshfreq=0;
|
||||||
|
|
||||||
// last gamma, contrast, brightness
|
// last gamma, contrast, brightness
|
||||||
static float lastvidgcb[3];
|
static float lastvidgcb[3];
|
||||||
|
@ -1113,7 +1114,8 @@ void getvalidmodes(void)
|
||||||
for (i = 0; i < SDL_GetNumDisplayModes(0); i++)
|
for (i = 0; i < SDL_GetNumDisplayModes(0); i++)
|
||||||
{
|
{
|
||||||
SDL_GetDisplayMode(0, i, &dispmode);
|
SDL_GetDisplayMode(0, i, &dispmode);
|
||||||
if ((dispmode.w > MAXXDIM) || (dispmode.h > MAXYDIM))
|
if ((dispmode.w > MAXXDIM) || (dispmode.h > MAXYDIM) ||
|
||||||
|
(maxrefreshfreq && (dispmode.refresh_rate > maxrefreshfreq)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// HACK: 8-bit == Software, 32-bit == OpenGL
|
// HACK: 8-bit == Software, 32-bit == OpenGL
|
||||||
|
@ -1436,6 +1438,23 @@ void setvideomode_sdlcommonpost(int32_t x, int32_t y, int32_t c, int32_t fs, int
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION!=1
|
#if SDL_MAJOR_VERSION!=1
|
||||||
|
void setrefreshrate(void)
|
||||||
|
{
|
||||||
|
SDL_DisplayMode dispmode;
|
||||||
|
SDL_GetCurrentDisplayMode(0, &dispmode);
|
||||||
|
|
||||||
|
dispmode.refresh_rate = maxrefreshfreq;
|
||||||
|
|
||||||
|
SDL_DisplayMode newmode;
|
||||||
|
SDL_GetClosestDisplayMode(0, &dispmode, &newmode);
|
||||||
|
|
||||||
|
if (dispmode.refresh_rate != newmode.refresh_rate)
|
||||||
|
{
|
||||||
|
initprintf("Refresh rate: %dHz\n", newmode.refresh_rate);
|
||||||
|
SDL_SetWindowDisplayMode(sdl_window, &newmode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
||||||
{
|
{
|
||||||
int32_t regrab = 0, ret;
|
int32_t regrab = 0, ret;
|
||||||
|
@ -1505,6 +1524,8 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
||||||
|
|
||||||
SDL_GL_SetSwapInterval(vsync_render);
|
SDL_GL_SetSwapInterval(vsync_render);
|
||||||
|
|
||||||
|
setrefreshrate();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
loadglextensions();
|
loadglextensions();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1520,6 +1541,8 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
||||||
if (!sdl_window)
|
if (!sdl_window)
|
||||||
SDL2_VIDEO_ERR("SDL_CreateWindow");
|
SDL2_VIDEO_ERR("SDL_CreateWindow");
|
||||||
|
|
||||||
|
setrefreshrate();
|
||||||
|
|
||||||
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
||||||
if (!sdl_renderer)
|
if (!sdl_renderer)
|
||||||
SDL2_VIDEO_FALLBACK("SDL_CreateRenderer")
|
SDL2_VIDEO_FALLBACK("SDL_CreateRenderer")
|
||||||
|
|
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "demo.h"
|
#include "demo.h"
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
|
#include "renderlayer.h"
|
||||||
|
|
||||||
#ifdef LUNATIC
|
#ifdef LUNATIC
|
||||||
char const * const * g_argv;
|
char const * const * g_argv;
|
||||||
|
|
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "scriplib.h"
|
#include "scriplib.h"
|
||||||
#include "osdcmds.h"
|
#include "osdcmds.h"
|
||||||
|
#include "renderlayer.h"
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#include "android.h"
|
#include "android.h"
|
||||||
|
@ -607,9 +608,7 @@ int32_t CONFIG_ReadSetup(void)
|
||||||
windowy = -1;
|
windowy = -1;
|
||||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
|
||||||
|
|
||||||
#ifdef RENDERTYPEWIN
|
|
||||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
|
||||||
#endif
|
|
||||||
|
|
||||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
|
||||||
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32;
|
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32;
|
||||||
|
@ -734,9 +733,7 @@ void CONFIG_WriteSetup(uint32_t flags)
|
||||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
|
||||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
|
||||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
|
||||||
#ifdef RENDERTYPEWIN
|
|
||||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE);
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!NAM_WW2GI)
|
if (!NAM_WW2GI)
|
||||||
{
|
{
|
||||||
|
|
|
@ -604,6 +604,10 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
printext256(20, y+=9, COLOR_WHITE, -1, tempbuf, 0); \
|
printext256(20, y+=9, COLOR_WHITE, -1, tempbuf, 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#ifdef DEBUGGINGAIDS
|
||||||
|
sprstat_t g_spriteStat;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void G_PrintCoords(int32_t snum)
|
static void G_PrintCoords(int32_t snum)
|
||||||
{
|
{
|
||||||
const int32_t x = 250;
|
const int32_t x = 250;
|
||||||
|
|
|
@ -37,7 +37,7 @@ typedef struct {
|
||||||
int32_t numonscreen;
|
int32_t numonscreen;
|
||||||
} sprstat_t;
|
} sprstat_t;
|
||||||
|
|
||||||
sprstat_t g_spriteStat;
|
extern sprstat_t g_spriteStat;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int32_t dr_yxaspect, dr_viewingrange;
|
extern int32_t dr_yxaspect, dr_viewingrange;
|
||||||
|
|
Loading…
Reference in a new issue