From 72f65396c7d3235e461da374b467c1b5dfa06689 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Mon, 28 Mar 2016 23:33:58 +0200 Subject: [PATCH 1/6] Fix cross-compile build on Linux. --- Makefile.common | 13 ++++++++++--- deps/glslang/glslang | 2 +- libretro-common/net/net_ifinfo.c | 4 ++-- qb/config.libs.sh | 1 - qb/config.params.sh | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile.common b/Makefile.common index f1afbd1f8f..78ce5abbd3 100644 --- a/Makefile.common +++ b/Makefile.common @@ -736,11 +736,12 @@ ifeq ($(HAVE_SDL2), 1) endif ifeq ($(HAVE_VULKAN), 1) - ifeq ($(platform), win) + ifneq ($(findstring Win32,$(OS)),) GLSLANG_PLATFORM := Windows else GLSLANG_PLATFORM := Unix endif + GLSLANG_SOURCES := \ $(wildcard deps/glslang/*.cpp) \ $(wildcard deps/glslang/glslang/SPIRV/*.cpp) \ @@ -750,10 +751,16 @@ ifeq ($(HAVE_VULKAN), 1) $(wildcard deps/glslang/glslang/glslang/MachineIndependent/preprocessor/*.cpp) \ $(wildcard deps/glslang/glslang/glslang/OSDependent/$(GLSLANG_PLATFORM)/*.cpp) + ifneq ($(findstring Win32,$(OS)),) + # Trivial temporary workaround for MinGW and glslang. + CXXFLAGS += -fpermissive + endif + SPIR2CROSS_SOURCES := deps/spir2cross/spir2cross.cpp DEFINES += \ -Ideps/glslang/glslang/glslang/OSDependent/$(GLSLANG_PLATFORM) \ + -Ideps/glslang/glslang/OGLCompilersDLL \ -Ideps/glslang/glslang \ -Ideps/glslang/glslang/glslang/MachineIndependent \ -Ideps/glslang/glslang/glslang/Public \ @@ -761,8 +768,8 @@ ifeq ($(HAVE_VULKAN), 1) -Ideps/glslang \ -Ideps/spir2cross - CXXFLAGS += -Wno-switch -Wno-sign-compare -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-reorder -I./gfx/include/vulkan - CFLAGS += -I./gfx/include/vulkan + CXXFLAGS += -Wno-switch -Wno-sign-compare -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-reorder -Igfx/include + CFLAGS += -Igfx/include GLSLANG_OBJ := $(GLSLANG_SOURCES:.cpp=.o) SPIR2CROSS_OBJ := $(SPIR2CROSS_SOURCES:.cpp=.o) diff --git a/deps/glslang/glslang b/deps/glslang/glslang index 5ace09a75b..c3869fee41 160000 --- a/deps/glslang/glslang +++ b/deps/glslang/glslang @@ -1 +1 @@ -Subproject commit 5ace09a75be02bd32505f1f94b1b49a6aa3498b8 +Subproject commit c3869fee412a90c4eadea0bf936ab2530d2dff51 diff --git a/libretro-common/net/net_ifinfo.c b/libretro-common/net/net_ifinfo.c index 806032978b..63bbb90413 100644 --- a/libretro-common/net/net_ifinfo.c +++ b/libretro-common/net/net_ifinfo.c @@ -28,8 +28,8 @@ #if defined(_WIN32) && !defined(_XBOX) #include -#include -#include +#include +#include #else #include #include diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 163463b921..3a8d1a0f12 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -394,7 +394,6 @@ if [ "$OS" != 'Win32' ]; then fi check_lib STRCASESTR "$CLIB" strcasestr check_lib MMAP "$CLIB" mmap -check_lib VULKAN -lvulkan vkCreateInstance if [ "$HAVE_VULKAN" != 'no' ] && [ ! -e deps/glslang/glslang/README.md ]; then echo "Warning: glslang submodule not loaded, can't use Vulkan." diff --git a/qb/config.params.sh b/qb/config.params.sh index 27fd9b70ac..a80fc7d259 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -73,5 +73,5 @@ HAVE_MMAP=auto # MMAP support HAVE_QT=no # QT companion support HAVE_XSHM=no # XShm video driver support (disabled because it's just a dummied out stub) HAVE_CHEEVOS=yes # Retro Achievements -HAVE_VULKAN=auto # Vulkan support +HAVE_VULKAN=no # Vulkan support C89_VULKAN=no From 8ade7fb2743c81cd827f7d17a4695eec0619e8a5 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 29 Mar 2016 00:45:36 +0200 Subject: [PATCH 2/6] Vulkan: Attempt Windows backend support. Completely bind since I cannot test myself, but compiles. --- gfx/common/vulkan_common.c | 4 +- gfx/common/vulkan_common.h | 8 ++ gfx/common/win32_common.cpp | 2 +- gfx/common/win32_common.h | 2 +- gfx/drivers_context/wgl_ctx.cpp | 218 ++++++++++++++++++++++++++++---- 5 files changed, 203 insertions(+), 31 deletions(-) diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index dcddc15823..cea1d2cfc4 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -1481,8 +1481,8 @@ bool vulkan_surface_create(gfx_ctx_vulkan_data_t *vk, surf_info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; surf_info.flags = 0; - surf_info.hinstance = display; - surf_info.hwnd = surface; + surf_info.hinstance = *(const HINSTANCE*)display; + surf_info.hwnd = *(const HWND*)surface; if (VKFUNC(vkCreateWin32SurfaceKHR)(vk->context.instance, &surf_info, NULL, &vk->vk_surface) != VK_SUCCESS) diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index 6a46bb84d1..6a5b0629c7 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -48,6 +48,10 @@ #include "../../libretro_vulkan.h" #include "../drivers_shader/shader_vulkan.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct vulkan_filter_chain vulkan_filter_chain_t; enum vk_texture_type @@ -503,5 +507,9 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, unsigned width, unsigned height, unsigned swap_interval); +#ifdef __cplusplus +} +#endif + #endif diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index 3110071eff..a9e3a24a7e 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -258,7 +258,7 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, return ret; break; case WM_CREATE: - create_gl_context(hwnd, &g_quit); + create_graphics_context(hwnd, &g_quit); return 0; } diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index 99661115c2..741e70e506 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -47,7 +47,7 @@ void win32_monitor_get_info(void); void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id); -void create_gl_context(HWND hwnd, bool *quit); +void create_graphics_context(HWND hwnd, bool *quit); bool win32_shader_dlg_init(void); void shader_dlg_show(HWND parent_hwnd); diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index b088e5dc9e..c75f282b2c 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -39,6 +39,10 @@ #include "../common/gl_common.h" #include "../common/win32_common.h" +#ifdef HAVE_VULKAN +#include "../common/vulkan_common.h" +#endif + #ifndef WGL_CONTEXT_MAJOR_VERSION_ARB #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #endif @@ -71,8 +75,13 @@ static HGLRC g_hrc; static HGLRC g_hw_hrc; static HDC g_hdc; +#ifdef HAVE_VULKAN +static gfx_ctx_vulkan_data_t g_vk; +#endif + static unsigned g_major; static unsigned g_minor; +static enum gfx_ctx_api g_api; static unsigned g_interval; @@ -95,7 +104,7 @@ static void setup_pixel_format(HDC hdc) SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd); } -void create_gl_context(HWND hwnd, bool *quit) +static void create_gl_context(HWND hwnd, bool *quit) { bool core_context; struct retro_hw_render_callback *hwr = NULL; @@ -219,6 +228,36 @@ void create_gl_context(HWND hwnd, bool *quit) } } +void create_graphics_context(HWND hwnd, bool *quit) +{ + switch (g_api) + { + case GFX_CTX_OPENGL_API: + create_gl_context(hwnd, quit); + break; + + case GFX_CTX_VULKAN_API: + { +#ifdef HAVE_VULKAN + RECT rect; + unsigned width = rect.right - rect.left; + unsigned height = rect.bottom - rect.top; + GetClientRect(hwnd, &rect); + HINSTANCE instance = GetModuleHandle(NULL); + if (!vulkan_surface_create(&g_vk, VULKAN_WSI_WIN32, + &instance, &hwnd, + width, height, g_interval)) + *quit = true; + break; +#endif + } + + case GFX_CTX_NONE: + default: + break; + } +} + void *dinput_wgl; static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval) @@ -226,26 +265,81 @@ static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval) (void)data; g_interval = interval; - if (!g_hrc) - return; - if (!p_swap_interval) - return; + switch (g_api) + { + case GFX_CTX_OPENGL_API: +#ifdef HAVE_OPENGL + if (!g_hrc) + return; + if (!p_swap_interval) + return; - RARCH_LOG("[WGL]: wglSwapInterval(%u)\n", g_interval); - if (!p_swap_interval(g_interval)) - RARCH_WARN("[WGL]: wglSwapInterval() failed.\n"); + RARCH_LOG("[WGL]: wglSwapInterval(%u)\n", g_interval); + if (!p_swap_interval(g_interval)) + RARCH_WARN("[WGL]: wglSwapInterval() failed.\n"); +#endif + break; + + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + if (g_interval != interval) + { + g_interval = interval; + if (g_vk.swapchain) + g_vk.need_new_swapchain = true; + } +#endif + break; + + case GFX_CTX_NONE: + default: + break; + } } static void gfx_ctx_wgl_check_window(void *data, bool *quit, bool *resize, unsigned *width, unsigned *height, unsigned frame_count) { win32_check_window(quit, resize, width, height); + + switch (g_api) + { + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + if (g_vk.need_new_swapchain) + *resize = true; +#endif + break; + + case GFX_CTX_NONE: + default: + break; + } } static void gfx_ctx_wgl_swap_buffers(void *data) { (void)data; - SwapBuffers(g_hdc); + + switch (g_api) + { + case GFX_CTX_OPENGL_API: +#ifdef HAVE_OPENGL + SwapBuffers(g_hdc); + break; +#endif + + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + vulkan_present(&g_vk, g_vk.context.current_swapchain_index); + vulkan_acquire_next_image(&g_vk); +#endif + break; + + case GFX_CTX_NONE: + default: + break; + } } static bool gfx_ctx_wgl_set_resize(void *data, @@ -254,6 +348,27 @@ static bool gfx_ctx_wgl_set_resize(void *data, (void)data; (void)width; (void)height; + + switch (g_api) + { + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + if (!vulkan_create_swapchain(&g_vk, width, height, g_interval)) + { + RARCH_ERR("[Win32/Vulkan]: Failed to update swapchain.\n"); + return false; + } + + g_vk.context.invalid_swapchain = true; + g_vk.need_new_swapchain = false; +#endif + break; + + case GFX_CTX_NONE: + default: + break; + } + return false; } @@ -314,6 +429,16 @@ static void *gfx_ctx_wgl_init(void *video_driver) if (!win32_window_init(&wndclass, true, NULL)) return NULL; + switch (g_api) + { + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + if (!vulkan_context_init(&g_vk, VULKAN_WSI_WIN32)) + return NULL; +#endif + break; + } + return (void*)"wgl"; } @@ -323,19 +448,39 @@ static void gfx_ctx_wgl_destroy(void *data) (void)data; - if (g_hrc) + switch (g_api) { - glFinish(); - wglMakeCurrent(NULL, NULL); + case GFX_CTX_OPENGL_API: +#ifdef HAVE_OPENGL + if (g_hrc) + { + glFinish(); + wglMakeCurrent(NULL, NULL); - if (!video_driver_ctl(RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT, NULL)) - { - if (g_hw_hrc) - wglDeleteContext(g_hw_hrc); - wglDeleteContext(g_hrc); - g_hrc = NULL; - g_hw_hrc = NULL; - } + if (!video_driver_ctl(RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT, NULL)) + { + if (g_hw_hrc) + wglDeleteContext(g_hw_hrc); + wglDeleteContext(g_hrc); + g_hrc = NULL; + g_hw_hrc = NULL; + } + } +#endif + break; + + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + vulkan_context_destroy(&g_vk, g_vk.vk_surface != VK_NULL_HANDLE); + if (g_vk.context.queue_lock) + slock_free(g_vk.context.queue_lock); + memset(&g_vk, 0, sizeof(g_vk)); +#endif + break; + + case GFX_CTX_NONE: + default: + break; } if (window && g_hdc) @@ -368,10 +513,17 @@ static bool gfx_ctx_wgl_set_video_mode(void *data, if (!win32_set_video_mode(NULL, width, height, fullscreen)) goto error; - p_swap_interval = (BOOL (APIENTRY *)(int)) - wglGetProcAddress("wglSwapIntervalEXT"); + switch (g_api) + { + case GFX_CTX_OPENGL_API: +#ifdef HAVE_OPENGL + p_swap_interval = (BOOL (APIENTRY *)(int)) + wglGetProcAddress("wglSwapIntervalEXT"); - gfx_ctx_wgl_swap_interval(data, g_interval); + gfx_ctx_wgl_swap_interval(data, g_interval); +#endif + break; + } return true; @@ -430,8 +582,9 @@ static bool gfx_ctx_wgl_bind_api(void *data, g_major = major; g_minor = minor; + g_api = api; - return api == GFX_CTX_OPENGL_API; + return api == GFX_CTX_OPENGL_API || api == GFX_CTX_VULKAN_API; } static void gfx_ctx_wgl_show_mouse(void *data, bool state) @@ -442,10 +595,21 @@ static void gfx_ctx_wgl_show_mouse(void *data, bool state) static void gfx_ctx_wgl_bind_hw_render(void *data, bool enable) { - g_use_hw_ctx = enable; + switch (g_api) + { + case GFX_CTX_OPENGL_API: +#ifdef HAVE_OPENGL + g_use_hw_ctx = enable; - if (g_hdc) - wglMakeCurrent(g_hdc, enable ? g_hw_hrc : g_hrc); + if (g_hdc) + wglMakeCurrent(g_hdc, enable ? g_hw_hrc : g_hrc); +#endif + break; + + case GFX_CTX_NONE: + default: + break; + } } const gfx_ctx_driver_t gfx_ctx_wgl = { From 02736963bc8051d737c69de2f66cf41fd8229e41 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 29 Mar 2016 13:27:45 +0200 Subject: [PATCH 3/6] Vulkan: Implement get_context_data callback in Win32. Also fix some potential crashes with dinput handling. --- gfx/common/win32_common.cpp | 4 ++-- gfx/drivers_context/wgl_ctx.cpp | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index a9e3a24a7e..d257521408 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -228,7 +228,7 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, return 0; } - if (dinput_handle_message(dinput, message, wparam, lparam)) + if (dinput && dinput_handle_message(dinput, message, wparam, lparam)) return 0; return DefWindowProc(hwnd, message, wparam, lparam); } @@ -262,7 +262,7 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, return 0; } - if (dinput_handle_message(dinput_wgl, message, wparam, lparam)) + if (dinput_wgl && dinput_handle_message(dinput_wgl, message, wparam, lparam)) return 0; return DefWindowProc(hwnd, message, wparam, lparam); } diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index c75f282b2c..c298614237 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -519,12 +519,15 @@ static bool gfx_ctx_wgl_set_video_mode(void *data, #ifdef HAVE_OPENGL p_swap_interval = (BOOL (APIENTRY *)(int)) wglGetProcAddress("wglSwapIntervalEXT"); - - gfx_ctx_wgl_swap_interval(data, g_interval); #endif break; + + case GFX_CTX_NONE: + default: + break; } + gfx_ctx_wgl_swap_interval(data, g_interval); return true; error: @@ -612,6 +615,14 @@ static void gfx_ctx_wgl_bind_hw_render(void *data, bool enable) } } +#ifdef HAVE_VULKAN +static void *gfx_ctx_wgl_get_context_data(void *data) +{ + (void)data; + return &g_vk.context; +} +#endif + const gfx_ctx_driver_t gfx_ctx_wgl = { gfx_ctx_wgl_init, gfx_ctx_wgl_destroy, @@ -638,5 +649,10 @@ const gfx_ctx_driver_t gfx_ctx_wgl = { gfx_ctx_wgl_show_mouse, "wgl", gfx_ctx_wgl_bind_hw_render, +#ifdef HAVE_VULKAN + gfx_ctx_wgl_get_context_data, +#else + NULL, +#endif }; From c7b96b75b8ff371a2821fa86e562b0c4945795ad Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 29 Mar 2016 17:36:13 +0200 Subject: [PATCH 4/6] Vulkan: Add more error logging. --- gfx/common/vulkan_common.c | 33 ++++++++++++++++++++++++++++++++- gfx/drivers/vulkan.c | 9 +++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index cea1d2cfc4..d5d92bdca4 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -1255,7 +1255,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk, #endif if (!vulkan_library) + { + RARCH_ERR("[Vulkan]: Failed to open Vulkan loader.\n"); return false; + } RARCH_LOG("Vulkan dynamic library loaded.\n"); @@ -1300,19 +1303,31 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk, } if (!vulkan_load_instance_symbols(vk)) + { + RARCH_ERR("[Vulkan]: Failed to load instance symbols.\n"); return false; + } if (VKFUNC(vkEnumeratePhysicalDevices)(vk->context.instance, &gpu_count, NULL) != VK_SUCCESS) + { + RARCH_ERR("[Vulkan]: Failed to enumerate physical devices.\n"); return false; + } gpus = (VkPhysicalDevice*)calloc(gpu_count, sizeof(*gpus)); if (!gpus) + { + RARCH_ERR("[Vulkan]: Failed to enumerate physical devices.\n"); return false; + } if (VKFUNC(vkEnumeratePhysicalDevices)(vk->context.instance, &gpu_count, gpus) != VK_SUCCESS) + { + RARCH_ERR("[Vulkan]: Failed to enumerate physical devices.\n"); return false; + } if (gpu_count < 1) { @@ -1332,7 +1347,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk, &queue_count, NULL); if (queue_count < 1 || queue_count > 32) + { + RARCH_ERR("[Vulkan]: Invalid number of queues detected.\n"); return false; + } VKFUNC(vkGetPhysicalDeviceQueueFamilyProperties)(vk->context.gpu, &queue_count, queue_properties); @@ -1376,10 +1394,16 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk, } else if (VKFUNC(vkCreateDevice)(vk->context.gpu, &device_info, NULL, &vk->context.device) != VK_SUCCESS) + { + RARCH_ERR("[Vulkan]: Failed to create device.\n"); return false; + } if (!vulkan_load_device_symbols(vk)) + { + RARCH_ERR("[Vulkan]: Failed to load device symbols.\n"); return false; + } VKFUNC(vkGetDeviceQueue)(vk->context.device, vk->context.graphics_queue_index, 0, &vk->context.queue); @@ -1423,7 +1447,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk, vk->context.queue_lock = slock_new(); if (!vk->context.queue_lock) + { + RARCH_ERR("[Vulkan]: Failed to create queue lock.\n"); return false; + } return true; } @@ -1764,7 +1791,11 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; - VKFUNC(vkCreateSwapchainKHR)(vk->context.device, &info, NULL, &vk->swapchain); + if (VKFUNC(vkCreateSwapchainKHR)(vk->context.device, &info, NULL, &vk->swapchain) != VK_SUCCESS) + { + RARCH_ERR("[Vulkan]: Failed to create swapchain.\n"); + return false; + } if (old_swapchain != VK_NULL_HANDLE) VKFUNC(vkDestroySwapchainKHR)(vk->context.device, old_swapchain, NULL); diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 0ff5ff1fae..2c5ea78f62 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -927,7 +927,10 @@ static void *vulkan_init(const video_info_t *video, ctx_driver = vulkan_get_context(vk); if (!ctx_driver) + { + RARCH_ERR("[Vulkan]: Failed to get Vulkan context.\n"); goto error; + } gfx_ctx_ctl(GFX_CTL_SET, (void*)ctx_driver); @@ -954,7 +957,10 @@ static void *vulkan_init(const video_info_t *video, mode.height = win_height; mode.fullscreen = video->fullscreen; if (!gfx_ctx_ctl(GFX_CTL_SET_VIDEO_MODE, &mode)) + { + RARCH_ERR("[Vulkan]: Failed to set video mode.\n"); goto error; + } gfx_ctx_ctl(GFX_CTL_GET_VIDEO_SIZE, &mode); temp_width = mode.width; @@ -986,7 +992,10 @@ static void *vulkan_init(const video_info_t *video, vulkan_init_resources(vk); if (!vulkan_init_filter_chain(vk)) + { + RARCH_ERR("[Vulkan]: Failed to init filter chain.\n"); goto error; + } inp.input = input; inp.input_data = input_data; From e04bbfbae282acac2425adee159bd273d174f6e1 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 29 Mar 2016 17:57:13 +0200 Subject: [PATCH 5/6] Vulkan: Add more logging ... --- gfx/common/vulkan_common.c | 3 +++ gfx/drivers_context/wgl_ctx.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index d5d92bdca4..d22cc206df 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -1798,7 +1798,10 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, } if (old_swapchain != VK_NULL_HANDLE) + { + RARCH_LOG("[Vulkan]: Recycled old swapchain.\n"); VKFUNC(vkDestroySwapchainKHR)(vk->context.device, old_swapchain, NULL); + } vk->context.swapchain_width = swapchain_size.width; vk->context.swapchain_height = swapchain_size.height; diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index c298614237..d544c4bac9 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -511,7 +511,10 @@ static bool gfx_ctx_wgl_set_video_mode(void *data, bool fullscreen) { if (!win32_set_video_mode(NULL, width, height, fullscreen)) + { + RARCH_ERR("[WGL]: win32_set_video_mode failed.\n"); goto error; + } switch (g_api) { From 406f084c4bae0fd524541050b01930478ca9f730 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 29 Mar 2016 18:02:32 +0200 Subject: [PATCH 6/6] Vulkan: Set g_inited in Windows. --- gfx/drivers_context/wgl_ctx.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index d544c4bac9..7c588ebc81 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -248,6 +248,7 @@ void create_graphics_context(HWND hwnd, bool *quit) &instance, &hwnd, width, height, g_interval)) *quit = true; + g_inited = true; break; #endif }