Fail Vulkan surface creation if window has context

OpenGL / OpenGL ES cannot share presentation on a window with Vulkan.
This adds an error to `glfwCreateWindowSurface` when it is called on a
window without the GLFW_CLIENT_API hint set to GLFW_NO_API.  This
prevents undefined bahevior and hard to debug crashes.

Fixes #1194.
Closes #1205.
This commit is contained in:
Corentin Wallez
2018-01-30 13:25:17 -05:00
committed by Camilla Löwy
parent 525ad7bfb8
commit 8a8eefa0d8
4 changed files with 20 additions and 1 deletions

View File

@@ -230,6 +230,10 @@ if (err)
}
@endcode
If an OpenGL or OpenGL ES context was created on the window, the context has
ownership of the presentation on the window and a Vulkan surface cannot be
created.
It is your responsibility to destroy the surface. GLFW does not destroy it for
you. Call `vkDestroySurfaceKHR` function from the same extension to destroy it.