mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-12 04:46:39 +00:00
Create RARCH_DISPLAY_CTL_IS_HW_CONTEXT
This commit is contained in:
parent
d8bfa7ab7d
commit
0584b3c072
@ -276,10 +276,10 @@ bool font_driver_init_first(
|
||||
: (void**)&font_osd_data;
|
||||
#ifdef HAVE_THREADS
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
|
||||
if (threading_hint && settings->video.threaded && !hw_render->context_type)
|
||||
if (threading_hint
|
||||
&& settings->video.threaded
|
||||
&& !video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL))
|
||||
return rarch_threaded_video_font_init(new_font_driver, new_font_handle,
|
||||
data, font_path, font_size, api, font_init_first);
|
||||
#endif
|
||||
|
@ -239,7 +239,7 @@ static bool find_video_driver(void)
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#if defined(HAVE_OPENGL) && defined(HAVE_FBO)
|
||||
if (video_driver_state.hw_render_callback.context_type)
|
||||
if (video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL))
|
||||
{
|
||||
RARCH_LOG("Using HW render, OpenGL driver forced.\n");
|
||||
current_video = &video_gl;
|
||||
@ -298,7 +298,7 @@ void *video_driver_get_ptr(bool force_nonthreaded_data)
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings->video.threaded
|
||||
&& !video_driver_state.hw_render_callback.context_type
|
||||
&& !(video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL))
|
||||
&& !force_nonthreaded_data)
|
||||
return rarch_threaded_video_get_ptr(NULL);
|
||||
#endif
|
||||
@ -385,7 +385,7 @@ static void init_video_filter(enum retro_pixel_format colfmt)
|
||||
if (colfmt == RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
colfmt = RETRO_PIXEL_FORMAT_RGB565;
|
||||
|
||||
if (video_driver_state.hw_render_callback.context_type)
|
||||
if (video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL))
|
||||
{
|
||||
RARCH_WARN("Cannot use CPU filters when hardware rendering is used.\n");
|
||||
return;
|
||||
@ -720,7 +720,7 @@ static bool init_video(void)
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (settings->video.threaded
|
||||
&& !video_driver_state.hw_render_callback.context_type)
|
||||
&& !video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL))
|
||||
{
|
||||
/* Can't do hardware rendering with threaded driver currently. */
|
||||
RARCH_LOG("Starting threaded video driver ...\n");
|
||||
@ -1449,8 +1449,8 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
|
||||
return settings->video.gpu_record && current_video->read_viewport;
|
||||
case RARCH_DISPLAY_CTL_SUPPORTS_VIEWPORT_READ:
|
||||
return (settings->video.gpu_screenshot ||
|
||||
((hw_render->context_type
|
||||
!= RETRO_HW_CONTEXT_NONE) && !current_video->read_frame_raw))
|
||||
(video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL)
|
||||
&& !current_video->read_frame_raw))
|
||||
&& current_video->read_viewport && current_video->viewport_info;
|
||||
case RARCH_DISPLAY_CTL_SUPPORTS_READ_FRAME_RAW:
|
||||
return current_video->read_frame_raw;
|
||||
@ -1701,6 +1701,8 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_DISPLAY_CTL_OWNS_DRIVER:
|
||||
return video_driver_data_own;
|
||||
case RARCH_DISPLAY_CTL_IS_HW_CONTEXT:
|
||||
return (hw_render->context_type != RETRO_HW_CONTEXT_NONE);
|
||||
case RARCH_DISPLAY_CTL_DEINIT_HW_CONTEXT:
|
||||
if (hw_render->context_destroy)
|
||||
hw_render->context_destroy();
|
||||
@ -2018,7 +2020,8 @@ bool video_driver_texture_load(void *data,
|
||||
|
||||
*id = video_driver_poke->load_texture(video_driver_data, data,
|
||||
#ifdef HAVE_THREADS
|
||||
settings->video.threaded && !hw_render->context_type,
|
||||
settings->video.threaded
|
||||
&& !video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL),
|
||||
#else
|
||||
false,
|
||||
#endif
|
||||
|
@ -141,6 +141,7 @@ enum rarch_display_ctl_state
|
||||
RARCH_DISPLAY_CTL_UNSET_OWN_DRIVER,
|
||||
RARCH_DISPLAY_CTL_OWNS_DRIVER,
|
||||
RARCH_DISPLAY_CTL_DEINIT_HW_CONTEXT,
|
||||
RARCH_DISPLAY_CTL_IS_HW_CONTEXT,
|
||||
RARCH_DISPLAY_CTL_SET_VIDEO_CACHE_CONTEXT,
|
||||
RARCH_DISPLAY_CTL_UNSET_VIDEO_CACHE_CONTEXT,
|
||||
RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT,
|
||||
|
@ -298,8 +298,6 @@ bool recording_init(void)
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
bool *recording_enabled = recording_is_enabled();
|
||||
|
||||
if (!*recording_enabled)
|
||||
@ -307,13 +305,16 @@ bool recording_init(void)
|
||||
|
||||
if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||
{
|
||||
RARCH_WARN("%s\n", msg_hash_to_str(MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED));
|
||||
RARCH_WARN("%s\n",
|
||||
msg_hash_to_str(MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!settings->video.gpu_record && hw_render->context_type)
|
||||
if (!settings->video.gpu_record
|
||||
&& video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL))
|
||||
{
|
||||
RARCH_WARN("%s.\n", msg_hash_to_str(MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING));
|
||||
RARCH_WARN("%s.\n",
|
||||
msg_hash_to_str(MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -394,7 +395,8 @@ bool recording_init(void)
|
||||
else
|
||||
params.aspect_ratio = (float)params.out_width / params.out_height;
|
||||
|
||||
if (settings->video.post_filter_record && video_driver_ctl(RARCH_DISPLAY_CTL_FRAME_FILTER_ALIVE, NULL))
|
||||
if (settings->video.post_filter_record
|
||||
&& video_driver_ctl(RARCH_DISPLAY_CTL_FRAME_FILTER_ALIVE, NULL))
|
||||
{
|
||||
unsigned max_width = 0;
|
||||
unsigned max_height = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user