move more code over to gfx/video_driver.c
This commit is contained in:
parent
4574a58683
commit
05e4aa8bfb
|
@ -1531,12 +1531,12 @@ error:
|
||||||
d3d11_gfx_free(d3d11);
|
d3d11_gfx_free(d3d11);
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
retroarch_force_video_driver_fallback("gl");
|
video_driver_force_fallback("gl");
|
||||||
#elif !defined(__WINRT__)
|
#elif !defined(__WINRT__)
|
||||||
#ifdef HAVE_OPENGL1
|
#ifdef HAVE_OPENGL1
|
||||||
retroarch_force_video_driver_fallback("gl1");
|
video_driver_force_fallback("gl1");
|
||||||
#else
|
#else
|
||||||
retroarch_force_video_driver_fallback("gdi");
|
video_driver_force_fallback("gdi");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -3719,12 +3719,12 @@ static void *gl2_init(const video_info_t *video,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (string_is_equal(vendor, "Microsoft Corporation"))
|
if ( string_is_equal(vendor, "Microsoft Corporation"))
|
||||||
if (string_is_equal(renderer, "GDI Generic"))
|
if (string_is_equal(renderer, "GDI Generic"))
|
||||||
#ifdef HAVE_OPENGL1
|
#ifdef HAVE_OPENGL1
|
||||||
retroarch_force_video_driver_fallback("gl1");
|
video_driver_force_fallback("gl1");
|
||||||
#else
|
#else
|
||||||
retroarch_force_video_driver_fallback("gdi");
|
video_driver_force_fallback("gdi");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1271,12 +1271,12 @@ static void *gl_core_init(const video_info_t *video,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (string_is_equal(vendor, "Microsoft Corporation"))
|
if ( string_is_equal(vendor, "Microsoft Corporation"))
|
||||||
if (string_is_equal(renderer, "GDI Generic"))
|
if (string_is_equal(renderer, "GDI Generic"))
|
||||||
#ifdef HAVE_OPENGL1
|
#ifdef HAVE_OPENGL1
|
||||||
retroarch_force_video_driver_fallback("gl1");
|
video_driver_force_fallback("gl1");
|
||||||
#else
|
#else
|
||||||
retroarch_force_video_driver_fallback("gdi");
|
video_driver_force_fallback("gdi");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,15 @@
|
||||||
|
|
||||||
#include <string/stdstring.h>
|
#include <string/stdstring.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "video_driver.h"
|
#include "video_driver.h"
|
||||||
|
|
||||||
|
#include "../ui/ui_companion_driver.h"
|
||||||
|
#include "../verbosity.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
struct string_list *list;
|
struct string_list *list;
|
||||||
|
@ -227,3 +234,66 @@ bool video_driver_translate_coord_viewport(
|
||||||
*res_screen_y = scaled_screen_y;
|
*res_screen_y = scaled_screen_y;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* video_monitor_set_refresh_rate:
|
||||||
|
* @hz : New refresh rate for monitor.
|
||||||
|
*
|
||||||
|
* Sets monitor refresh rate to new value.
|
||||||
|
**/
|
||||||
|
void video_monitor_set_refresh_rate(float hz)
|
||||||
|
{
|
||||||
|
char msg[128];
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
snprintf(msg, sizeof(msg),
|
||||||
|
"Setting refresh rate to: %.3f Hz.", hz);
|
||||||
|
if (settings->bools.notification_show_refresh_rate)
|
||||||
|
runloop_msg_queue_push(msg, 1, 180, false, NULL,
|
||||||
|
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
RARCH_LOG("[Video]: %s\n", msg);
|
||||||
|
|
||||||
|
configuration_set_float(settings,
|
||||||
|
settings->floats.video_refresh_rate,
|
||||||
|
hz);
|
||||||
|
}
|
||||||
|
|
||||||
|
void video_driver_force_fallback(const char *driver)
|
||||||
|
{
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
ui_msg_window_t *msg_window = NULL;
|
||||||
|
|
||||||
|
configuration_set_string(settings,
|
||||||
|
settings->arrays.video_driver,
|
||||||
|
driver);
|
||||||
|
|
||||||
|
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) && !defined(WINAPI_FAMILY)
|
||||||
|
/* UI companion driver is not inited yet, just call into it directly */
|
||||||
|
msg_window = &ui_msg_window_win32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (msg_window)
|
||||||
|
{
|
||||||
|
char text[PATH_MAX_LENGTH];
|
||||||
|
ui_msg_window_state window_state;
|
||||||
|
char *title = strdup(msg_hash_to_str(MSG_ERROR));
|
||||||
|
|
||||||
|
text[0] = '\0';
|
||||||
|
|
||||||
|
snprintf(text, sizeof(text),
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER_FALLBACK),
|
||||||
|
driver);
|
||||||
|
|
||||||
|
window_state.buttons = UI_MSG_WINDOW_OK;
|
||||||
|
window_state.text = strdup(text);
|
||||||
|
window_state.title = title;
|
||||||
|
window_state.window = NULL;
|
||||||
|
|
||||||
|
msg_window->error(&window_state);
|
||||||
|
|
||||||
|
free(title);
|
||||||
|
}
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
|
@ -1125,6 +1125,8 @@ void video_driver_set_gpu_api_version_string(const char *str);
|
||||||
|
|
||||||
const char* video_driver_get_gpu_api_version_string(void);
|
const char* video_driver_get_gpu_api_version_string(void);
|
||||||
|
|
||||||
|
void video_driver_force_fallback(const char *driver);
|
||||||
|
|
||||||
/* string list stays owned by the caller and must be available at all times after the video driver is inited */
|
/* string list stays owned by the caller and must be available at all times after the video driver is inited */
|
||||||
void video_driver_set_gpu_api_devices(enum gfx_ctx_api api, struct string_list *list);
|
void video_driver_set_gpu_api_devices(enum gfx_ctx_api api, struct string_list *list);
|
||||||
|
|
||||||
|
|
65
retroarch.c
65
retroarch.c
|
@ -21477,30 +21477,6 @@ void video_driver_set_size(unsigned width, unsigned height)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* video_monitor_set_refresh_rate:
|
|
||||||
* @hz : New refresh rate for monitor.
|
|
||||||
*
|
|
||||||
* Sets monitor refresh rate to new value.
|
|
||||||
**/
|
|
||||||
void video_monitor_set_refresh_rate(float hz)
|
|
||||||
{
|
|
||||||
char msg[128];
|
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
|
||||||
settings_t *settings = p_rarch->configuration_settings;
|
|
||||||
|
|
||||||
snprintf(msg, sizeof(msg),
|
|
||||||
"Setting refresh rate to: %.3f Hz.", hz);
|
|
||||||
if (settings->bools.notification_show_refresh_rate)
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, false, NULL,
|
|
||||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
|
||||||
RARCH_LOG("[Video]: %s\n", msg);
|
|
||||||
|
|
||||||
configuration_set_float(settings,
|
|
||||||
settings->floats.video_refresh_rate,
|
|
||||||
hz);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* video_monitor_fps_statistics
|
* video_monitor_fps_statistics
|
||||||
* @refresh_rate : Monitor refresh rate.
|
* @refresh_rate : Monitor refresh rate.
|
||||||
|
@ -29350,47 +29326,6 @@ runloop_state_t *runloop_state_get_ptr(void)
|
||||||
return &runloop_state;
|
return &runloop_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void retroarch_force_video_driver_fallback(const char *driver)
|
|
||||||
{
|
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
|
||||||
settings_t *settings = p_rarch->configuration_settings;
|
|
||||||
ui_msg_window_t *msg_window = NULL;
|
|
||||||
|
|
||||||
configuration_set_string(settings,
|
|
||||||
settings->arrays.video_driver,
|
|
||||||
driver);
|
|
||||||
|
|
||||||
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
|
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) && !defined(WINAPI_FAMILY)
|
|
||||||
/* UI companion driver is not inited yet, just call into it directly */
|
|
||||||
msg_window = &ui_msg_window_win32;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (msg_window)
|
|
||||||
{
|
|
||||||
char text[PATH_MAX_LENGTH];
|
|
||||||
ui_msg_window_state window_state;
|
|
||||||
char *title = strdup(msg_hash_to_str(MSG_ERROR));
|
|
||||||
|
|
||||||
text[0] = '\0';
|
|
||||||
|
|
||||||
snprintf(text, sizeof(text),
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER_FALLBACK),
|
|
||||||
driver);
|
|
||||||
|
|
||||||
window_state.buttons = UI_MSG_WINDOW_OK;
|
|
||||||
window_state.text = strdup(text);
|
|
||||||
window_state.title = title;
|
|
||||||
window_state.window = NULL;
|
|
||||||
|
|
||||||
msg_window->error(&window_state);
|
|
||||||
|
|
||||||
free(title);
|
|
||||||
}
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum retro_language rarch_get_language_from_iso(const char *iso639)
|
enum retro_language rarch_get_language_from_iso(const char *iso639)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
|
@ -424,8 +424,6 @@ void retroarch_menu_running(void);
|
||||||
|
|
||||||
void retroarch_menu_running_finished(bool quit);
|
void retroarch_menu_running_finished(bool quit);
|
||||||
|
|
||||||
void retroarch_force_video_driver_fallback(const char *driver);
|
|
||||||
|
|
||||||
enum retro_language rarch_get_language_from_iso(const char *lang);
|
enum retro_language rarch_get_language_from_iso(const char *lang);
|
||||||
|
|
||||||
void rarch_favorites_init(void);
|
void rarch_favorites_init(void);
|
||||||
|
|
Loading…
Reference in New Issue