mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-24 06:34:02 +00:00
Merge pull request #43 from digarok/sdl2_performance_improvement
add vsync flag for great success
This commit is contained in:
commit
632d824a8c
@ -54,6 +54,8 @@ extern int g_fullscreen;
|
||||
extern int g_highdpi;
|
||||
extern int g_borderless;
|
||||
extern int g_resizeable;
|
||||
extern int g_novsync;
|
||||
extern int g_nohwaccel;
|
||||
extern int g_screen_redraw_skip_amt;
|
||||
extern int g_use_dhr140;
|
||||
extern int g_use_bw_hires;
|
||||
@ -206,6 +208,8 @@ Cfg_menu g_cfg_uiless_menu[] = {
|
||||
{ "", KNMP(g_highdpi), CFGTYPE_INT },
|
||||
{ "", KNMP(g_borderless), CFGTYPE_INT },
|
||||
{ "", KNMP(g_resizeable), CFGTYPE_INT },
|
||||
{ "", KNMP(g_novsync), CFGTYPE_INT },
|
||||
{ "", KNMP(g_nohwaccel), CFGTYPE_INT },
|
||||
{ "", KNMP(g_screen_redraw_skip_amt), CFGTYPE_INT },
|
||||
{ "", KNMP(g_use_dhr140), CFGTYPE_INT },
|
||||
{ "", KNMP(g_use_bw_hires), CFGTYPE_INT },
|
||||
|
@ -39,6 +39,10 @@ extern int g_highdpi; // defined in video.c
|
||||
extern int g_borderless; // defined in video.c
|
||||
// Allow window resizing, dragging to scale - SDL2
|
||||
extern int g_resizeable; // defined in video.c
|
||||
// Don't explicitly set vsync present flag on renderer - SDL2
|
||||
extern int g_novsync; // defined in video.c
|
||||
// Don't explicitly set HW accelerator flag on renderer - SDL2
|
||||
extern int g_nohwaccel; // defined in video.c
|
||||
// Enable Dagen's scanline simulator (SDL2)
|
||||
extern int g_scanline_simulator; // defined in sim65816.c
|
||||
// Ethernet (interface?)
|
||||
@ -133,6 +137,12 @@ int parse_cli_options(int argc, char **argv) {
|
||||
} else if(!strcmp("-resizeable", argv[i])) {
|
||||
glogf("%s Window will be resizeable", parse_log_prefix);
|
||||
g_resizeable = 1;
|
||||
} else if(!strcmp("-novsync", argv[i])) {
|
||||
glogf("%s Renderer skipping vsync flag", parse_log_prefix);
|
||||
g_novsync = 1;
|
||||
} else if(!strcmp("-nohwaccel", argv[i])) {
|
||||
glogf("%s Renderer skipping HW accel flag", parse_log_prefix);
|
||||
g_nohwaccel = 1;
|
||||
} else if(!strcmp("-noignbadacc", argv[i])) {
|
||||
glogf("%s Not ignoring bad memory accesses", parse_log_prefix);
|
||||
g_ignore_bad_acc = 0;
|
||||
|
@ -40,7 +40,7 @@ int g_win_status_debug_request = 0; // Desired visibility of status lines.
|
||||
int g_screen_mdepth = 0;
|
||||
int kb_shift_control_state = 0;
|
||||
|
||||
|
||||
void debuginfo_renderer(SDL_Renderer *r);
|
||||
void x_take_screenshot(); // screenshot stuff
|
||||
int g_screenshot_requested = 0; // DB to know if we want to save a screenshot
|
||||
extern char g_config_gsplus_name[];
|
||||
@ -52,6 +52,8 @@ extern int g_fullscreen; // only checked at start if set via CLI, otherwise it'
|
||||
extern int g_highdpi;
|
||||
extern int g_borderless;
|
||||
extern int g_resizeable;
|
||||
extern int g_novsync;
|
||||
extern int g_nohwaccel;
|
||||
extern int g_scanline_simulator;
|
||||
extern int g_startx;
|
||||
extern int g_starty;
|
||||
@ -333,7 +335,15 @@ void dev_video_init_sdl() {
|
||||
// SET WINDOW ICON
|
||||
do_icon();
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
int renderer_hints = 0;
|
||||
if (!g_novsync) {
|
||||
renderer_hints |= SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
if (!g_nohwaccel) {
|
||||
renderer_hints |= SDL_RENDERER_ACCELERATED;
|
||||
}
|
||||
renderer = SDL_CreateRenderer(window, -1, renderer_hints);
|
||||
debuginfo_renderer(renderer);
|
||||
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother.
|
||||
// SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best"); // make the scaled rendering look smoother.
|
||||
@ -763,6 +773,29 @@ int x_show_alert(int is_fatal, const char *str) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This will help us determine how well and which drivers are supported on
|
||||
// different SDL platforms
|
||||
void debuginfo_renderer(SDL_Renderer *r) {
|
||||
int n = SDL_GetNumRenderDrivers();
|
||||
glogf("**--- SDL DEBUG ------ (%i) drivers", n);
|
||||
for(int i = 0; i < n; i++) {
|
||||
SDL_RendererInfo info;
|
||||
SDL_GetRenderDriverInfo(i, &info);
|
||||
glogf("* '%s'", info.name);
|
||||
}
|
||||
|
||||
|
||||
SDL_RendererInfo info = {0};
|
||||
if (SDL_GetRendererInfo(r,&info) == 0) {
|
||||
glogf("* SDL_RENDERER_SOFTWARE: %d", (info.flags & SDL_RENDERER_SOFTWARE) > 0 );
|
||||
glogf("* SDL_RENDERER_ACCELERATED: %d", (info.flags & SDL_RENDERER_ACCELERATED) > 0 );
|
||||
glogf("* SDL_RENDERER_PRESENTVSYNC: %d", (info.flags & SDL_RENDERER_PRESENTVSYNC) > 0 );
|
||||
glogf("* SDL_RENDERER_TARGETTEXTURE: %d", (info.flags & SDL_RENDERER_TARGETTEXTURE) > 0 );
|
||||
glogf("* active renderer -> '%s'", info.name);
|
||||
} else {
|
||||
glog("NO Renderinfo");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// BELOW ARE FUNCTIONS THAT ARE EITHER UNIMPLEMENTED, OR AR NOT RELEVANT TO
|
||||
|
@ -94,6 +94,8 @@ int g_starty = WINDOWPOS_UNDEFINED;
|
||||
int g_highdpi = 0;
|
||||
int g_borderless = 0;
|
||||
int g_resizeable = 0;
|
||||
int g_novsync = 0;
|
||||
int g_nohwaccel = 0;
|
||||
|
||||
int g_a2_new_all_stat[200];
|
||||
int g_a2_cur_all_stat[200];
|
||||
|
Loading…
Reference in New Issue
Block a user