Vulkan: Implement get_context_data callback in Win32.

Also fix some potential crashes with dinput handling.
This commit is contained in:
Hans-Kristian Arntzen 2016-03-29 13:27:45 +02:00
parent 8ade7fb274
commit 02736963bc
2 changed files with 20 additions and 4 deletions

View File

@ -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);
}

View File

@ -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
};