SDL_vulkan_internal.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2021 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_DIRECTFB
  34. #define VK_USE_PLATFORM_DIRECTFB_EXT
  35. #endif
  36. #if SDL_VIDEO_DRIVER_UIKIT
  37. #define VK_USE_PLATFORM_IOS_MVK
  38. #endif
  39. #if SDL_VIDEO_DRIVER_WAYLAND
  40. #define VK_USE_PLATFORM_WAYLAND_KHR
  41. #include "wayland/SDL_waylanddyn.h"
  42. #endif
  43. #if SDL_VIDEO_DRIVER_WINDOWS
  44. #define VK_USE_PLATFORM_WIN32_KHR
  45. #include "../core/windows/SDL_windows.h"
  46. #endif
  47. #if SDL_VIDEO_DRIVER_X11
  48. #define VK_USE_PLATFORM_XLIB_KHR
  49. #define VK_USE_PLATFORM_XCB_KHR
  50. #endif
  51. #define VK_NO_PROTOTYPES
  52. #include "./khronos/vulkan/vulkan.h"
  53. #include "SDL_vulkan.h"
  54. extern const char *SDL_Vulkan_GetResultString(VkResult result);
  55. extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
  56. PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties,
  57. Uint32 *extensionCount); /* free returned list with SDL_free */
  58. /* Implements functionality of SDL_Vulkan_GetInstanceExtensions for a list of
  59. * names passed in nameCount and names. */
  60. extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
  61. const char **userNames,
  62. unsigned nameCount,
  63. const char *const *names);
  64. /* Create a surface directly from a display connected to a physical device
  65. * using the DisplayKHR extension.
  66. * This needs to be passed an instance that was created with the VK_KHR_DISPLAY_EXTENSION_NAME
  67. * exension. */
  68. extern SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr,
  69. VkInstance instance,
  70. VkSurfaceKHR *surface);
  71. #else
  72. /* No SDL Vulkan support, just include the header for typedefs */
  73. #include "SDL_vulkan.h"
  74. typedef void (*PFN_vkGetInstanceProcAddr) (void);
  75. typedef int (*PFN_vkEnumerateInstanceExtensionProperties) (void);
  76. #endif /* SDL_VIDEO_VULKAN */
  77. #endif /* SDL_vulkan_internal_h_ */
  78. /* vi: set ts=4 sw=4 expandtab: */