mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 13:20:30 +00:00
Add configurable GL context.
This commit is contained in:
parent
232706d665
commit
eb0476ffab
@ -155,6 +155,7 @@ struct settings
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char driver[32];
|
char driver[32];
|
||||||
|
char gl_context[32];
|
||||||
float xscale;
|
float xscale;
|
||||||
float yscale;
|
float yscale;
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
|
@ -630,6 +630,6 @@ const gfx_ctx_driver_t gfx_ctx_drm_egl = {
|
|||||||
gfx_ctx_init_egl_image_buffer,
|
gfx_ctx_init_egl_image_buffer,
|
||||||
gfx_ctx_write_egl_image,
|
gfx_ctx_write_egl_image,
|
||||||
NULL,
|
NULL,
|
||||||
"drm-egl",
|
"kms-egl",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ static bool gfx_ctx_set_video_mode(
|
|||||||
|
|
||||||
if (true_full)
|
if (true_full)
|
||||||
{
|
{
|
||||||
RARCH_LOG("[GLX]: Using true fullscreen.\n");
|
RARCH_LOG("[X/EGL]: Using true fullscreen.\n");
|
||||||
XMapRaised(g_dpy, g_win);
|
XMapRaised(g_dpy, g_win);
|
||||||
}
|
}
|
||||||
else if (fullscreen) // We attempted true fullscreen, but failed. Attempt using windowed fullscreen.
|
else if (fullscreen) // We attempted true fullscreen, but failed. Attempt using windowed fullscreen.
|
||||||
@ -455,7 +455,7 @@ static void gfx_ctx_destroy(void)
|
|||||||
g_screen = x11_get_xinerama_monitor(g_dpy, x, y,
|
g_screen = x11_get_xinerama_monitor(g_dpy, x, y,
|
||||||
target.width, target.height);
|
target.width, target.height);
|
||||||
|
|
||||||
RARCH_LOG("[GLX]: Saved monitor #%u.\n", g_screen);
|
RARCH_LOG("[X/EGL]: Saved monitor #%u.\n", g_screen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XUnmapWindow(g_dpy, g_win);
|
XUnmapWindow(g_dpy, g_win);
|
||||||
|
45
gfx/gl.c
45
gfx/gl.c
@ -1569,6 +1569,45 @@ static void gl_init_pbo_readback(void *data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const gfx_ctx_driver_t *gl_get_context(void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_OPENGLES
|
||||||
|
enum gfx_ctx_api api = GFX_CTX_OPENGL_ES_API;
|
||||||
|
const char *api_name = "OpenGL ES";
|
||||||
|
#else
|
||||||
|
enum gfx_ctx_api api = GFX_CTX_OPENGL_API;
|
||||||
|
const char *api_name = "OpenGL";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (*g_settings.video.gl_context)
|
||||||
|
{
|
||||||
|
const gfx_ctx_driver_t *ctx = gfx_ctx_find_driver(g_settings.video.gl_context);
|
||||||
|
if (ctx)
|
||||||
|
{
|
||||||
|
if (!ctx->bind_api(api))
|
||||||
|
{
|
||||||
|
RARCH_ERR("Failed to bind API %s to context %s.\n", api_name, g_settings.video.gl_context);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ctx->init())
|
||||||
|
{
|
||||||
|
RARCH_ERR("Failed to init GL context: %s.\n", ctx->ident);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RARCH_ERR("Didn't find GL context: %s.\n", g_settings.video.gl_context);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return gfx_ctx_init_first(api);
|
||||||
|
}
|
||||||
|
|
||||||
static void *gl_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
static void *gl_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -1589,11 +1628,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
if (!gl)
|
if (!gl)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifdef HAVE_OPENGLES
|
gl->ctx_driver = gl_get_context();
|
||||||
gl->ctx_driver = gfx_ctx_init_first(GFX_CTX_OPENGL_ES_API);
|
|
||||||
#else
|
|
||||||
gl->ctx_driver = gfx_ctx_init_first(GFX_CTX_OPENGL_API);
|
|
||||||
#endif
|
|
||||||
if (!gl->ctx_driver)
|
if (!gl->ctx_driver)
|
||||||
{
|
{
|
||||||
free(gl);
|
free(gl);
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
# Video driver to use. "gl", "xvideo", "sdl"
|
# Video driver to use. "gl", "xvideo", "sdl"
|
||||||
# video_driver = "gl"
|
# video_driver = "gl"
|
||||||
|
|
||||||
|
# Which OpenGL context implementation to use.
|
||||||
|
# Possible ones for desktop are: glx, x-egl, kms-egl, sdl-gl, wgl.
|
||||||
|
# By default, tries to use first suitable driver.
|
||||||
|
# video_gl_context =
|
||||||
|
|
||||||
# Windowed xscale and yscale
|
# Windowed xscale and yscale
|
||||||
# (Real x res: base_size * xscale * aspect_ratio, real y res: base_size * yscale)
|
# (Real x res: base_size * xscale * aspect_ratio, real y res: base_size * yscale)
|
||||||
# video_xscale = 3.0
|
# video_xscale = 3.0
|
||||||
|
@ -648,6 +648,7 @@ bool config_load_file(const char *path)
|
|||||||
CONFIG_GET_STRING(audio.resampler, "audio_resampler");
|
CONFIG_GET_STRING(audio.resampler, "audio_resampler");
|
||||||
|
|
||||||
CONFIG_GET_STRING(video.driver, "video_driver");
|
CONFIG_GET_STRING(video.driver, "video_driver");
|
||||||
|
CONFIG_GET_STRING(video.gl_context, "video_gl_context");
|
||||||
CONFIG_GET_STRING(audio.driver, "audio_driver");
|
CONFIG_GET_STRING(audio.driver, "audio_driver");
|
||||||
CONFIG_GET_PATH(audio.dsp_plugin, "audio_dsp_plugin");
|
CONFIG_GET_PATH(audio.dsp_plugin, "audio_dsp_plugin");
|
||||||
CONFIG_GET_STRING(input.driver, "input_driver");
|
CONFIG_GET_STRING(input.driver, "input_driver");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user