Commit Graph

14882 Commits (442073f379efb70d80c01b990484cd60c34e314b)

Author SHA1 Message Date
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
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 61a3a163db Fixed typo (thanks @Akaricchi!) 2024-01-29 18:48:41 -08:00
SDL Wiki Bot 7fbd85ad5c Sync SDL3 wiki -> header 2024-01-29 02:25:21 +00:00
Sam Lantinga 61b5c38e6e Added the initial concept of colorspace to SDL 2024-01-28 18:24:39 -08:00
Xander a3bfd5329c Fix broken mingw i686 buildscript 2024-01-28 17:29:33 -08:00
Xander 59d7dd3615 Fix broken mingw x86_64 buildscript 2024-01-28 17:29:33 -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
Frank Praznik 2e96307b27 wayland: Always create a viewport for the surface, if possible
Toggling viewports on and off can cause visual anomalies such as flicker when moving windows between displays on a mixed-DPI configuration or toggling the scaled fullscreen modes. If the viewport protocol is avilable, always create a viewport for the surface, unless it is an unscaled external surface, in which case the surface should be left untouched as an application may wish to attach its own viewport or use integer scaling.

This allows for the removal of several helper functions as well.
2024-01-28 17:52:35 -05:00
Frank Praznik 94240c197d docs: Hint envvars needs to use the hint string, not the macro name 2024-01-28 15:12:03 -05:00
SDL Wiki Bot 00a8ca403e Sync SDL3 wiki -> header 2024-01-28 18:32:23 +00:00
Frank Praznik fbebbab90d wayland: Only set the explicit logical window size when using display scaling
Otherwise, the standard width/height is already in points/screen units.
2024-01-28 13:31:42 -05:00
Frank Praznik 879ba46ade wayland: Make sure the logical window size can't go to zero.
libdecor can send a size of zero as a valid value, the use of which will close the window. Make sure the minimum width/height are clamped to a minimum of 1.
2024-01-28 13:31:42 -05:00
Frank Praznik b97cda226f wayland: Refactor internal variable names for better readability
Add descriptions in the internal window struct as well.
2024-01-28 13:31:42 -05:00
Frank Praznik 344ec60f8f tests: Fix window centering test with Wayland display scaling mode
The usable fullscreen bounds need to be queried after window creation, as Wayland can send different usable bounds depending on the focused window's scaling mode.
2024-01-28 13:31:42 -05:00
Frank Praznik 5b8ca05f1a wayland: Add a forced screen space scaling mode
Add a mode that forces Wayland windows to output with scaling that forces 1:1 pixel mapping.

This is intended to allow legacy applications to be displayed without desktop scaling being applied, and may have issues with some display configurations, as this forces the window to behave in a way that Wayland desktops were not designed to accommodate (rounding errors can result from certain combinations of window/scale values, the window may be unusably small, jump in size at times, or appear to be larger than the desktop space, and cursor precision may be reduced).

Windows flagged as DPI-aware are not affected by this.

The automated video test suite passes with the hint turned on.
2024-01-28 13:31:42 -05:00
Sam Lantinga 9f7eb6c4c1 Fixed testautomation log callback calling convention 2024-01-27 22:44:13 -08:00
Sam Lantinga 12bdb2b4d0 Added the environment variable SDL_LOGGING to control default log output 2024-01-27 19:30:22 -08:00
Ryan C. Gordon dcd26a80e5 windows: Minor tweaks that makes Windows XP vidmodes work again.
(thanks @madebr!)

Fixes #8328.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ryan C. Gordon 6ca596cfc1 windows: Manage MapVirtualKey vs Windows XP.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ryan C. Gordon 1c5bc53738 windows: Manage WideCharToMultiByte vs Windows XP.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ryan C. Gordon 2144c2ac71 windows: Added WIN_IsWindowsXP, for extreme runtime compatibility checks.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ryan C. Gordon 56fa22c63b windows: OS version checks now cache results.
So these only have to talk to the Win32 API once per check, per process.
2024-01-27 20:15:08 -05:00
Sam Lantinga 4fba663368 Simplified the default log category logic
Now it's much clearer and easier to tweak the defaults
2024-01-27 15:45:38 -08:00
Sam Lantinga a7a98d8bbb Document that the default log priority is error, not critical 2024-01-27 15:45:38 -08:00
SDL Wiki Bot fd14a20a4b Sync SDL3 wiki -> header 2024-01-27 23:26:26 +00:00
Sam Lantinga 17768c51fc Revert "Sync SDL3 wiki -> header"
This reverts commit 5e96e410d6.
2024-01-27 15:25:29 -08:00
Ozkan Sezer 2a4db8c415 SDL_rwops.c (SDL_IsRegularFile): fix WinRT build failure due to S_ISREG
(cherry picked from commit fcd1c155ccec7ac57b77cbc8571a321a5954c2cb)
2024-01-28 02:22:00 +03:00
Charlie Volow 5ae2ffc127 document that text input is on by default
See:
https://discourse.libsdl.org/t/text-input-is-active-by-default-hampering-frame-rate/24396
https://discourse.libsdl.org/t/restoring-text-input-to-the-default-state/42690
2024-01-27 15:18:05 -08:00
SDL Wiki Bot 5e96e410d6 Sync SDL3 wiki -> header 2024-01-27 23:12:19 +00:00
Sam Lantinga f66fe7e221 Replaced SDL_GetJoystickCaps() with joystick properties
Fixes https://github.com/libsdl-org/SDL/issues/8927
2024-01-27 15:11:52 -08:00