Commit Graph

37 Commits (614630df69c111402291beb955671a2fd6892288)

Author SHA1 Message Date
Sam Lantinga 220340e944 Remove SDL_PIXELFORMAT_P010
It's not supported by any renderer or pixel conversion path
2024-02-27 12:48:33 -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
Sam Lantinga cacac6cc34 Updated structure and field names for consistency
Type names are camel case and field names are snake case except for fields ending in id, which are capitalized.

Fixes https://github.com/libsdl-org/SDL/issues/6955
2024-02-11 08:27:56 -08:00
Sam Lantinga e74171b1ae Added support for HDR10 video playback on direct3d11
Fixes https://github.com/libsdl-org/SDL/issues/8053
2024-02-05 09:45:39 -08:00
Sam Lantinga 327b976bc4 SDL_COLORSPACE_JPEG is the default YUV colorspace 2024-02-04 13:09:40 -08:00
Sam Lantinga 50a805cdd1 Use YUV colorspaces instead of a global YUV conversion mode
Fixes https://github.com/libsdl-org/SDL/issues/8669
2024-02-03 07:36:18 -08:00
Sam Lantinga 9591b2cfb4 Finalized the SDL render API colorspaces
The renderer will always use the sRGB colorspace for drawing, and will default to the sRGB output colorspace. If you want blending in linear space and HDR support, you can select the scRGB output colorspace, which is supported by the direct3d11 and direct3d12
2024-02-02 13:13:53 -08:00
Sam Lantinga 3c45544a14 Added a slow blit function to handle large pixel formats and colorspace conversion 2024-01-31 09:50:46 -08:00
Amun 4a759b340f Fixes in SDL_ColorSpace (SDL_pixels.h) 2024-01-30 11:16:53 -08:00
Sam Lantinga f257eb4481 Added the concept of colorspace to the SDL renderer
This allows color operations to happen in linear space between sRGB input and sRGB output. This is currently supported on the direct3d11, direct3d12 and opengl renderers.

This is a good resource on blending in linear space vs sRGB space:
https://blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/

Also added testcolorspace to verify colorspace changes
2024-01-30 09:48:02 -08:00
Sam Lantinga 554f0625d3 Renderer colors now have floating point precision 2024-01-30 09:48:02 -08:00
Sam Lantinga 61a3a163db Fixed typo (thanks @Akaricchi!) 2024-01-29 18:48:41 -08:00
Sam Lantinga 61b5c38e6e Added the initial concept of colorspace to SDL 2024-01-28 18:24:39 -08:00
Sam Lantinga aeac8774f7 Missed one 2024-01-25 16:53:19 -08:00
Sam Lantinga d0dd60c8ba Updated new pixel format names to be more consistent with the others 2024-01-25 16:51:22 -08:00
Sam Lantinga 0f78aa7c30 Add some high bit-depth pixel formats
These are not fully supported yet, just preparing for future work.
2024-01-25 16:40:46 -08:00
Sam Lantinga 5b3ee51c6c Updated copyright for 2024 2024-01-01 13:15:26 -08:00
Sam Lantinga 30a2291d59 Fixed compatibility with sdl2-compat (thanks @sezero!) 2023-11-20 08:46:12 -08:00
Cameron Cawley 753bbd199e Add SDL_PIXELFORMAT_INDEX2LSB and SDL_PIXELFORMAT_INDEX2MSB 2023-11-17 08:45:32 -08:00
Ryan C. Gordon c53843a961
docs: Remove Doxygen `\brief` tags.
Doxygen and the wiki bridge don't need them; they'll both just use the first
line/sentence instead.

Fixes #8446.
2023-11-06 10:26:06 -05:00
Sam Lantinga f7d40b7594 Added 10-bit pixel formats in addition to SDL_PIXELFORMAT_ARGB2101010
Added SDL_PIXELFORMAT_XRGB2101010, SDL_PIXELFORMAT_XBGR2101010, SDL_PIXELFORMAT_ABGR2101010

