Commit Graph

8816 Commits

Author SHA1 Message Date
Sam Lantinga
dab77fe29b Added support for SDL_COLORSPACE_BT709_FULL to the hardware renderers 2024-02-04 13:09:40 -08:00
Omar Rashwan
67bbf20add Null check SDL_DBusContext pointer 2024-02-03 14:04:46 -08:00
Sam Lantinga
2ad4646a24 Don't release currentOffscreenRenderTargetView, we don't have a reference to it 2024-02-03 12:49:53 -08:00
Sam Lantinga
9005512c18 Fixed build 2024-02-03 12:39:52 -08:00
Sam Lantinga
7271a2040b Don't force on the D3D11 debug flag 2024-02-03 12:39:11 -08:00
Sam Lantinga
b4d0af9cf3 Removed unused variables 2024-02-03 12:39:11 -08:00
Sam Lantinga
200f87ea0b Only set the colorspace if it's not the default
This avoids property hash table allocation in most cases
2024-02-03 12:00:55 -08:00
Sam Lantinga
cb811ba463 Fixed warning C4366: The result of the unary '&' operator may be unaligned 2024-02-03 11:49:15 -08:00
Sam Lantinga
62221b3003 Fixed warning C4245: 'return': conversion from 'int' to 'SDL_TimerID', signed/unsigned mismatch 2024-02-03 11:49:15 -08:00
Sam Lantinga
4514aabb41 Fixed warning C4245: 'return': conversion from 'int' to 'Uint64', signed/unsigned mismatch 2024-02-03 11:49:15 -08:00
Sam Lantinga
f107393ed5 Fixed warning C4245: 'return': conversion from 'int' to 'unsigned int', signed/unsigned mismatch 2024-02-03 11:49:15 -08:00
Sam Lantinga
c3e821fa80 Optimized SDL_DuplicatePixels() 2024-02-03 11:49:15 -08:00
Sam Lantinga
89b9d6cbdc SDL_RenderReadPixels() now returns a surface
Fixes https://github.com/libsdl-org/SDL/issues/8977
2024-02-03 11:49:15 -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
Wohlstand
9e76f23561 SDL_windowsopengl.c: WGL: Fixed null-pointer dereference crash
Fixes #8968

Fixed crash after 594a79c2f9

(cherry picked from commit a29f37c14a)
2024-02-03 06:19:41 -08:00
Joshua Root
e0158f68e4 Fix SDL_mfijoystick build issues
Add missing guards around use of physicalInputProfile.

Add explicit import of Foundation which seems to be needed on some
systems to get the NSArray definition.

Add __unsafe_unretained to ObjC types in struct so the compiler doesn't
complain about that not being allowed with ARC.

Closes: #8979
2024-02-02 22:24:50 -08:00
Sam Lantinga
e67e0c5d55 vulkan_metal.h: Make compatible with ObjC ARC (thanks @jmroot!)
(re)Fixes #6598

