summaryrefslogtreecommitdiff
path: root/Source/3rdParty/SDL2/src/video/SDL_vulkan_utils.c
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-19 23:06:27 +0800
committerchai <chaifix@163.com>2019-03-19 23:06:27 +0800
commit1497dccd63a84b7ee2b229b1ad9c5c02718f2a78 (patch)
treef8d1bff50da13e126d08c7345653e002e293202d /Source/3rdParty/SDL2/src/video/SDL_vulkan_utils.c
parent5e2a973516e0729b225da9de0b03015dc5854ac4 (diff)
*rename
Diffstat (limited to 'Source/3rdParty/SDL2/src/video/SDL_vulkan_utils.c')
-rw-r--r--Source/3rdParty/SDL2/src/video/SDL_vulkan_utils.c172
1 files changed, 0 insertions, 172 deletions
diff --git a/Source/3rdParty/SDL2/src/video/SDL_vulkan_utils.c b/Source/3rdParty/SDL2/src/video/SDL_vulkan_utils.c
deleted file mode 100644
index 1b242f1..0000000
--- a/Source/3rdParty/SDL2/src/video/SDL_vulkan_utils.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../SDL_internal.h"
-
-#include "SDL_vulkan_internal.h"
-#include "SDL_error.h"
-
-#if SDL_VIDEO_VULKAN
-
-const char *SDL_Vulkan_GetResultString(VkResult result)
-{
- switch((int)result)
- {
- case VK_SUCCESS:
- return "VK_SUCCESS";
- case VK_NOT_READY:
- return "VK_NOT_READY";
- case VK_TIMEOUT:
- return "VK_TIMEOUT";
- case VK_EVENT_SET:
- return "VK_EVENT_SET";
- case VK_EVENT_RESET:
- return "VK_EVENT_RESET";
- case VK_INCOMPLETE:
- return "VK_INCOMPLETE";
- case VK_ERROR_OUT_OF_HOST_MEMORY:
- return "VK_ERROR_OUT_OF_HOST_MEMORY";
- case VK_ERROR_OUT_OF_DEVICE_MEMORY:
- return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
- case VK_ERROR_INITIALIZATION_FAILED:
- return "VK_ERROR_INITIALIZATION_FAILED";
- case VK_ERROR_DEVICE_LOST:
- return "VK_ERROR_DEVICE_LOST";
- case VK_ERROR_MEMORY_MAP_FAILED:
- return "VK_ERROR_MEMORY_MAP_FAILED";
- case VK_ERROR_LAYER_NOT_PRESENT:
- return "VK_ERROR_LAYER_NOT_PRESENT";
- case VK_ERROR_EXTENSION_NOT_PRESENT:
- return "VK_ERROR_EXTENSION_NOT_PRESENT";
- case VK_ERROR_FEATURE_NOT_PRESENT:
- return "VK_ERROR_FEATURE_NOT_PRESENT";
- case VK_ERROR_INCOMPATIBLE_DRIVER:
- return "VK_ERROR_INCOMPATIBLE_DRIVER";
- case VK_ERROR_TOO_MANY_OBJECTS:
- return "VK_ERROR_TOO_MANY_OBJECTS";
- case VK_ERROR_FORMAT_NOT_SUPPORTED:
- return "VK_ERROR_FORMAT_NOT_SUPPORTED";
- case VK_ERROR_FRAGMENTED_POOL:
- return "VK_ERROR_FRAGMENTED_POOL";
- case VK_ERROR_SURFACE_LOST_KHR:
- return "VK_ERROR_SURFACE_LOST_KHR";
- case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
- return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
- case VK_SUBOPTIMAL_KHR:
- return "VK_SUBOPTIMAL_KHR";
- case VK_ERROR_OUT_OF_DATE_KHR:
- return "VK_ERROR_OUT_OF_DATE_KHR";
- case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
- return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
- case VK_ERROR_VALIDATION_FAILED_EXT:
- return "VK_ERROR_VALIDATION_FAILED_EXT";
- case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
- return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
- case VK_ERROR_INVALID_SHADER_NV:
- return "VK_ERROR_INVALID_SHADER_NV";
- case VK_RESULT_MAX_ENUM:
- case VK_RESULT_RANGE_SIZE:
- break;
- }
- if(result < 0)
- return "VK_ERROR_<Unknown>";
- return "VK_<Unknown>";
-}
-
-VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
- PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties,
- Uint32 *extensionCount)
-{
- Uint32 count = 0;
- VkResult result = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL);
- VkExtensionProperties *retval;
- if(result == VK_ERROR_INCOMPATIBLE_DRIVER)
- {
- /* Avoid the ERR_MAX_STRLEN limit by passing part of the message
- * as a string argument.
- */
- SDL_SetError(
- "You probably don't have a working Vulkan driver installed. %s %s %s(%d)",
- "Getting Vulkan extensions failed:",
- "vkEnumerateInstanceExtensionProperties returned",
- SDL_Vulkan_GetResultString(result),
- (int)result);
- return NULL;
- }
- else if(result != VK_SUCCESS)
- {
- SDL_SetError(
- "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned "
- "%s(%d)",
- SDL_Vulkan_GetResultString(result),
- (int)result);
- return NULL;
- }
- if(count == 0)
- {
- retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null
- }
- else
- {
- retval = SDL_calloc(count, sizeof(VkExtensionProperties));
- }
- if(!retval)
- {
- SDL_OutOfMemory();
- return NULL;
- }
- result = vkEnumerateInstanceExtensionProperties(NULL, &count, retval);
- if(result != VK_SUCCESS)
- {
- SDL_SetError(
- "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned "
- "%s(%d)",
- SDL_Vulkan_GetResultString(result),
- (int)result);
- SDL_free(retval);
- return NULL;
- }
- *extensionCount = count;
- return retval;
-}
-
-SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
- const char **userNames,
- unsigned nameCount,
- const char *const *names)
-{
- if (userNames) {
- unsigned i;
-
- if (*userCount < nameCount) {
- SDL_SetError("Output array for SDL_Vulkan_GetInstanceExtensions needs to be at least %d big", nameCount);
- return SDL_FALSE;
- }
- for (i = 0; i < nameCount; i++) {
- userNames[i] = names[i];
- }
- }
- *userCount = nameCount;
- return SDL_TRUE;
-}
-
-#endif
-
-/* vi: set ts=4 sw=4 expandtab: */