Commit Graph

14666 Commits (0f973f3eb4c46af86cfef7be0126ecd7aeb83bc4)

Author SHA1 Message Date
SDL Wiki Bot ab571633d1 Sync SDL3 wiki -> header 2024-02-03 15:37:23 +00: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 a29f37c14abc2ae418e770353657e872a70d90b8)
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
SDL Wiki Bot 2819988f8b Sync SDL3 wiki -> header 2024-02-03 04:40:24 +00:00
Sam Lantinga a2c45f61bb Updated scRGB render colorspace documentation 2024-02-02 20:38:48 -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 f9c57e16b0 Don't test 10-bit pixel format conversion
We either need to explicitly test using the sRGB colorspace or update the tests for HDR10 color conversion. We'll just disable them for now, as these formats aren't commonly used in games.
2024-02-02 18:24:15 -08:00
Sam Lantinga b8fe96fa81 Fixed build warning 2024-02-02 18:24:05 -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 25fd5da1a7 Removed maxCLL and maxFALL properties, moved them to SDL_image for HDR image loading 2024-02-02 15:13:09 -08:00
SDL Wiki Bot 943ab983cb Sync SDL3 wiki -> header 2024-02-02 23:10:26 +00:00
Sam Lantinga 5d48f9a63a Added SDL_CopyProperties() 2024-02-02 15:09:12 -08:00
SDL Wiki Bot c007c7ed55 Sync SDL3 wiki -> header 2024-02-02 21:14:23 +00: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
Simon McVittie 7c089f4e57 testautomation_math: Fix misleading log output
These originally checked for expected ± EPSILON as logged, but since
commit 880c6939 they check for expected ± max_err, where max_err may
need to be greater than EPSILON for very large expected results like
the ones in exp_regularCases().

Also, EPSILON is so small that the default precision of the %f format
(6 decimal places) would never actually have shown its effect, so log
it in scientific notation instead.

Fixes: 880c6939 "testautomation_math: do relative comparison + more precise correct trigonometric values"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-02 07:44:04 -08:00
Simon McVittie b66dba2a9d test: Don't accept results that are much less than expected
While looking at the other tests in this file, I noticed that instead
of checking for a result in the range of expected ± FLT_EPSILON as I
would have expected, these tests would accept any result strictly less
than expected + FLT_EPSILON, for example a wrong result that is very
large and negative. This is presumably not what was intended, so add
the SDL_fabs() that I assume was meant to be here.

Fixes: 474c8d00 "testautomation: don't do float equality tests"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-02 07:44:04 -08:00
Anonymous Maarten f1f9e27128 testautomation_math: do relative comparison + more precise correct trigonometric values
If the magnitude of the expected result is small, then we can safely
assume that the actual calculated result matches it to 10 decimal
places.

However, if the magnitude is very large, as it is for some of our exp()
tests, then 10 decimal places represents an unrealistically high level
of precision, for example 24 decimal digits for the test that is
expected to return approximately 6.6e14. IEEE 754 floating point only
has a precision of about 16 decimal digits, causing test failure on
x86 compilers that use an i387 80-bit extended-precision register for
the result and therefore get a slightly different answer.

To avoid this, scale the required precision with the magnitude of the
expected result, so that we accept a maximum error of either 10 decimal
places or 1 part in 1e10, whichever is greater.

[smcv: Added longer commit message explaining why we need this]
(cherry picked from commit 880c69392ae10c726fc97f17b6e5e2173f70b62f)
2024-02-02 07:44:04 -08:00
Simon McVittie babca704e0 testautomation: Don't expect exp to yield exact floating point results
In the Steam Runtime 1 'scout' environment, when compiling for i386
using the default gcc-4.6, Exp(34.125) matches the desired value to the
precision shown in the log (6 decimal places) but is not an exact match
for the desired value.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-02 07:44:04 -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 d6a48e4958 Don't use the system iconv on Apple mobile platforms
Fixes https://github.com/libsdl-org/SDL/issues/8964
2024-02-01 15:53:27 -08:00
Sam Lantinga ea0853d23d Added an HDR gradient test to testcolorspace 2024-02-01 15:36:49 -08:00
Sam Lantinga dc607c666b Fixed creating HDR textures with SDL_CreateTexture() 2024-02-01 15:36:49 -08:00
SDL Wiki Bot dcfb069c75 Sync SDL3 wiki -> header 2024-02-01 20:18:29 +00: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 496ed01bdb Detect blending in HDR10 colorspace 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
SDL Wiki Bot a4969e393e Sync SDL3 wiki -> header 2024-02-01 02:08:27 +00: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
Sam Lantinga c1f97c8e07 Fixed testgeometry after color format change (thanks @sezero!) 2024-01-30 23:31:48 -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
Amun 4a759b340f Fixes in SDL_ColorSpace (SDL_pixels.h) 2024-01-30 11:16:53 -08: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
SDL Wiki Bot d15fb9e063 Sync SDL3 wiki -> header 2024-01-30 17:49:26 +00:00