libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.99k stars 1.84k forks source link

Support Vulkan on Haiku #7798

Open kallisti5 opened 1 year ago

kallisti5 commented 1 year ago

Haiku has libvulkan and support for Vulkan. SDL should support Vulkan under Haiku :-)

Obviously a lot more is needed than this... but it gets the ball rolling.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5411cab74..432466296 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -434,7 +434,7 @@ set_option(SDL_WASAPI              "Use the Windows WASAPI audio driver" ${WINDO
 set_option(SDL_RENDER_D3D          "Enable the Direct3D render driver" ${WINDOWS})
 set_option(SDL_RENDER_METAL        "Enable the Metal render driver" ${APPLE})
 set_option(SDL_VIVANTE             "Use Vivante EGL video driver" ${UNIX_SYS})
-dep_option(SDL_VULKAN              "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
+dep_option(SDL_VULKAN              "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS OR HAIKU" OFF)
 set_option(SDL_METAL               "Enable Metal support" ${APPLE})
 set_option(SDL_KMSDRM              "Use KMS DRM video driver" ${UNIX_SYS})
 dep_option(SDL_KMSDRM_SHARED       "Dynamically load KMS DRM support" ON "SDL_KMSDRM" OFF)
@@ -2433,6 +2433,11 @@ elseif(HAIKU)
       list(APPEND SDL_EXTRA_LIBS GL)
       set(HAVE_OPENGL TRUE)
     endif()
+
+    if(SDL_VULKAN)
+      set(SDL_VIDEO_VULKAN 1)
+      set(HAVE_VULKAN TRUE)
+    endif()
   endif()

   if(SDL_FILESYSTEM)
slouken commented 1 year ago

Feel free to create a PR that has a more complete and tested implementation!

icculus commented 1 year ago

(To be clear, the Vulkan code that needs to be in SDL itself is extremely small...we just have a little code to help find the right platform-specific extensions and Vulkan itself does the rest outside of SDL.)

slouken commented 1 year ago

SDL 2.0 is now in maintenance mode, and all inactive issues are being closed. If this issue is impacting you, please feel free to reopen it with additional information.

icculus commented 1 year ago

Actually, let's keep this open as an SDL3 thing if nothing else; it doesn't need much code from SDL, I mostly just need to fill in the magic Haiku-specific extension names.