mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-26 10:49:21 +00:00
added pref, "sdlrender", which can force a specific, SDL2 renderer (software can be faster in some cases, such as on VirtualBox hosts)
This commit is contained in:
parent
cbda5759bb
commit
1eb824a04e
@ -31,6 +31,7 @@
|
||||
// Platform-specific preferences items
|
||||
prefs_desc platform_prefs_items[] = {
|
||||
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
|
||||
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
|
||||
{NULL, TYPE_END, false} // End of list
|
||||
};
|
||||
|
||||
|
@ -754,12 +754,26 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags
|
||||
}
|
||||
|
||||
if (!sdl_renderer) {
|
||||
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, SDL_RENDERER_ACCELERATED);
|
||||
const char *render_driver = PrefsFindString("sdlrender");
|
||||
if (render_driver) {
|
||||
if (SDL_strcmp(render_driver, "auto") == 0) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "");
|
||||
} else {
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, render_driver);
|
||||
}
|
||||
}
|
||||
|
||||
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
||||
if (!sdl_renderer) {
|
||||
shutdown_sdl_video();
|
||||
return NULL;
|
||||
}
|
||||
sdl_renderer_thread_id = SDL_ThreadID();
|
||||
|
||||
SDL_RendererInfo info;
|
||||
memset(&info, 0, sizeof(info));
|
||||
SDL_GetRendererInfo(sdl_renderer, &info);
|
||||
printf("Using SDL_Renderer driver: %s\n", (info.name ? info.name : "(null)"));
|
||||
}
|
||||
|
||||
SDL_assert(sdl_texture == NULL);
|
||||
|
@ -42,6 +42,9 @@ prefs_desc platform_prefs_items[] = {
|
||||
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
|
||||
#endif
|
||||
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
|
||||
#ifdef USE_SDL_VIDEO
|
||||
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
|
||||
#endif
|
||||
{NULL, TYPE_END, false, NULL} // End of list
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user