mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 00:32:46 +00:00
Be more explicit about GLES2 or GL context.
This commit is contained in:
parent
0604f8e7ee
commit
063a2e091c
30
dynamic.c
30
dynamic.c
@ -560,6 +560,36 @@ static bool environment_cb(unsigned cmd, void *data)
|
||||
{
|
||||
RARCH_LOG("Environ SET_HW_RENDER.\n");
|
||||
struct retro_hw_render_callback *cb = (struct retro_hw_render_callback*)data;
|
||||
switch (cb->context_type)
|
||||
{
|
||||
case RETRO_HW_CONTEXT_NONE:
|
||||
RARCH_LOG("Requesting no HW context.\n");
|
||||
break;
|
||||
|
||||
#if defined(HAVE_OPENGLES2)
|
||||
case RETRO_HW_CONTEXT_OPENGLES2:
|
||||
RARCH_LOG("Requesting OpenGLES2 context.\n");
|
||||
driver.video = &video_gl;
|
||||
break;
|
||||
|
||||
case RETRO_HW_CONTEXT_OPENGL:
|
||||
RARCH_ERR("Requesting OpenGL context, but RetroArch is compiled against OpenGLES2. Cannot use HW context.\n");
|
||||
return false;
|
||||
#elif defined(HAVE_OPENGL)
|
||||
case RETRO_HW_CONTEXT_OPENGLES2:
|
||||
RARCH_ERR("Requesting OpenGLES2 context, but RetroArch is compiled against OpenGL. Cannot use HW context.\n");
|
||||
return false;
|
||||
|
||||
case RETRO_HW_CONTEXT_OPENGL:
|
||||
RARCH_LOG("Requesting OpenGL context.\n");
|
||||
driver.video = &video_gl;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
RARCH_LOG("Requesting unknown context.\n");
|
||||
return false;
|
||||
}
|
||||
cb->get_current_framebuffer = driver_get_current_framebuffer;
|
||||
cb->get_proc_address = driver_get_proc_address;
|
||||
memcpy(&g_extern.system.hw_render_callback, cb, sizeof(*cb));
|
||||
|
8
gfx/gl.c
8
gfx/gl.c
@ -2013,7 +2013,13 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
// Set up render to texture.
|
||||
gl_init_fbo(gl, gl->tex_w, gl->tex_h);
|
||||
|
||||
if (g_extern.system.hw_render_callback.context_type == RETRO_HW_CONTEXT_OPENGL
|
||||
#ifdef HAVE_OPENGLES2
|
||||
enum retro_hw_context_type desired = RETRO_HW_CONTEXT_OPENGLES2;
|
||||
#else
|
||||
enum retro_hw_context_type desired = RETRO_HW_CONTEXT_OPENGL;
|
||||
#endif
|
||||
|
||||
if (g_extern.system.hw_render_callback.context_type == desired
|
||||
&& !gl_init_hw_render(gl, gl->tex_w, gl->tex_h))
|
||||
{
|
||||
context_destroy_func();
|
||||
|
@ -286,7 +286,11 @@ bool retro_load_game(const struct retro_game_info *info)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef GLES
|
||||
hw_render.context_type = RETRO_HW_CONTEXT_OPENGLES2;
|
||||
#else
|
||||
hw_render.context_type = RETRO_HW_CONTEXT_OPENGL;
|
||||
#endif
|
||||
hw_render.context_reset = context_reset;
|
||||
hw_render.depth = true;
|
||||
hw_render.stencil = true;
|
||||
|
@ -451,7 +451,8 @@ typedef retro_proc_address_t (*retro_hw_get_proc_address_t)(const char *sym);
|
||||
enum retro_hw_context_type
|
||||
{
|
||||
RETRO_HW_CONTEXT_NONE = 0,
|
||||
RETRO_HW_CONTEXT_OPENGL,
|
||||
RETRO_HW_CONTEXT_OPENGL, // OpenGL 2.x. Latest version available before 3.x+.
|
||||
RETRO_HW_CONTEXT_OPENGLES2, // GLES 2.0
|
||||
|
||||
RETRO_HW_CONTEXT_DUMMY = INT_MAX
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user