mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
(WGL) Bind different callback for Vulkan
This commit is contained in:
parent
ea920b1aaf
commit
df73277ca8
@ -1133,6 +1133,70 @@ LRESULT CALLBACK WndProcWGL(HWND hwnd, UINT message,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VULKAN
|
||||
LRESULT CALLBACK WndProcVK(HWND hwnd, UINT message,
|
||||
WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
LRESULT ret;
|
||||
bool quit = false;
|
||||
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_MOUSEMOVE:
|
||||
case WM_POINTERDOWN:
|
||||
case WM_POINTERUP:
|
||||
case WM_POINTERUPDATE:
|
||||
case WM_DEVICECHANGE:
|
||||
case WM_MOUSEWHEEL:
|
||||
case WM_MOUSEHWHEEL:
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
#if _WIN32_WINNT >= 0x0500 /* 2K */
|
||||
if (g_win32->taskbar_message && message == g_win32->taskbar_message)
|
||||
taskbar_is_created = true;
|
||||
#endif
|
||||
#ifdef HAVE_DINPUT
|
||||
if (input_get_ptr() == &input_dinput)
|
||||
{
|
||||
void* input_data = input_get_data();
|
||||
if (input_data && dinput_handle_message(input_data,
|
||||
message, wparam, lparam))
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case WM_DROPFILES:
|
||||
case WM_SYSCOMMAND:
|
||||
case WM_CHAR:
|
||||
case WM_KEYDOWN:
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_CLOSE:
|
||||
case WM_DESTROY:
|
||||
case WM_QUIT:
|
||||
case WM_MOVE:
|
||||
case WM_SIZE:
|
||||
case WM_COMMAND:
|
||||
ret = wnd_proc_common(&quit, hwnd, message, wparam, lparam);
|
||||
if (quit)
|
||||
return ret;
|
||||
#if _WIN32_WINNT >= 0x0500 /* 2K */
|
||||
if (g_win32->taskbar_message && message == g_win32->taskbar_message)
|
||||
taskbar_is_created = true;
|
||||
#endif
|
||||
break;
|
||||
case WM_CREATE:
|
||||
create_vk_context(hwnd, &g_win32->quit);
|
||||
if (DragAcceptFiles_func)
|
||||
DragAcceptFiles_func(hwnd, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, message, wparam, lparam);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GDI
|
||||
LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
|
||||
WPARAM wparam, LPARAM lparam)
|
||||
|
@ -60,6 +60,8 @@ int win32_change_display_settings(const char *str, void *devmode_data,
|
||||
|
||||
void create_graphics_context(HWND hwnd, bool *quit);
|
||||
|
||||
void create_vk_context(HWND hwnd, bool *quit);
|
||||
|
||||
void create_gdi_context(HWND hwnd, bool *quit);
|
||||
|
||||
bool win32_get_video_output(DEVMODE *dm, int mode, size_t len);
|
||||
@ -124,11 +126,16 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message,
|
||||
WPARAM wparam, LPARAM lparam);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE) || defined(HAVE_VULKAN)
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE)
|
||||
LRESULT CALLBACK WndProcWGL(HWND hwnd, UINT message,
|
||||
WPARAM wparam, LPARAM lparam);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_VULKAN)
|
||||
LRESULT CALLBACK WndProcVK(HWND hwnd, UINT message,
|
||||
WPARAM wparam, LPARAM lparam);
|
||||
#endif
|
||||
|
||||
LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
|
||||
WPARAM wparam, LPARAM lparam);
|
||||
|
||||
|
@ -444,36 +444,35 @@ void create_graphics_context(HWND hwnd, bool *quit)
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GFX_CTX_VULKAN_API:
|
||||
{
|
||||
#ifdef HAVE_VULKAN
|
||||
RECT rect;
|
||||
HINSTANCE instance;
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
|
||||
GetClientRect(hwnd, &rect);
|
||||
|
||||
instance = GetModuleHandle(NULL);
|
||||
width = rect.right - rect.left;
|
||||
height = rect.bottom - rect.top;
|
||||
|
||||
if (!vulkan_surface_create(&win32_vk, VULKAN_WSI_WIN32,
|
||||
&instance, &hwnd,
|
||||
width, height, win32_interval))
|
||||
*quit = true;
|
||||
|
||||
g_win32_inited = true;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void create_vk_context(HWND hwnd, bool *quit)
|
||||
{
|
||||
#ifdef HAVE_VULKAN
|
||||
RECT rect;
|
||||
HINSTANCE instance;
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
|
||||
GetClientRect(hwnd, &rect);
|
||||
|
||||
instance = GetModuleHandle(NULL);
|
||||
width = rect.right - rect.left;
|
||||
height = rect.bottom - rect.top;
|
||||
|
||||
if (!vulkan_surface_create(&win32_vk, VULKAN_WSI_WIN32,
|
||||
&instance, &hwnd,
|
||||
width, height, win32_interval))
|
||||
*quit = true;
|
||||
|
||||
g_win32_inited = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_wgl_swap_interval(void *data, int interval)
|
||||
{
|
||||
(void)data;
|
||||
@ -743,7 +742,16 @@ static void *gfx_ctx_wgl_init(void *video_driver)
|
||||
win32_window_reset();
|
||||
win32_monitor_init();
|
||||
|
||||
wndclass.lpfnWndProc = WndProcWGL;
|
||||
switch (win32_api)
|
||||
{
|
||||
case GFX_CTX_VULKAN_API:
|
||||
wndclass.lpfnWndProc = WndProcVK;
|
||||
break;
|
||||
default:
|
||||
wndclass.lpfnWndProc = WndProcWGL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!win32_window_init(&wndclass, true, NULL))
|
||||
goto error;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user