Commit Graph

142 Commits

Author SHA1 Message Date
SDL Wiki Bot
6429806dce Sync SDL3 wiki -> header 2024-05-22 19:47:56 +00:00
SDL Wiki Bot
983544a53e Sync SDL3 wiki -> header 2024-05-22 00:41:09 +00:00
Sam Lantinga
6f2621438a Renamed DECLSPEC to SDL_DECLSPEC 2024-05-17 17:09:09 -07:00
Ryan C. Gordon
253c917296
SDL_render.h: Remove unnecessary struct x; before typedef struct x x;. 2024-05-16 12:21:14 -04:00
Ryan C. Gordon
5e6d85b8f0
wikiheaders: bridge wiki Category docs to the headers!
Did an initial cleanup on the headers and wrote a few pieces of documentation,
but this needs more work to fill out the documentation.
2024-05-16 11:48:23 -04:00
SDL Wiki Bot
c6354252a1 Sync SDL3 wiki -> header 2024-05-15 21:33:30 +00:00
Susko3
e6345716e0 Fix typo 2024-05-15 14:32:11 -07:00
Susko3
968e8c9275 Prefix names with SDL_RENDERER_ 2024-05-15 14:32:11 -07:00
Susko3
8d7f91f8e4 Add defined constants for renderer vsync values 2024-05-15 14:32:11 -07:00
SDL Wiki Bot
c7087fea01 Sync SDL3 wiki -> header 2024-05-13 22:07:34 +00:00
Sam Lantinga
17520c2e6e Removed SDL_RendererFlags
The flags parameter has been removed from SDL_CreateRenderer() and SDL_RENDERER_PRESENTVSYNC has been replaced with SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER during window creation and SDL_PROP_RENDERER_VSYNC_NUMBER after renderer creation.

SDL_SetRenderVSync() now takes additional values besides 0 and 1.

