From 9e2d688e1dc056c61f420b7b393e9056a9bc1a08 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 15 Oct 2018 01:26:54 +0200 Subject: [PATCH] Get rid of video_context_driver_get_context_data --- gfx/drivers/vulkan.c | 19 +++++++++---------- gfx/video_driver.c | 15 ++------------- gfx/video_driver.h | 2 -- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 859b37a2b6..3ac5d1fc12 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1136,24 +1136,23 @@ static void *vulkan_init(const video_info_t *video, vk_t *vk = (vk_t*)calloc(1, sizeof(*vk)); if (!vk) return NULL; - - vk->video = *video; - - ctx_driver = vulkan_get_context(vk); + ctx_driver = vulkan_get_context(vk); if (!ctx_driver) { RARCH_ERR("[Vulkan]: Failed to get Vulkan context.\n"); goto error; } - vk->ctx_driver = ctx_driver; + vk->video = *video; + vk->ctx_driver = ctx_driver; + video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); video_context_driver_get_video_size(&mode); - full_x = mode.width; - full_y = mode.height; - mode.width = 0; - mode.height = 0; + full_x = mode.width; + full_y = mode.height; + mode.width = 0; + mode.height = 0; RARCH_LOG("[Vulkan]: Detecting screen resolution %ux%u.\n", full_x, full_y); interval = video->vsync ? video->swap_interval : 0; @@ -1188,7 +1187,7 @@ static void *vulkan_init(const video_info_t *video, RARCH_LOG("[Vulkan]: Using resolution %ux%u\n", temp_width, temp_height); - video_context_driver_get_context_data(&vk->context); + *(void**)&vk->context = vk->ctx_driver->get_context_data(vk->ctx_data); vk->vsync = video->vsync; vk->fullscreen = video->fullscreen; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index cf5211f338..358737a0bf 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3273,15 +3273,6 @@ bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info) return true; } -bool video_context_driver_get_context_data(void *data) -{ - if (!current_video_context.get_context_data) - return false; - *(void**)data = current_video_context.get_context_data( - video_context_data); - return true; -} - bool video_context_driver_show_mouse(bool *bool_data) { if (!current_video_context.show_mouse) @@ -3384,15 +3375,13 @@ enum gfx_ctx_api video_context_driver_get_api(void) bool video_driver_has_windowed(void) { -#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE) - return false; -#else +#if !(defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)) if (video_driver_data && current_video->has_windowed) return current_video->has_windowed(video_driver_data); else if (video_context_data && current_video_context.has_windowed) return current_video_context.has_windowed(video_context_data); - return false; #endif + return false; } bool video_driver_cached_frame_has_valid_framebuffer(void) diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 013df5745a..167b8687b4 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1181,8 +1181,6 @@ bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info); bool video_context_driver_get_refresh_rate(float *refresh_rate); -bool video_context_driver_get_context_data(void *data); - bool video_context_driver_show_mouse(bool *bool_data); bool video_context_driver_set_flags(gfx_ctx_flags_t *flags);