mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
vulkan: SDL_Vulkan_GetInstanceExtensions should accept a NULL window.
Fixes Bugzilla #4235.
This commit is contained in:
parent
a003fa0a05
commit
a794126d56
@ -135,7 +135,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
|
|||||||
* \brief Get the names of the Vulkan instance extensions needed to create
|
* \brief Get the names of the Vulkan instance extensions needed to create
|
||||||
* a surface with \c SDL_Vulkan_CreateSurface().
|
* a surface with \c SDL_Vulkan_CreateSurface().
|
||||||
*
|
*
|
||||||
* \param [in] window Window for which the required Vulkan instance
|
* \param [in] \c NULL or window Window for which the required Vulkan instance
|
||||||
* extensions should be retrieved
|
* extensions should be retrieved
|
||||||
* \param [in,out] count pointer to an \c unsigned related to the number of
|
* \param [in,out] count pointer to an \c unsigned related to the number of
|
||||||
* required Vulkan instance extensions
|
* required Vulkan instance extensions
|
||||||
@ -153,6 +153,10 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
|
|||||||
* is smaller than the number of required extensions, \c SDL_FALSE will be
|
* is smaller than the number of required extensions, \c SDL_FALSE will be
|
||||||
* returned instead of \c SDL_TRUE, to indicate that not all the required
|
* returned instead of \c SDL_TRUE, to indicate that not all the required
|
||||||
* extensions were returned.
|
* extensions were returned.
|
||||||
|
*
|
||||||
|
* \note If \c window is not NULL, it will be checked against its creation
|
||||||
|
* flags to ensure that the Vulkan flag is present. This parameter
|
||||||
|
* will be removed in a future major release.
|
||||||
*
|
*
|
||||||
* \note The returned list of extensions will contain \c VK_KHR_surface
|
* \note The returned list of extensions will contain \c VK_KHR_surface
|
||||||
* and zero or more platform specific extensions
|
* and zero or more platform specific extensions
|
||||||
@ -160,12 +164,13 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
|
|||||||
* \note The extension names queried here must be enabled when calling
|
* \note The extension names queried here must be enabled when calling
|
||||||
* VkCreateInstance, otherwise surface creation will fail.
|
* VkCreateInstance, otherwise surface creation will fail.
|
||||||
*
|
*
|
||||||
* \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag.
|
* \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag
|
||||||
|
* or be \c NULL
|
||||||
*
|
*
|
||||||
* \code
|
* \code
|
||||||
* unsigned int count;
|
* unsigned int count;
|
||||||
* // get count of required extensions
|
* // get count of required extensions
|
||||||
* if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL))
|
* if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL))
|
||||||
* handle_error();
|
* handle_error();
|
||||||
*
|
*
|
||||||
* static const char *const additionalExtensions[] =
|
* static const char *const additionalExtensions[] =
|
||||||
@ -179,7 +184,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
|
|||||||
* handle_error();
|
* handle_error();
|
||||||
*
|
*
|
||||||
* // get names of required extensions
|
* // get names of required extensions
|
||||||
* if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names))
|
* if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names))
|
||||||
* handle_error();
|
* handle_error();
|
||||||
*
|
*
|
||||||
* // copy additional extensions after required extensions
|
* // copy additional extensions after required extensions
|
||||||
|
@ -4103,11 +4103,14 @@ void SDL_Vulkan_UnloadLibrary(void)
|
|||||||
|
|
||||||
SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names)
|
SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names)
|
||||||
{
|
{
|
||||||
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
|
if (window) {
|
||||||
|
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
|
||||||
|
|
||||||
if (!(window->flags & SDL_WINDOW_VULKAN)) {
|
if (!(window->flags & SDL_WINDOW_VULKAN))
|
||||||
SDL_SetError(NOT_A_VULKAN_WINDOW);
|
{
|
||||||
return SDL_FALSE;
|
SDL_SetError(NOT_A_VULKAN_WINDOW);
|
||||||
|
return SDL_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!count) {
|
if (!count) {
|
||||||
|
@ -255,7 +255,7 @@ static void createInstance(void)
|
|||||||
appInfo.apiVersion = VK_API_VERSION_1_0;
|
appInfo.apiVersion = VK_API_VERSION_1_0;
|
||||||
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
instanceCreateInfo.pApplicationInfo = &appInfo;
|
instanceCreateInfo.pApplicationInfo = &appInfo;
|
||||||
if(!SDL_Vulkan_GetInstanceExtensions(state->windows[0], &extensionCount, NULL))
|
if(!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, NULL))
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"SDL_Vulkan_GetInstanceExtensions(): %s\n",
|
"SDL_Vulkan_GetInstanceExtensions(): %s\n",
|
||||||
@ -268,7 +268,7 @@ static void createInstance(void)
|
|||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
if(!SDL_Vulkan_GetInstanceExtensions(state->windows[0], &extensionCount, extensions))
|
if(!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, extensions))
|
||||||
{
|
{
|
||||||
SDL_free((void*)extensions);
|
SDL_free((void*)extensions);
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
Loading…
Reference in New Issue
Block a user