The maximum texture size has been removed from SDL_RendererInfo, replaced with SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER.
2024-05-13 15:06:11 -07:00
SDL Wiki Bot
06d6f2cb25 Sync SDL3 wiki -> header 2024-05-13 16:09:32 +00:00
Sam Lantinga
fc62dfc6e2 Added properties for the swap chain in the direct3d11 and direct3d12 renderers
Fixes https://github.com/libsdl-org/SDL/issues/9775
2024-05-13 09:06:57 -07:00
Sam Lantinga
598b4e0a1f Removed the limit on the number of supported renderer texture formats
Fixes https://github.com/libsdl-org/SDL/issues/9056
2024-05-09 13:30:07 -07:00
Sam Lantinga
748490677c Use SDL_RendererFlags in the API (thanks @Sackzement!) 2024-05-07 13:41:12 -07:00
Sam Lantinga
aecb62e30d Improved API consistency for flag data types
Flag data types are always unsigned and have the valid values following the typedef.
2024-05-07 12:24:37 -07:00
Sam Lantinga
14f584a94b SDL_CreateWindowAndRenderer() takes the window title as the first parameter
Fixes https://github.com/libsdl-org/SDL/issues/9626
2024-04-25 20:00:14 -07:00
Frank Praznik
bede245395 Remove references to renderers being destroyed with windows in the documentation 2024-04-19 12:23:40 -04:00
Anonymous Maarten
7dd4f1ec22 SDL3 removed SDL_HINT_RENDER_SCALE_QUALITY hint
textures now default to linear filtering, use SDL_SetTextureScaleMode(texture, SDL_SCALEMODE_NEAREST) if you want nearest pixel mode instead
2024-04-17 16:38:15 -07:00
SDL Wiki Bot
202bd7b0ff Sync SDL3 wiki -> header 2024-04-13 13:24:25 +00:00
Ryan C. Gordon
f01b34fd8d
include: Removed some SDL2 references in the documentation. 2024-04-13 09:23:37 -04:00
Ryan C. Gordon
0df988389c
include: Add \since to all documentation that was missing it. 2024-04-11 13:34:29 -04:00
Ryan C. Gordon
e044318a8e
Sync SDL3 wiki -> headers 2024-04-09 00:50:03 -04:00
Ryan C. Gordon
ad090d2444
include: A ton of little documentation tweaks, fixes, and improvements.
This is just stuff I noticed while working on the wikiheaders updates. A
thorough pass over all the docs would not be terrible, and maybe a simple
script to check for consistency (does everything have a `\since` on it? etc)
might be nice, too.
2024-04-09 00:50:02 -04:00
Sam Lantinga
5fa87e29e7 Removed SDL_RENDERER_ACCELERATED and SDL_RENDERER_SOFTWARE
These flags are unnecessary and have always been a source of confusion.
2024-04-04 13:30:49 -07:00
Petar Popovic
3f8dba3713 Including SD_error.h into headers with error-returning functions 2024-04-04 11:12:58 -07:00
Sam Lantinga
a82ed82bc7 SDL_QueryTexture() fills in a pointer to SDL_PixelFormatEnum 2024-04-01 15:45:22 -07:00
Frank Praznik
5abcfad352 video: Document that renderer lifetimes are tied to their associated windows 2024-03-27 11:01:41 -07:00
Sam Lantinga
823ab13b9c SDL_CreateTexture() takes a SDL_PixelFormatEnum format parameter 2024-03-26 10:40:40 -07:00
Sam Lantinga
d8a54cd4f8 Updated "see also" references to be more consistent
Fixes https://github.com/libsdl-org/SDL/issues/9282
2024-03-17 12:28:11 -07:00
Sam Lantinga
3875ef4552 Removed duplicated line (thanks @sechshelme!)
Fixes https://github.com/libsdl-org/SDL/issues/9264
2024-03-13 13:47:32 -07:00
Susko3
ce44eff3d2 Use SDL_WindowFlags in public headers 2024-03-06 15:08:12 -08:00
Susko3
424616e032 Use SDL_PixelFormatEnum as type 2024-03-06 15:02:13 -08:00
Sylvain
cea717e5d3 Removed some uneeded 'unsigned': renderer.num_texture_format and SDL_Vulkan_GetInstanceExtensions() prototype 2024-03-05 13:31:28 -08:00
SDL Wiki Bot
ffef13e1e1 Sync SDL3 wiki -> header 2024-03-04 17:30:25 +00:00
Sam Lantinga
48471f7dbd Added SDL_AddVulkanRenderSemaphores() for external synchronization with SDL rendering 2024-03-04 09:29:36 -08:00
SDL Wiki Bot
7ff9be7398 Sync SDL3 wiki -> header 2024-03-01 01:39:28 +00:00
Sam Lantinga
0454e1fdb4 Vulkan: added support for wrapping existing textures 2024-02-29 17:38:10 -08:00
SDL Wiki Bot
68588b232c Sync SDL3 wiki -> header 2024-02-28 15:13:26 +00:00
Sam Lantinga
614630df69 Allow using an external Vulkan device with the vulkan renderer 2024-02-28 07:12:15 -08:00
SDL Wiki Bot
fbe7301aba Sync SDL3 wiki -> header 2024-02-25 23:55:23 +00: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
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
SDL Wiki Bot
2132ba8985 Sync SDL3 wiki -> header 2024-02-22 03:26:22 +00: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
Sam Lantinga
2f7c24e4be Removed SDL_HINT_RENDER_SCALE_QUALITY
Textures now default to linear filtering, use SDL_SetTextureScaleMode(texture, SDL_SCALEMODE_NEAREST) if you want nearest pixel mode instead.
2024-02-12 09:54:33 -08:00
Zack Middleton
5af7113842 Rename property define names to have a type suffix
Renamed the following property define names to have a type suffix to
match other property names.

SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET (number)
SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET (number)
SDL_PROP_WINDOW_CREATE_WAYLAND_SCALE_TO_DISPLAY (boolean)
SDL_PROP_WINDOW_RENDERER (pointer)
SDL_PROP_WINDOW_TEXTUREDATA (pointer)
2024-02-12 09:54:11 -08:00
SDL Wiki Bot
1ec0e22bcd Sync SDL3 wiki -> header 2024-02-10 00:38:20 +00:00
Sam Lantinga
1162097135 Added SDL_RenderViewportSet() to tell whether the viewport was previously set to a specific rectangle.
Fixes https://github.com/libsdl-org/SDL/issues/9029
2024-02-09 16:37:04 -08:00