Skip to content
Permalink
Browse files

vulkan: Initial Vulkan support!

This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.
  • Loading branch information
icculus committed Aug 28, 2017
1 parent 8e7998e commit 25e3a1ec90cbc08acbb1d33668ad71e6ca241e05
Showing with 5,456 additions and 80 deletions.
  1. +36 −0 CMakeLists.txt
  2. +1 −0 Makefile.in
  3. +40 −4 VisualC/SDL/SDL_VS2008.vcproj
  4. +11 −0 VisualC/SDL_VS2008.sln
  5. +355 −0 VisualC/tests/testvulkan/testvulkan_VS2008.vcproj
  6. +37 −0 Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
  7. +91 −15 Xcode/SDL/SDL.xcodeproj/project.pbxproj
  8. +19 −0 cmake/sdlchecks.cmake
  9. +106 −1 configure
  10. +66 −0 configure.in
  11. +1 −0 debian/control
  12. +9 −4 docs/README-ios.md
  13. +2 −2 docs/README-linux.md
  14. +13 −1 docs/README-macosx.md
  15. +45 −41 docs/README-windows.md
  16. +1 −0 include/SDL.h
  17. +3 −0 include/SDL_config.h.cmake
  18. +3 −0 include/SDL_config.h.in
  19. +8 −0 include/SDL_config_android.h
  20. +7 −0 include/SDL_config_iphoneos.h
  21. +8 −0 include/SDL_config_macosx.h
  22. +1 −0 include/SDL_config_windows.h
  23. +21 −7 include/SDL_video.h
  24. +251 −0 include/SDL_vulkan.h
  25. +1 −1 src/test/SDL_test_common.c
  26. +22 −0 src/video/SDL_sysvideo.h
  27. +158 −2 src/video/SDL_video.c
  28. +80 −0 src/video/SDL_vulkan_internal.h
  29. +191 −0 src/video/SDL_vulkan_utils.c
  30. +8 −0 src/video/android/SDL_androidvideo.c
  31. +174 −0 src/video/android/SDL_androidvulkan.c
  32. +52 −0 src/video/android/SDL_androidvulkan.h
  33. +61 −0 src/video/cocoa/SDL_cocoametalview.h
  34. +124 −0 src/video/cocoa/SDL_cocoametalview.m
  35. +9 −0 src/video/cocoa/SDL_cocoavideo.m
  36. +55 −0 src/video/cocoa/SDL_cocoavulkan.h
  37. +217 −0 src/video/cocoa/SDL_cocoavulkan.m
  38. +8 −0 src/video/mir/SDL_mirvideo.c
  39. +1 −0 src/video/mir/SDL_mirvideo.h
  40. +175 −0 src/video/mir/SDL_mirvulkan.c
  41. +52 −0 src/video/mir/SDL_mirvulkan.h
  42. +53 −0 src/video/uikit/SDL_uikitmetalview.h
  43. +146 −0 src/video/uikit/SDL_uikitmetalview.m
  44. +10 −0 src/video/uikit/SDL_uikitvideo.m
  45. +54 −0 src/video/uikit/SDL_uikitvulkan.h
  46. +221 −0 src/video/uikit/SDL_uikitvulkan.m
  47. +8 −0 src/video/wayland/SDL_waylandvideo.c
  48. +175 −0 src/video/wayland/SDL_waylandvulkan.c
  49. +52 −0 src/video/wayland/SDL_waylandvulkan.h
  50. +8 −0 src/video/windows/SDL_windowsvideo.c
  51. +176 −0 src/video/windows/SDL_windowsvulkan.c
  52. +52 −0 src/video/windows/SDL_windowsvulkan.h
  53. +12 −0 src/video/x11/SDL_x11video.c
  54. +7 −0 src/video/x11/SDL_x11video.h
  55. +239 −0 src/video/x11/SDL_x11vulkan.c
  56. +48 −0 src/video/x11/SDL_x11vulkan.h
  57. +4 −0 test/Makefile.in
  58. +454 −2 test/configure
  59. +19 −0 test/configure.in
  60. +1,195 −0 test/testvulkan.c
@@ -20,6 +20,7 @@ include(CheckLibraryExists)
include(CheckIncludeFiles)
include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CheckCCompilerFlag)
include(CheckTypeSize)
@@ -324,9 +325,14 @@ set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})
dep_option(VIDEO_VULKAN "Enable Vulkan surface creation" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS})
dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF)

if(VIDEO_VULKAN)
set(VULKAN_SDK $ENV{VULKAN_SDK} CACHE PATH "Location of Vulkan headers' grandparent, e.g. /foo when headers are in /foo/include/vulkan.")
endif()

# TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here
# The options below are for compatibility to configure's default behaviour.
set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library")
@@ -855,6 +861,22 @@ if(ANDROID)
find_library(OpenGLES2_LIBRARY GLESv2)
list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY})
endif()

CHECK_C_SOURCE_COMPILES("
#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
#error Vulkan doesn't work on this configuration
#endif
int main()
{
return 0;
}
" VULKAN_PASSED_ANDROID_CHECKS)
if(NOT VULKAN_PASSED_ANDROID_CHECKS)
set(VIDEO_VULKAN OFF)
message(STATUS "Vulkan doesn't work on this configuration")
else()
CheckVulkanHeaders()
endif()
endif()

CheckPTHREAD()
@@ -1020,6 +1042,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)

check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H)

CheckVulkanHeaders()
endif()

if(INPUT_TSLIB)
@@ -1278,6 +1301,8 @@ elseif(WINDOWS)
set(SDL_VIDEO_RENDER_OGL_ES2 1)
set(HAVE_VIDEO_OPENGLES TRUE)
endif()

