Commit Graph

14887 Commits (495e432fb9776fdc13a8d96179136064ccddf6e5)

Author SHA1 Message Date
Sam Lantinga 2b0e7c40ef Verify that we can create pipeline state objects for the D3D12 renderer
Fixes https://github.com/libsdl-org/SDL/issues/9093
2024-02-24 19:55:10 -08:00
Anonymous Maarten 5593ddb6a7 cmake: X11 is for Video, not Audio 2024-02-24 17:31:48 +01:00
scribam 38d24778ed ci: update deprecated node.js 16 actions 2024-02-23 21:53:40 +01:00
scribam cbe330befd ci: bump cross-platform-actions/action version to v0.23.0 2024-02-23 23:20:14 +03:00
danginsburg 97372b56e8 Vulkan Renderer - handle dynamic resetting of vsync, requires swapchain recreation. 2024-02-23 08:42:04 -08:00
danginsburg b1431e6702 Vulkan Renderer - implement support for vsync disabled. Closes #9116. 2024-02-23 08:42:04 -08:00
Sam Lantinga b9a00aa88e Fixed building the Vulkan renderer on Windows with Visual Studio 2024-02-22 17:18:46 -08:00
SDL Wiki Bot dfd8073a8f Sync SDL3 wiki -> header 2024-02-22 22:59:24 +00:00
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
Sam Lantinga 2f1f55aeb1 Updated default SDR white point and HDR headroom to better match game content 2024-02-22 14:51:23 -08:00
Sam Lantinga 1fb5b9672e Keep SDR white point and HDR headroom defaults in one place 2024-02-22 14:47:58 -08:00
Sam Lantinga aeae202207 Make sure we actually have an HDR10 texture in the HDR10 shader
Some content uses the PQ transfer function but different color primaries
2024-02-22 11:50:58 -08:00
Sam Lantinga f4dd0dbbde Added colorspace conversion from SDL_COLOR_PRIMARIES_SMPTE431 and SDL_COLOR_PRIMARIES_SMPTE432 to SDL_COLOR_PRIMARIES_BT2020 2024-02-22 11:01:03 -08:00
Sam Lantinga d3930893aa KMSDRM is now a dependent option 2024-02-22 06:25:33 -08:00
Anonymous Maarten 7b1127d1fe cmake: Apple did not test SDL_CAMERA before adding camera support 2024-02-22 07:18:22 -05:00
Anonymous Maarten e176626bac cmake: only enable SDL drivers when its subsystem is enabled 2024-02-22 07:18:22 -05:00
Anonymous Maarten 99cef7e13b cmake: check SDL subsystem dependencies (and include Camera) 2024-02-22 07:18:22 -05:00
Anonymous Maarten 9a44d44cee cmake: build Windows mediafoundation SDL_camera support 2024-02-22 07:18:22 -05:00
Anonymous Maarten 279a650fae mediafoundation: fix SDL_camera_mediafoundation MinGW compile warnings 2024-02-22 07:18:22 -05:00
Sam Lantinga 78ac14124c Fixed warning C4245: 'function': conversion from 'int' to 'DWORD', signed/unsigned mismatch 2024-02-21 22:21:06 -08:00
SDL Wiki Bot 2132ba8985 Sync SDL3 wiki -> header 2024-02-22 03:26:22 +00:00
Sam Lantinga 0f973f3eb4 Removed SDL_RENDERCMD_SETCOLORSCALE, which ended up being a noop on all renderers 2024-02-21 19:25:49 -08:00
Sam Lantinga 54c2ba6afd Added the Chrome HDR tonemap operator
Also added support for the SDL_PIXELFORMAT_XBGR2101010 pixel format to the D3D12, D3D11, and Metal renderers.
2024-02-21 19:25:49 -08:00
Sam Lantinga 4ba6aeee9d A second take on HDR support with an SDR white point and HDR headroom
This better reflects how HDR content is actually used, e.g. most content is in the SDR range, with specular highlights and bright details beyond the SDR range, in the HDR headroom.

This more closely matches how HDR is handled on Apple platforms, as EDR.

