Simplify video_thread_get_ptr - get rid of unused p_rarch pointer

in dir_free_shader
This commit is contained in:
twinaphex 2021-05-24 19:22:55 +02:00
parent bb04b0b9d3
commit 244a2ad052
2 changed files with 12 additions and 12 deletions

View File

@ -421,9 +421,8 @@ global_t *global_get_ptr(void)
* with the threaded wrapper (if successful). If not successful, * with the threaded wrapper (if successful). If not successful,
* NULL. * NULL.
**/ **/
static void *video_thread_get_ptr(struct rarch_state *p_rarch) static void *video_thread_get_ptr(const thread_video_t *thr)
{ {
const thread_video_t *thr = (const thread_video_t*)p_rarch->video_driver_data;
if (thr) if (thr)
return thr->driver_data; return thr->driver_data;
return NULL; return NULL;
@ -441,7 +440,7 @@ static void *video_thread_get_ptr(struct rarch_state *p_rarch)
void *video_driver_get_ptr(void) void *video_driver_get_ptr(void)
{ {
struct rarch_state *p_rarch = &rarch_st; struct rarch_state *p_rarch = &rarch_st;
return VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch); return VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch->video_driver_data);
} }
void *video_driver_get_data(void) void *video_driver_get_data(void)
@ -9621,7 +9620,7 @@ static void path_deinit_subsystem(struct rarch_state *p_rarch)
p_rarch->subsystem_fullpaths = NULL; p_rarch->subsystem_fullpaths = NULL;
} }
static void dir_free_shader(struct rarch_state *p_rarch, static void dir_free_shader(
struct rarch_dir_shader_list *dir_list, struct rarch_dir_shader_list *dir_list,
bool shader_remember_last_dir) bool shader_remember_last_dir)
{ {
@ -9726,7 +9725,7 @@ static void dir_init_shader(
#endif #endif
/* Always free existing shader list */ /* Always free existing shader list */
dir_free_shader(p_rarch, dir_list, dir_free_shader(dir_list,
video_shader_remember_last_dir); video_shader_remember_last_dir);
/* Try directory of last selected shader preset */ /* Try directory of last selected shader preset */
@ -29155,7 +29154,7 @@ static void video_driver_free_internal(struct rarch_state *p_rarch)
#ifdef HAVE_VIDEO_FILTER #ifdef HAVE_VIDEO_FILTER
video_driver_filter_free(); video_driver_filter_free();
#endif #endif
dir_free_shader(p_rarch, dir_free_shader(
(struct rarch_dir_shader_list*)&p_rarch->dir_shader_list, (struct rarch_dir_shader_list*)&p_rarch->dir_shader_list,
p_rarch->configuration_settings->bools.video_shader_remember_last_dir); p_rarch->configuration_settings->bools.video_shader_remember_last_dir);
@ -31140,7 +31139,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->input_driver_grab_mouse_state = p_runloop->input_driver_grab_mouse_state; video_info->input_driver_grab_mouse_state = p_runloop->input_driver_grab_mouse_state;
video_info->disp_userdata = &p_rarch->dispgfx; video_info->disp_userdata = &p_rarch->dispgfx;
video_info->userdata = VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch); video_info->userdata = VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch->video_driver_data);
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
VIDEO_DRIVER_THREADED_UNLOCK(is_threaded); VIDEO_DRIVER_THREADED_UNLOCK(is_threaded);
@ -32035,7 +32034,7 @@ static void driver_adjust_system_rates(
runloop_state.force_nonblock = true; runloop_state.force_nonblock = true;
RARCH_LOG("[Video]: Game FPS > Monitor FPS. Cannot rely on VSync.\n"); RARCH_LOG("[Video]: Game FPS > Monitor FPS. Cannot rely on VSync.\n");
if (VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch)) if (VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch->video_driver_data))
{ {
if (p_rarch->current_video->set_nonblock_state) if (p_rarch->current_video->set_nonblock_state)
p_rarch->current_video->set_nonblock_state( p_rarch->current_video->set_nonblock_state(
@ -32049,7 +32048,7 @@ static void driver_adjust_system_rates(
} }
} }
if (VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch)) if (VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch->video_driver_data))
driver_set_nonblock_state(); driver_set_nonblock_state();
} }
@ -32075,7 +32074,8 @@ void driver_set_nonblock_state(void)
bool runloop_force_nonblock = runloop_state.force_nonblock; bool runloop_force_nonblock = runloop_state.force_nonblock;
/* Only apply non-block-state for video if we're using vsync. */ /* Only apply non-block-state for video if we're using vsync. */
if (video_driver_active && VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch)) if ( video_driver_active
&& VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch->video_driver_data))
{ {
if (p_rarch->current_video->set_nonblock_state) if (p_rarch->current_video->set_nonblock_state)
{ {

View File

@ -138,9 +138,9 @@
#endif #endif
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
#define VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch) ((VIDEO_DRIVER_IS_THREADED_INTERNAL()) ? video_thread_get_ptr(p_rarch) : p_rarch->video_driver_data) #define VIDEO_DRIVER_GET_PTR_INTERNAL(video_driver_data) ((VIDEO_DRIVER_IS_THREADED_INTERNAL()) ? video_thread_get_ptr(video_driver_data) : video_driver_data)
#else #else
#define VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch) (p_rarch->video_driver_data) #define VIDEO_DRIVER_GET_PTR_INTERNAL(video_driver_data) (video_driver_data)
#endif #endif
#define VIDEO_DRIVER_GET_HW_CONTEXT_INTERNAL(p_rarch) (&p_rarch->hw_render) #define VIDEO_DRIVER_GET_HW_CONTEXT_INTERNAL(p_rarch) (&p_rarch->hw_render)