CheckVulkanHeaders()
endif()

if(SDL_JOYSTICK)
@@ -1419,6 +1444,13 @@ elseif(APPLE)
endif()

# Actually load the frameworks at the end so we don't duplicate include.
if (VIDEO_VULKAN)
CheckVulkanHeaders()
if(HAVE_VULKAN_H)
find_library(QUARTZCORE QuartzCore)
list(APPEND EXTRA_LIBS ${QUARTZCORE})
endif()
endif()
if(SDL_FRAMEWORK_COREVIDEO)
find_library(COREVIDEO CoreVideo)
list(APPEND EXTRA_LIBS ${COREVIDEO})
@@ -1498,6 +1530,10 @@ elseif(HAIKU)
CheckPTHREAD()
endif()

if(VIDEO_VULKAN AND HAVE_VULKAN_H AND (NOT APPLE OR QUARTZCORE))
set(SDL_VIDEO_VULKAN_SURFACE 1)
endif()

# Dummies
# configure.in does it differently:
# if not have X
@@ -112,6 +112,7 @@ HDRS = \
SDL_types.h \
SDL_version.h \
SDL_video.h \
SDL_vulkan.h \
begin_code.h \
close_code.h

@@ -52,7 +52,7 @@
Name="VCCLCompilerTool"
Optimization="0"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="$(SolutionDir)/../include"
AdditionalIncludeDirectories=""$(SolutionDir)/../include";"$(VULKAN_SDK)/include""
AdditionalUsingDirectories=""
PreprocessorDefinitions="_DEBUG;_WINDOWS"
RuntimeLibrary="2"
@@ -135,7 +135,7 @@
Name="VCCLCompilerTool"
Optimization="0"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="$(SolutionDir)/../include"
AdditionalIncludeDirectories=""$(SolutionDir)/../include";"$(VULKAN_SDK)/include""
AdditionalUsingDirectories=""
PreprocessorDefinitions="_DEBUG;_WINDOWS"
RuntimeLibrary="2"
@@ -216,7 +216,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="$(SolutionDir)/../include"
AdditionalIncludeDirectories="&quot;$(SolutionDir)/../include&quot;;&quot;$(VULKAN_SDK)/include&quot;"
AdditionalUsingDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS"
RuntimeLibrary="2"
@@ -299,7 +299,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="$(SolutionDir)/../include"
AdditionalIncludeDirectories="&quot;$(SolutionDir)/../include&quot;;&quot;$(VULKAN_SDK)/include&quot;"
AdditionalUsingDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS"
RuntimeLibrary="2"
@@ -644,6 +644,10 @@
RelativePath="..\..\include\SDL_video.h"
>
</File>
<File
RelativePath="..\..\include\SDL_vulkan.h"
>
</File>
</Filter>
<File
RelativePath="..\..\src\events\blank_cursor.h"
@@ -877,6 +881,14 @@
RelativePath="..\..\src\SDL_dataqueue.h"
>
</File>
<File
RelativePath="..\..\src\SDL_dataqueue.c"
>
</File>
<File
RelativePath="..\..\src\SDL_dataqueue.h"
>
</File>
<File
RelativePath="..\..\src\haptic\windows\SDL_dinputhaptic.c"
>
@@ -1313,6 +1325,22 @@
RelativePath="..\..\src\audio\wasapi\SDL_wasapi.h"
>
</File>
<File
RelativePath="..\..\src\video\SDL_vulkan_internal.h"
>
</File>
<File
RelativePath="..\..\src\video\SDL_vulkan_utils.c"
>
</File>
<File
RelativePath="..\..\src\audio\wasapi\SDL_wasapi.c"
>
</File>
<File
RelativePath="..\..\src\audio\wasapi\SDL_wasapi.h"
>
</File>
<File
RelativePath="..\..\src\audio\SDL_wave.c"
>
@@ -1437,6 +1465,14 @@
RelativePath="..\..\src\video\windows\SDL_windowsvideo.h"
>
</File>
<File
RelativePath="..\..\src\video\windows\SDL_windowsvulkan.c"
>
</File>
<File
RelativePath="..\..\src\video\windows\SDL_windowsvulkan.h"
>
</File>
<File
RelativePath="..\..\src\video\windows\SDL_windowswindow.c"
>
@@ -48,6 +48,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "controllermap", "tests\cont
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D69D5741-611F-4E14-8541-1FEE94F50B5A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testvulkan", "tests\testvulkan\testvulkan_VS2008.vcproj", "{0D604DFD-AAB6-442C-9368-F91A344146AB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -240,6 +242,14 @@ Global
{55812185-D13C-4022-9C81-32E0F4A08306}.Release|Win32.Build.0 = Release|Win32
{55812185-D13C-4022-9C81-32E0F4A08306}.Release|x64.ActiveCfg = Release|x64
{55812185-D13C-4022-9C81-32E0F4A08306}.Release|x64.Build.0 = Release|x64
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Debug|Win32.ActiveCfg = Debug|Win32
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Debug|Win32.Build.0 = Debug|Win32
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Debug|x64.ActiveCfg = Debug|x64
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Debug|x64.Build.0 = Debug|x64
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|Win32.ActiveCfg = Release|Win32
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|Win32.Build.0 = Release|Win32
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|x64.ActiveCfg = Release|x64
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -265,5 +275,6 @@ Global
{E9558DFE-1961-4DD4-B09B-DD0EEFD5C315} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
{55812185-D13C-4022-9C81-32E0F4A08306} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
{26828762-C95D-4637-9CB1-7F0979523813} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
{0D604DFD-AAB6-442C-9368-F91A344146AB} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
EndGlobalSection
EndGlobal

0 comments on commit 25e3a1e

Please sign in to comment.