This also greatly simplifies application code which no longer has to think about color scaling. SDR content is rendered at the appropriate brightness automatically, and HDR content is scaled to the correct range for the display HDR headroom.
2024-02-21 19:25:49 -08:00
Ozkan Sezer 3b7533f4a2 SDL_camera_v4l2: allow building against older kernel headers 2024-02-22 00:50:40 +03:00
Anonymous Maarten 58e6eacf97 docs: SDL_INIT_EVERYTHING does not exist anymore 2024-02-21 00:52:04 +01:00
Anonymous Maarten 7eca84d57e cmake: don't use target_compile_features when the CMake thinks the compiler does not support it
This happens when using an older CMake with a new LLVM toolchain (e.g. Android ndk)
2024-02-21 00:51:40 +01:00
Anonymous Maarten cbf0b1ce81 testcamera: create window and renderer through test library 2024-02-21 00:49:15 +01:00
Anonymous Maarten ecfbb6719f SDL_test: support SDL_INIT_CAMERA for SDL_CommonInit and SDL_CommonQuit 2024-02-21 00:49:15 +01:00
Ryan C. Gordon 26ffbe43c2
camera: turn OFF `DEBUG_CAMERA` debug logging. 2024-02-20 16:09:02 -05:00
SDL Wiki Bot 31fe061ab5 Sync SDL3 wiki -> header 2024-02-20 20:57:27 +00:00
Ryan C. Gordon f59c66a97f testcamera: Allow app to flip between a front and back camera. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 6296677bc9 camera: Fixed Android hotplug. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 6c080717f2 camera: Reset permissions to undecided when closing camera.
Otherwise, the permission-granted event will not fire when reopened.
2024-02-20 15:56:26 -05:00
Ryan C. Gordon db8caa029b camera: Added new function with gendynapi.py. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 70b89ab70d camera: Added SDL_GetCameraDevicePosition.
Otherwise, as a property, you have to open each camera device to figure out
which ones are which.
2024-02-20 15:56:26 -05:00
Ryan C. Gordon b1ed49772c camera: Replace testcamera.c with testcameraminimal.c 2024-02-20 15:56:26 -05:00
Ryan C. Gordon bdcddf4810 camera: Disconnected cameras become zombies that feed blank frames. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 2613e3da24 camera: Rewrote Android support.
This does something a little weird, in that it doesn't care what
`__ANDROID_API__` is set to, but will attempt to dlopen the system
libraries, like we do for many other platform-specific pieces of SDL.

This allows us to a) not bump the minimum required Android version, which is
extremely ancient but otherwise still working, doing the right thing on old
and new hardware in the field, and b) not require the app to link against
more libraries than it previously did before the feature was available.

The downside is that it's a little messy, but it's okay for now, I think.
2024-02-20 15:56:26 -05:00
Ryan C. Gordon 848dcf8a5f main: Fixed compiler warning on Android.
(the NDK got upset about a function with void params using a bare `()`.)
2024-02-20 15:56:26 -05:00
Ryan C. Gordon 47313bba32 camera: SDL_GetCameraDevices should not report "no devices" like an error. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon f3485a47b3 android: Add src/main/ files to Android.mk 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 8db2a3b27a camera: Add an optional property that reports if a camera is back or front.
This is useful for iOS and Android, so an app can find the camera it cares
about in the list of devices.
2024-02-20 15:56:26 -05:00
Ryan C. Gordon 0b8617f71d test: Fixed CMake to build testcameraminimal correctly on WinRT. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 99d1337de2 camera: Reenabled macOS/iOS support, with rewritten CoreMedia implementation. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon f8fa08d2b1 camera: Fix compiler warnings on some platforms. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 22dbc0f32f camera: Patched to compile after rebasing to latest in main. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 7191a97fe3 camera: Windows support, through the Media Foundation API! 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 3dca8a03da camera: Removed some debug logging. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 67708f9110 camera: Emscripten support!
This also adds code to deal with waiting for the user to approve camera
access, reworks testcameraminimal to use main callbacks, etc.
2024-02-20 15:56:26 -05:00