VulkanTutorial
VulkanTutorial copied to clipboard
Pass the correct HINSTANCE for window creation
The HINSTANCE for a window is the HINSTANCE of the module (dll or exe) that contains the window procedure for that window.
The previous code returned the HINSTANCE for the .exe, but the window is created by GLFW. We should therefore pass the HINSTANCE for glfw3. Even better, since we have a HWND, we can just ask the HWND for what it thinks it's HINSTANCE should be.
That said, I don't think many drivers care in practice.
LONG_PTR cannot be assigned to HINSTANCE so a reinterpret_cast is needed:
createInfo.hinstance = reinterpret_cast<HINSTANCE>(GetWindowLongPtr(createInfo.hwnd, GWLP_HINSTANCE));
@HildarTheDorf If you make the change suggested by @ZaOniRinku I will merge this PR.