Go to file
Dan Ginsburg cab20117e6
Vulkan Renderer (#9114)
This pull request adds an implementation of a Vulkan Render backend to SDL.  I have so far tested this primarily on Windows, but also smoke tested on Linux and macOS (MoltenVK).  I have not tried it yet on Android, but it should be usable there as well (sans any bugs I missed).  This began as a port of the SDL Direct3D12 Renderer, which is the closest thing to Vulkan as existed in the SDL codebase. The shaders are more or less identical (with the only differences being in descriptor bindings vs root descriptors).  The shaders are built using the HLSL frontend of glslang.

Everything in the code is pure Vulkan 1.0 (no extensions), with the exception of HDR support which requires the Vulkan instance extension `VK_EXT_swapchain_colorspace`.  The code could have been simplified considerably if I used dynamic rendering, push descriptors, extended dynamic state, and other modern Vulkan-isms, but I felt it was more important to make the code as vanilla Vulkan as possible so that it would run on any Vulkan implementation.

The main differences with the Direct3D12 renderer are:
* Having to manage renderpasses for performing clears.  There is likely some optimization that would still remain for more efficient use of TBDR hardware where there might be some unnecessary load/stores, but it does attempt to do clears using renderpasses.
* Constant buffer data couldn't be directly updated in the command buffer since I didn't want to rely on push descriptors, so there is a persistently mapped buffer with increasing offset per swapchain image where CB data gets written.
* Many more resources are dependent on the swapchain resizing due to i.e. Vulkan requiring the VkFramebuffer to reference the VkImageView of the swapchain, so there is a bit more code around handling that than was necessary in D3D12.
* For NV12/NV21 textures, rather than there being plane data in the texture itself, the UV data is placed in a separate `VkImage`/`VkImageView`.

I've verified that `testcolorspace` works with both sRGB and HDR linear.  I've tested `testoverlay` works with the various YUV/NV12/NV21 formats.  I've tested `testsprite`.  I've checked that window resizing and swapchain out-of-date handling when minimizing are working.  I've run through `testautomation` with the render tests.  I also have run several of the tests with Vulkan validation and synchronization validation.  Surely I will have missed some things, but I think it's in a good state to be merged and build out from here.
2024-02-22 14:58:11 -08:00
.github ci: bump actions version tag 2024-01-26 02:33:20 +01:00
VisualC camera: Windows support, through the Media Foundation API! 2024-02-20 15:56:26 -05:00
VisualC-GDK camera: Add sources to Xcode and Visual Studio projects. 2024-02-20 15:56:26 -05:00
VisualC-WinRT camera: Add sources to Xcode and Visual Studio projects. 2024-02-20 15:56:26 -05:00
Xcode camera: Windows support, through the Media Foundation API! 2024-02-20 15:56:26 -05:00
android-project camera: Rewrote Android support. 2024-02-20 15:56:26 -05:00
build-scripts Renamed SDL_HINT_PS2_DYNAMIC_VSYNC SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC 2024-02-12 09:54:33 -08:00
cmake Vulkan Renderer (#9114) 2024-02-22 14:58:11 -08:00
docs docs: SDL_INIT_EVERYTHING does not exist anymore 2024-02-21 00:52:04 +01:00
include Vulkan Renderer (#9114) 2024-02-22 14:58:11 -08:00
mingw/pkg-support/cmake build: don't add SDL3 subfolder to include path for external projects 2022-11-27 14:33:13 -08:00
src Vulkan Renderer (#9114) 2024-02-22 14:58:11 -08:00
test A second take on HDR support with an SDR white point and HDR headroom 2024-02-21 19:25:49 -08:00
wayland-protocols wayland: Use the preferred order of displays exposed by KDE 2024-01-27 02:10:49 -05:00
.clang-format Commented out syntax that causes Visual Studio 2019 to complain on every edit 2022-12-02 00:43:01 -08:00
.clang-tidy Fix size of memcpy in SDL_AudioDeviceFormatChangedAlreadyLocked 2023-08-05 14:14:45 -04:00
.editorconfig Fixed formatting for Haiku cc files 2023-01-25 03:03:41 -08:00
.gitignore Make Xbox GDK code public (and fix some GDK code rot) (#8844) 2024-01-14 20:31:41 -08:00
.wikiheaders-options sdlwiki: SDL3 advises users to include through 'SDL3/SDL.h' 2023-03-21 02:19:19 +01:00
Android.mk camera: Rewrote Android support. 2024-02-20 15:56:26 -05:00
BUGS.txt Cleaned up a few more Bugzilla mentions. 2021-02-12 14:46:49 -05:00
CMakeLists.txt Vulkan Renderer (#9114) 2024-02-22 14:58:11 -08:00
CREDITS.md docs: Moved CREDITS and INSTALL to markdown format. 2023-11-29 12:31:27 -05:00
INSTALL.md docs: Moved CREDITS and INSTALL to markdown format. 2023-11-29 12:31:27 -05:00
LICENSE.txt Updated copyright for 2024 2024-01-01 13:15:26 -08:00
README-SDL.txt More HTTPS changes in the documentation. 2017-02-16 16:52:03 -05:00
README.md docs: Convert everything to Unix-style endlines. 2023-11-29 11:29:57 -05:00
WhatsNew.txt Added the environment variable SDL_LOGGING to control default log output 2024-01-27 19:30:22 -08:00

README.md

Simple DirectMedia Layer (SDL) Version 3.0

https://www.libsdl.org/

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

More extensive documentation is available in the docs directory, starting with README.md. If you are migrating to SDL 3.0 from SDL 2.0, the changes are extensively documented in README-migration.md.

Enjoy!

Sam Lantinga (slouken@libsdl.org)