mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-19 07:16:21 +00:00
Add RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT
This commit is contained in:
parent
6359fe44af
commit
c7615fdf00
18
dynamic.c
18
dynamic.c
@ -92,8 +92,9 @@ static dylib_t lib_handle;
|
||||
#define SYMBOL_VIDEOPROCESSOR(x) current_core->x = libretro_videoprocessor_##x
|
||||
#endif
|
||||
|
||||
static bool ignore_environment_cb = false;
|
||||
static bool *load_no_content_hook = NULL;
|
||||
static bool ignore_environment_cb = false;
|
||||
static bool core_set_shared_context = false;
|
||||
static bool *load_no_content_hook = NULL;
|
||||
|
||||
const struct retro_subsystem_info *libretro_find_subsystem_info(
|
||||
const struct retro_subsystem_info *info, unsigned num_info,
|
||||
@ -632,6 +633,11 @@ bool init_libretro_sym(enum rarch_core_type type, struct retro_core_t *current_c
|
||||
return true;
|
||||
}
|
||||
|
||||
bool libretro_get_shared_context(void)
|
||||
{
|
||||
return core_set_shared_context;
|
||||
}
|
||||
|
||||
/**
|
||||
* uninit_libretro_sym:
|
||||
*
|
||||
@ -651,6 +657,8 @@ void uninit_libretro_sym(struct retro_core_t *current_core)
|
||||
|
||||
memset(current_core, 0, sizeof(struct retro_core_t));
|
||||
|
||||
core_set_shared_context = false;
|
||||
|
||||
rarch_ctl(RARCH_CTL_CORE_OPTIONS_DEINIT, NULL);
|
||||
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
|
||||
rarch_ctl(RARCH_CTL_FRAME_TIME_FREE, NULL);
|
||||
@ -1634,6 +1642,12 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
break;
|
||||
}
|
||||
|
||||
case RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT:
|
||||
{
|
||||
core_set_shared_context = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Default */
|
||||
default:
|
||||
RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
|
||||
|
@ -117,6 +117,8 @@ struct retro_core_t
|
||||
uint64_t serialization_quirks_v;
|
||||
};
|
||||
|
||||
bool libretro_get_shared_context(void);
|
||||
|
||||
/**
|
||||
* init_libretro_sym:
|
||||
* @type : Type of core to be loaded.
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "../drivers_renderchain/gl_legacy_renderchain.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../dynamic.h"
|
||||
#include "../../record/record_driver.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
@ -1658,6 +1659,9 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
|
||||
gl_shared_context_use = settings->bools.video_shared_context
|
||||
&& hwr->context_type != RETRO_HW_CONTEXT_NONE;
|
||||
|
||||
if (libretro_get_shared_context() && (hwr->context_type != RETRO_HW_CONTEXT_NONE))
|
||||
gl_shared_context_use = true;
|
||||
|
||||
return video_context_driver_init_first(gl, settings->arrays.video_context_driver,
|
||||
api, major, minor, gl_shared_context_use);
|
||||
}
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include "../dynamic.h"
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#include <rthreads/rthreads.h>
|
||||
#endif
|
||||
@ -2463,6 +2465,8 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||
bool is_slowmotion = false;
|
||||
settings_t *settings = NULL;
|
||||
video_viewport_t *custom_vp = NULL;
|
||||
struct retro_hw_render_callback *hwr =
|
||||
video_driver_get_hw_context();
|
||||
#ifdef HAVE_THREADS
|
||||
bool is_threaded = video_driver_is_threaded();
|
||||
video_driver_threaded_lock(is_threaded);
|
||||
@ -2483,6 +2487,10 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||
video_info->fullscreen = settings->bools.video_fullscreen;
|
||||
video_info->monitor_index = settings->uints.video_monitor_index;
|
||||
video_info->shared_context = settings->bools.video_shared_context;
|
||||
|
||||
if (libretro_get_shared_context() && hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE)
|
||||
video_info->shared_context = true;
|
||||
|
||||
video_info->font_enable = settings->bools.video_font_enable;
|
||||
video_info->font_msg_pos_x = settings->floats.video_msg_pos_x;
|
||||
video_info->font_msg_pos_y = settings->floats.video_msg_pos_y;
|
||||
|
@ -923,6 +923,18 @@ enum retro_mod
|
||||
* writeable (and readable).
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT (44 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* N/A (null) * --
|
||||
* The frontend will try to use a 'shared' hardware context (mostly applicable
|
||||
* to OpenGL) when a hardware context is being set up.
|
||||
*
|
||||
* Returns true if the frontend supports shared hardware contexts and false
|
||||
* if the frontend does not support shared hardware contexts.
|
||||
*
|
||||
* This will do nothing on its own until SET_HW_RENDER env callbacks are
|
||||
* being used.
|
||||
*/
|
||||
|
||||
enum retro_hw_render_interface_type
|
||||
{
|
||||
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user