From c28a00f58a8452d8d8a64bdabf118686cc16bd86 Mon Sep 17 00:00:00 2001 From: aarojun Date: Thu, 27 May 2021 06:30:31 +0300 Subject: [PATCH] Add sdl_vsync option (vertical sync with SDL_Renderer) --- BasiliskII/src/SDL/video_sdl2.cpp | 7 +++++++ SheepShaver/src/Windows/prefs_windows.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/BasiliskII/src/SDL/video_sdl2.cpp b/BasiliskII/src/SDL/video_sdl2.cpp index 90bf8492..77f53fa9 100644 --- a/BasiliskII/src/SDL/video_sdl2.cpp +++ b/BasiliskII/src/SDL/video_sdl2.cpp @@ -793,8 +793,15 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags #else SDL_SetHint(SDL_HINT_RENDER_DRIVER, ""); #endif + } + + bool sdl_vsync = PrefsFindBool("sdl_vsync"); + if (sdl_vsync) { + SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1"); } + sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0); + if (!sdl_renderer) { shutdown_sdl_video(); return NULL; diff --git a/SheepShaver/src/Windows/prefs_windows.cpp b/SheepShaver/src/Windows/prefs_windows.cpp index 0e9379e8..da7cc3be 100755 --- a/SheepShaver/src/Windows/prefs_windows.cpp +++ b/SheepShaver/src/Windows/prefs_windows.cpp @@ -56,6 +56,7 @@ prefs_desc platform_prefs_items[] = { {"portfile1", TYPE_STRING, false, "output file for serial port 1"}, #ifdef USE_SDL_VIDEO {"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"}, + {"sdl_vsync", TYPE_BOOLEAN, false, "Make SDL_Renderer vertical sync frames to host (eg. with software renderer)"}, #endif {NULL, TYPE_END, false, NULL} // End of list