mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 15:25:50 +00:00
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:
committed by
Camilla Löwy
parent
525ad7bfb8
commit
8a8eefa0d8
@@ -317,6 +317,13 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance,
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
|
||||
if (window->context.client != GLFW_NO_API)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE,
|
||||
"Vulkan: Window surface creation requires the window to have the client API set to GLFW_NO_API");
|
||||
return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
|
||||
}
|
||||
|
||||
return _glfwPlatformCreateWindowSurface(instance, window, allocator, surface);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user