Fixes https://github.com/libsdl-org/SDL/issues/3553
2023-11-06 00:41:09 -08:00
Simon McVittie 3698630bbc pixels: Document the naming convention
Whenever I have to fix something endianness-related, I always get
confused about whether the byte-oriented format that guarantees to put
red in byte 0 is RGBA8888 or RGBA32. (The answer is that it's RGBA32.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-10-10 03:24:43 -07:00
Sam Lantinga a2d594269c Fixed pixel format compatibility with SDL2 2023-08-07 22:45:21 -07:00
Starbuck5 666f81bace Add more endian-specific aliases for 32 bit pixelformats
Add these for all the RGBX variants, just like all the RGBA variants already have.
2023-07-25 23:35:42 -07:00
Sam Lantinga e264bb5178 Rename SDL_PIXELFORMAT_RGB888 and SDL_PIXELFORMAT_BGR888 to SDL_PIXELFORMAT_XRGB8888 and SDL_PIXELFORMAT_XBGR8888 for clarity
Fixes https://github.com/libsdl-org/SDL/issues/7903
2023-07-01 17:58:34 -07:00
Sam Lantinga 0f4679102c Fixed pedantic warning: comma at end of enumerator list
Fixes https://github.com/libsdl-org/SDL/issues/7878
2023-06-27 21:52:33 -07:00
Anonymous Maarten 549cedfa88 include: add \brief to includes 2023-02-19 10:01:33 -08:00
Sylvain 49e47b523a Update `\returns` to the generic form 2023-02-12 08:21:02 -08:00
Sylvain e2e5e670bf Remove returns int from Destroy/Close/Unlock functions 2023-02-09 07:57:14 -08:00
Sylvain c5c94a6be6 Change return type from void to int, for functions that set an error
(SDL_SetError(), SDL_OutOfMemory(), SDL_Unsupported(), SDL_InvalidParam())

Update prototype to forward errors to generic layer, for the functions:
MoveCursor, WarpMouse, GL_DeleteContext, GetDisplayModes.

Check invalid parameter in SDL_SetTextInputRect() generic layer.
2023-02-07 13:51:45 -08:00
Sam Lantinga fde78d12f2 Updated copyright for 2023 2023-01-09 09:41:41 -08:00
Sam Lantinga 083e436a1a SDL API renaming: SDL_pixels.h
Fixes https://github.com/libsdl-org/SDL/issues/6886
2022-12-27 06:08:31 -08:00
Sam Lantinga 63724c113b Removed the vi format comments from the source
Vim users can use the [editorconfig plugin](https://github.com/editorconfig/editorconfig-vim) to automatically set tab spacing for the SDL coding style.

Fixes https://github.com/libsdl-org/SDL/issues/6903
2022-12-26 11:17:23 -08:00
Ryan C. Gordon 3197632347
include: Renamed begin_code.h and close_code.h to have SDL_ prefixes.
Fixes #6864.
2022-12-22 11:39:26 -05:00
Sylvain Becker 932f61348d
Remove mask versions of SDL_CreateRGBSurface* #6701 (#6711)
* Rename SDL_CreateRGBSurface{,From} to SDL_CreateSurface{,From}, which now takes a format parameter
2022-12-01 08:04:02 -08:00
Sam Lantinga a08f517069 Removed unused SDL_ArrayOrder enumeration values
Fixes https://github.com/libsdl-org/SDL/issues/6658
2022-11-28 09:08:16 -08:00
Sam Lantinga 0a48abc860 Switch header convention from `#include "SDL.h"` to `#include <SDL3/SDLh>`
I ran this script in the include directory:
```sh
sed -i '' -e 's,#include "\(SDL.*\)",#include <SDL3/\1>,' *.h
```

I ran this script in the src directory:
```sh
for i in ../include/SDL3/SDL*.h
do hdr=$(basename $i)
   if [ x"$(echo $hdr | egrep 'SDL_main|SDL_name|SDL_test|SDL_syswm|SDL_opengl|SDL_egl|SDL_vulkan')" != x ]; then
        find . -type f -exec sed -i '' -e 's,#include "\('$hdr'\)",#include <SDL3/\1>,' {} \;
    else
        find . -type f -exec sed -i '' -e '/#include "'$hdr'"/d' {} \;
    fi
done
```

Fixes https://github.com/libsdl-org/SDL/issues/6575
2022-11-26 22:15:18 -08:00