Commit Graph

14703 Commits (fbe7301aba5d03332a428244ea572984000e747a)

Author SHA1 Message Date
SDL Wiki Bot fbe7301aba Sync SDL3 wiki -> header 2024-02-25 23:55:23 +00:00
Sam Lantinga e223e1d498 Added SDL_camera.h to the public Framework headers 2024-02-25 15:54:34 -08:00
Sam Lantinga be51b7acea Use the maximum potential headroom if EDR content isn't currently being displayed.
Also document that the HDR properties can change dynamically at runtime.
2024-02-25 15:54:34 -08:00
SDL Wiki Bot e0dadba6f5 Sync SDL3 wiki -> header 2024-02-25 22:26:23 +00:00
Anonymous Maarten e6d9251ecb docs: improve CMake documentation for Apple 2024-02-25 23:25:11 +01:00
Sam Lantinga 7a9c6c7ce9 Include SDL_PIXELFORMAT_P010 as a supported format for the metal renderer 2024-02-25 13:55:52 -08:00
Sam Lantinga d211da75ac Fixed crash if app delegate method is called when SDL isn't initialized 2024-02-25 13:38:47 -08:00
Sam Lantinga 9dbbf0a2f7 Implemented clip rect functionality for the Vulkan renderer 2024-02-25 10:13:59 -08:00
Sam Lantinga 141497b14f Added an automated test to verify clip rect functionality 2024-02-25 09:44:41 -08:00
Sam Lantinga d0af01e7d4 If the viewport changes the cliprect should be updated
The clip rectangle is defined to be viewport relative, so if the viewport changes we need to update it.

Fixes https://github.com/libsdl-org/SDL/issues/9094
2024-02-25 09:37:56 -08:00
Sam Lantinga 1cae52bbac Added JNI native methods to proguard-rules.pro (thanks @AntTheAlchemist!)
Fixes https://github.com/libsdl-org/SDL/issues/3563
2024-02-25 08:40:47 -08:00
David Gow b8a52c1237 Vulkan: Make sure validation layer name is in-scope
When enabling the Vulkan validation layers, the 'validationLayerName'
variable technically went out of scope before vkCreateInstance() was
called. While most compilers won't clean up stack variables after random
'if' statements, some will, particularly when optimisation or memory
sanitizers are enabled.

This can lead to vkCreateInstance() segfaulting when
SDL_HINT_RENDER_VULKAN_DEBUG is enabled.

Instead, make the validationLayerName visible throughout the entire
VULKAN_CreateDeviceResources() function.

While we're at it, extract the validation layer name out into a
preprocessor #define, so that we are definitely using the same name in
VULKAN_ValidationLayersFound().

Signed-off-by: David Gow <david@ingeniumdigital.com>
2024-02-25 08:24:43 -08:00
Sam Lantinga 276566235c Removed SDL_ClearHints() from the public API
Fixes https://github.com/libsdl-org/SDL/issues/9129
2024-02-24 21:07:50 -08:00
Sam Lantinga a1ea706215 Added names for the newly supported pixel formats 2024-02-24 20:13:59 -08:00
Sam Lantinga f6c42406cd SDL_COLORSPACE_HDR10 is the default colorspace for SDL_PIXELFORMAT_P010 surfaces 2024-02-24 20:04:36 -08:00
Sam Lantinga 4c5584174b Fixed error: declaration shadows a local variable [-Werror,-Wshadow] 2024-02-24 20:04:36 -08:00
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