Simplify video_driver_get_ptr

This commit is contained in:
twinaphex 2021-03-21 17:33:44 +01:00
parent 26ea20905a
commit e5ca68a518
9 changed files with 16 additions and 16 deletions

View File

@ -452,7 +452,7 @@ static void main_loop(void)
for (;;) for (;;)
{ {
if (video_driver_get_ptr(false)) if (video_driver_get_ptr())
{ {
start_time = OSGetSystemTime(); start_time = OSGetSystemTime();
task_queue_wait(swap_is_pending, &start_time); task_queue_wait(swap_is_pending, &start_time);

View File

@ -1286,7 +1286,7 @@ LRESULT CALLBACK wnd_proc_gdi_dinput(HWND hwnd, UINT message,
} }
else if (message == WM_PAINT) else if (message == WM_PAINT)
{ {
gdi_t *gdi = (gdi_t*)video_driver_get_ptr(false); gdi_t *gdi = (gdi_t*)video_driver_get_ptr();
if (gdi && gdi->memDC) if (gdi && gdi->memDC)
{ {
@ -1334,7 +1334,7 @@ LRESULT CALLBACK wnd_proc_gdi_common(HWND hwnd, UINT message,
} }
else if (message == WM_PAINT) else if (message == WM_PAINT)
{ {
gdi_t *gdi = (gdi_t*)video_driver_get_ptr(false); gdi_t *gdi = (gdi_t*)video_driver_get_ptr();
if (gdi && gdi->memDC) if (gdi && gdi->memDC)
{ {

View File

@ -629,7 +629,7 @@ font_data_t *gfx_display_font_file(
font_size = 2.0f; font_size = 2.0f;
if (!dispctx->font_init_first((void**)&font_data, if (!dispctx->font_init_first((void**)&font_data,
video_driver_get_ptr(false), video_driver_get_ptr(),
fontpath, font_size, is_threaded)) fontpath, font_size, is_threaded))
return NULL; return NULL;

View File

@ -500,7 +500,7 @@ static void qnx_process_touch_event(
vp.full_height = 0; vp.full_height = 0;
#if 0 #if 0
gl_t *gl = (gl_t*)video_driver_get_ptr(false); gl_t *gl = (gl_t*)video_driver_get_ptr();
/*During a move, we can go ~30 pixel into the /*During a move, we can go ~30 pixel into the
* bezel which gives negative numbers or * bezel which gives negative numbers or

View File

@ -287,7 +287,7 @@ static void sdl2_grab_mouse(void *data, bool state)
return; return;
/* First member of sdl2_video_t is the window */ /* First member of sdl2_video_t is the window */
SDL_SetWindowGrab(((struct temp*)video_driver_get_ptr(false))->w, SDL_SetWindowGrab(((struct temp*)video_driver_get_ptr())->w,
state ? SDL_TRUE : SDL_FALSE); state ? SDL_TRUE : SDL_FALSE);
} }
#endif #endif

View File

@ -7673,7 +7673,7 @@ static void change_handler_video_layout_enable(rarch_setting_t *setting)
if (*setting->value.target.boolean) if (*setting->value.target.boolean)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
void *driver = video_driver_get_ptr(false); void *driver = video_driver_get_ptr();
video_layout_init(driver, video_driver_layout_render_interface()); video_layout_init(driver, video_driver_layout_render_interface());
video_layout_load(settings->paths.path_video_layout); video_layout_load(settings->paths.path_video_layout);

View File

@ -429,10 +429,10 @@ static void *video_thread_get_ptr(struct rarch_state *p_rarch)
* *
* Returns: video driver's userdata. * Returns: video driver's userdata.
**/ **/
void *video_driver_get_ptr(bool force_nonthreaded_data) 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, force_nonthreaded_data); return VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch);
} }
void *video_driver_get_data(void) void *video_driver_get_data(void)
@ -29495,7 +29495,7 @@ const char *video_driver_get_ident(void)
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
if (VIDEO_DRIVER_IS_THREADED_INTERNAL()) if (VIDEO_DRIVER_IS_THREADED_INTERNAL())
{ {
const thread_video_t *thr = (const thread_video_t*)VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch, true); const thread_video_t *thr = (const thread_video_t*)p_rarch->video_driver_data;
if (!thr || !thr->driver) if (!thr || !thr->driver)
return NULL; return NULL;
return thr->driver->ident; return thr->driver->ident;
@ -31822,7 +31822,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->input_driver_nonblock_state = p_rarch->input_driver_nonblock_state; video_info->input_driver_nonblock_state = p_rarch->input_driver_nonblock_state;
video_info->input_driver_grab_mouse_state = p_rarch->input_driver_grab_mouse_state; video_info->input_driver_grab_mouse_state = p_rarch->input_driver_grab_mouse_state;
video_info->userdata = VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch, false); video_info->userdata = VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch);
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
VIDEO_DRIVER_THREADED_UNLOCK(is_threaded); VIDEO_DRIVER_THREADED_UNLOCK(is_threaded);
@ -32672,7 +32672,7 @@ static void driver_adjust_system_rates(struct rarch_state *p_rarch)
video_driver_monitor_adjust_system_rates(p_rarch); video_driver_monitor_adjust_system_rates(p_rarch);
if (!VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch, false)) if (!VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch))
return; return;
if (p_rarch->runloop_force_nonblock) if (p_rarch->runloop_force_nonblock)
@ -32714,7 +32714,7 @@ void driver_set_nonblock_state(void)
bool runloop_force_nonblock = p_rarch->runloop_force_nonblock; bool runloop_force_nonblock = p_rarch->runloop_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, false)) if (video_driver_active && VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch))
{ {
if (p_rarch->current_video->set_nonblock_state) if (p_rarch->current_video->set_nonblock_state)
{ {

View File

@ -1583,7 +1583,7 @@ const char* config_get_video_driver_options(void);
* *
* Returns: video driver's userdata. * Returns: video driver's userdata.
**/ **/
void *video_driver_get_ptr(bool force_nonthreaded_data); void *video_driver_get_ptr(void);
void *video_driver_get_data(void); void *video_driver_get_data(void);

View File

@ -157,9 +157,9 @@
#endif #endif
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
#define VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch, force) ((VIDEO_DRIVER_IS_THREADED_INTERNAL() && !force) ? video_thread_get_ptr(p_rarch) : p_rarch->video_driver_data) #define VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch) ((VIDEO_DRIVER_IS_THREADED_INTERNAL()) ? video_thread_get_ptr(p_rarch) : p_rarch->video_driver_data)
#else #else
#define VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch, force) (p_rarch->video_driver_data) #define VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch) (p_rarch->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)