From a4bd80596ed58e65553d425877e625a4a182a026 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 31 Aug 2016 03:42:58 +0200 Subject: [PATCH] Create dynamic_verify_hw_context - if we request a GL hw context and we have the Vulkan driver running, return false - or vice versa. Can now use ffmpeg core with Vulkan --- dynamic.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dynamic.c b/dynamic.c index 20297fa0a2..1c1f739764 100644 --- a/dynamic.c +++ b/dynamic.c @@ -893,6 +893,32 @@ static bool dynamic_request_hw_context(enum retro_hw_context_type type, return true; } +static bool dynamic_verify_hw_context(enum retro_hw_context_type type, + unsigned minor, unsigned major) +{ + const char *video_ident = video_driver_get_ident(); + + switch (type) + { + case RETRO_HW_CONTEXT_VULKAN: + if (!string_is_equal(video_ident, "vulkan")) + return false; + break; + case RETRO_HW_CONTEXT_OPENGLES2: + case RETRO_HW_CONTEXT_OPENGLES3: + case RETRO_HW_CONTEXT_OPENGLES_VERSION: + case RETRO_HW_CONTEXT_OPENGL: + case RETRO_HW_CONTEXT_OPENGL_CORE: + if (!string_is_equal(video_ident, "gl")) + return false; + break; + default: + break; + } + + return true; +} + /** * rarch_environment_cb: * @cmd : Identifier of command. @@ -1201,6 +1227,9 @@ bool rarch_environment_cb(unsigned cmd, void *data) if (!dynamic_request_hw_context(cb->context_type, cb->version_minor, cb->version_major)) return false; + if (!dynamic_verify_hw_context(cb->context_type, cb->version_minor, cb->version_major)) + return false; + cb->get_current_framebuffer = video_driver_get_current_framebuffer; cb->get_proc_address = video_driver_get_proc_address;