We need to remember to apply this again once we update from upstream headers.
2024-02-02 18:29:59 -08:00
Sam Lantinga
ba86d9f235 When changing surface format, use the default colorspace for the new format 2024-02-02 17:56:33 -08:00
Sam Lantinga
5d48f9a63a Added SDL_CopyProperties() 2024-02-02 15:09:12 -08:00
Sam Lantinga
aa8f609ff3 Clamp HDR colors to the SDR range for SDR renderers 2024-02-02 13:13:53 -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
f6f9468d84 Fixed warning C4701: potentially uninitialized local variable 'srcpixel' used 2024-02-01 21:24:11 -08:00
Sam Lantinga
d383299779 Fixed build on older Windows SDK 2024-02-01 20:48:53 -08:00
Sam Lantinga
d04fea8b87 Even more miscellaneous gamepad buttons! 2024-02-01 20:34:05 -08:00
Sam Lantinga
cb70e972e3 Added miscellaneous gamepad buttons for additional macro buttons on some controllers 2024-02-01 20:15:01 -08:00
Sam Lantinga
dc607c666b Fixed creating HDR textures with SDL_CreateTexture() 2024-02-01 15:36:49 -08:00
Sam Lantinga
7561116873 Added support for floating point texture formats 2024-02-01 12:17:35 -08:00
Sam Lantinga
90597aeaef HDR10 colorspace isn't currently supported
You can't do blending directly in PQ space, which means you have to create a scene render target in linear space and use shaders to convert PQ texture data to linear, etc. All of this is out of scope for the SDL 2D renderer at the moment.
2024-02-01 12:17:35 -08:00
Sam Lantinga
19dde63e7c Added a simple linear scale for tonemapped HDR to SDR surface conversion 2024-02-01 12:17:35 -08:00
Sam Lantinga
fc35b7e121 Convert to sRGB if trying to create a texture from an HDR surface 2024-02-01 12:17:35 -08:00
Sam Lantinga
c1f3c81003 Make the color primary conversion code reusable
Also added conversion from rec709 to rec2020 primaries
2024-02-01 12:17:35 -08:00
Sam Lantinga
dd28ab0489 Added SDL_SetRenderDrawColorspace() and SDL_GetRenderDrawColorspace() 2024-02-01 12:17:35 -08:00
Sam Lantinga
9c8b47b726 Cache the draw color state in the software and PSP renderers
Converting the color from float is a bit expensive, so let's cache that state
2024-02-01 12:17:35 -08:00
Sam Lantinga
dacfaa91b4 Make sure to round color values when converting to Uint8 2024-02-01 12:17:35 -08:00
Ozkan Sezer
c00b6a8e20 SDL_kmsdrmvideo.c: clean-up includes, add clarifying note after 5ab879f 2024-02-01 11:04:10 +03:00
Sam Lantinga
6f443e2aca Added support for the scRGB colorspace on D3D11 and D3D12 2024-01-31 18:07:00 -08:00
Sam Lantinga
12c31898c1 Update colors in SDL_RenderGeometryRaw() if we're doing interpolation in linear space
Testing: Modified testgeometry to clear the background to 0.5 and then changed the triangle color to 0.5, and verified that they were the same color when using the D3D11 renderer.
2024-01-31 11:02:45 -08:00
Sam Lantinga
77549dc91e Fixed some places using SDL_SetRenderDrawColor() instead of SDL_SetRenderDrawColorFloat() 2024-01-31 11:02:45 -08:00
Sam Lantinga
4b3c530dd1 Fixed out of bounds access
This can happen if we try to blit from a surface with an unknown pixel format
2024-01-31 09:55:52 -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
Sam Lantinga
49cc4c14e9 Use the default colorspace if we have to convert texture pixels 2024-01-31 09:50:46 -08:00
Frank Praznik
482a27bc00 wayland: Throttle to 20hz if the frame callback never fires
Matches SDL2, and should be enough to keep most games from desyncing/timing out.

A proper fix for FIFO presentation without the frame callback mess is being worked on upstream, so this whole hack should be rendered obsolete in the near future.
2024-01-30 17:12:20 -05:00
Frank Praznik
9462eec57b pipewire: Don't assert if the default capture device is a sink or vice versa
When no source devices are connected, the default source string can contain a sink name. If the default source and sink match, it will be caught as a sink device first and handled correctly, but if the default sink/source don't match, which happens when the sink is an HDMI output and the source is still an onboard audio chipset output name, an assert can result since the requested source device won't be flagged as a capture device. Rather than asserting, simply don't assign default devices that don't match the correct capabilities, as it's not an uncommon scenario and can be handled gracefully.

Additionally, if asserting is a no-op in release mode, sinks can be returned as sources and vice versa, which is incorrect.
2024-01-30 13:32:22 -05: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
Francisco Javier Trujillo Mata
da8fc70a83 Fixing viewport 2024-01-29 20:41:25 -08:00
Francisco Javier Trujillo Mata
851c1a5e9c Fix scissor usage 2024-01-29 20:41:25 -08:00
Francisco Javier Trujillo Mata
dc35ee9d54 Fix color 2024-01-29 20:41:25 -08:00
Sam Lantinga
61b5c38e6e Added the initial concept of colorspace to SDL 2024-01-28 18:24:39 -08:00
Frank Praznik
fbf10afb31 wayland: Consolidate window creation logic
The fractional scale manager and viewport are both created for a surface under the same circumstances, so consolidate the logic.
2024-01-28 18:15:39 -05:00