SDL_vulkan_internal.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #ifndef SDL_vulkan_internal_h_
  19. #define SDL_vulkan_internal_h_
  20. #include "../SDL_internal.h"
  21. #include "SDL_stdinc.h"
  22. #if defined(SDL_LOADSO_DISABLED)
  23. #undef SDL_VIDEO_VULKAN
  24. #define SDL_VIDEO_VULKAN 0
  25. #endif
  26. #if SDL_VIDEO_VULKAN
  27. #if SDL_VIDEO_DRIVER_ANDROID
  28. #define VK_USE_PLATFORM_ANDROID_KHR
  29. #endif
  30. #if SDL_VIDEO_DRIVER_COCOA
  31. #define VK_USE_PLATFORM_MACOS_MVK
  32. #endif
  33. #if SDL_VIDEO_DRIVER_UIKIT
  34. #define VK_USE_PLATFORM_IOS_MVK
  35. #endif
  36. #if SDL_VIDEO_DRIVER_WAYLAND
  37. #define VK_USE_PLATFORM_WAYLAND_KHR
  38. #include "wayland/SDL_waylanddyn.h"
  39. #endif
  40. #if SDL_VIDEO_DRIVER_WINDOWS
  41. #define VK_USE_PLATFORM_WIN32_KHR
  42. #include "../core/windows/SDL_windows.h"
  43. #endif
  44. #if SDL_VIDEO_DRIVER_X11
  45. #define VK_USE_PLATFORM_XLIB_KHR
  46. #define VK_USE_PLATFORM_XCB_KHR
  47. #endif
  48. #define VK_NO_PROTOTYPES
  49. #include "./khronos/vulkan/vulkan.h"
  50. #include "SDL_vulkan.h"
  51. extern const char *SDL_Vulkan_GetResultString(VkResult result);
  52. extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
  53. PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties,
  54. Uint32 *extensionCount); /* free returned list with SDL_free */
  55. /* Implements functionality of SDL_Vulkan_GetInstanceExtensions for a list of
  56. * names passed in nameCount and names. */
  57. extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
  58. const char **userNames,
  59. unsigned nameCount,
  60. const char *const *names);
  61. /* Create a surface directly from a display connected to a physical device
  62. * using the DisplayKHR extension.
  63. * This needs to be passed an instance that was created with the VK_KHR_DISPLAY_EXTENSION_NAME
  64. * exension. */
  65. extern SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr,
  66. VkInstance instance,
  67. VkSurfaceKHR *surface);
  68. #else
  69. /* No SDL Vulkan support, just include the header for typedefs */
  70. #include "SDL_vulkan.h"
  71. typedef void (*PFN_vkGetInstanceProcAddr) (void);
  72. typedef int (*PFN_vkEnumerateInstanceExtensionProperties) (void);
  73. #endif /* SDL_VIDEO_VULKAN */
  74. #endif /* SDL_vulkan_internal_h_ */
  75. /* vi: set ts=4 sw=4 expandtab: */