16221 Commits

Author SHA1 Message Date
Frank Praznik
186fec2560 pipewire: Consolidate registry enumeration instances
The preferred Pipewire path requires both devices being available, and that a sufficiently recent underlying core version is running on the host system. These criteria were being checked separately, which required two separate instances of enumerating the Pipewire registry, which is a fairly heavy operation. Move the version info callback to the main hotplug thread to avoid enumerating the registry twice, and check for both the version and required devices at the same time on the preferred path.
2024-07-11 14:14:15 -04:00
Ozkan Sezer
f437fe75f2 SDL_dynapi_overrides.h: remove left-over SDL_DestroyPixelFormat entry. 2024-07-11 18:56:40 +03:00
Sam Lantinga
875c4f0a4c Support indexed surfaces without palettes (thanks @sulix!)
Currently, all SDL_Surfaces with an indexed pixel format have an
associated SDL_Palette. This palette either consists of entirely the
colour black, or -- in the special case of 1-bit surfaces, black and
white.

When an indexed surface is blitted to another indexed surface, a 'map'
is generated from the source surface's palette to the destination
surfaces palette, in order to preserve the look of the image if the
palettes differ.

However, in most cases, applications will want to blit the raw index
values, rather than translate to make the colours as similar as
possible. For instance, the destination surface's palette may have been
modified to fade the screen out.

This change allows an indexed surface to have no associated palette. If
either the source or destination surface of a blit do not have a
palette, then the raw indices are copied (assuming both have an indexed
format).

This mimics better what happens with most other APIs (such as
DirectDraw), where most users do not set a palette on any surface but
the screen, whose palette is implicitly used for the whole application.
2024-07-11 08:31:32 -07:00
Anonymous Maarten
83d4251540 hidapi: netbsd's iconv expects a 'char ** restrict src' 2024-07-11 08:12:42 -07:00
Anonymous Maarten
131108ee48 Remove references to SDL_CreatePixelFormat and SDL_DestroyPixelFormat 2024-07-11 08:12:42 -07:00
Anonymous Maarten
9ecc531970 ci: bump NetBSD and FreeBSD 2024-07-11 08:12:42 -07:00
David Gow
540a356199 test: Add testspritesurface
This is a cut-down version of testsprite which uses SDL_Surface (and
SDL_GetWindowSurface), instead of the Render API. It's useful for
quickly validating that blitting works, including some basic format
conversion (with a palette).

Signed-off-by: David Gow <david@ingeniumdigital.com>
2024-07-11 08:11:29 -07:00
Anonymous Maarten
b5a7b1ca89 ci: force PDB and runtime variables 2024-07-11 13:58:13 +02:00
Sam Lantinga
0b2c80557c Update the blit mapping when the palette is set on a surface
Make sure you do this even if the palette pointer hasn't changed, as the contents may have.

Fixes https://github.com/libsdl-org/SDL/issues/10225
2024-07-10 23:22:06 -07:00
Giovanni Petrantoni
a16ff651e8
Set Fixed Scale Factor for VisionOS (#10222) 2024-07-10 21:56:50 -07:00
Sam Lantinga
9e331d235f Fixed the return value of SDL_Vulkan_CreateSurface() on the Vivante platform 2024-07-10 20:32:47 -07:00
Sam Lantinga
5ee88d43f9 Fixed mapping the non-US hash key on European keyboards 2024-07-10 20:13:40 -07:00
Sam Lantinga
8722c297a4 Added a key name for the non-US backslash key 2024-07-10 19:16:04 -07:00
Anonymous Maarten
628e083e02 ci: Build SDL3 with libusb support on MSVC 2024-07-10 23:42:39 +02:00
Substring
9548bba63a KMSDRM: fix unsupported modifiers 2024-07-10 14:41:58 -07:00
Sam Lantinga
d5e6116f8e Initialize and shutdown clipboard listener on iOS 2024-07-10 14:10:45 -07:00
Sam Lantinga
60ed914c66 Added notes for migrating SDL_GetRGBA()/SDL_MapRGBA() code 2024-07-10 13:19:46 -07:00
Ryan C. Gordon
af2dbf3ff3 video: Rename SDL_GL_DeleteContext to SDL_GL_DestroyContext.
Turns out that there isn't a strong OpenGL naming convention for "Delete" ...
WGL offers "wglDeleteContext" but the GLX equivalent is "glxDestroyContext"
and then EGL sealed the deal by going with Destroy as well! Since it matches
SDL3 naming conventions (Create/Destroy), we're renaming it.

Fixes #10197.
2024-07-10 15:54:08 -04:00
SDL Wiki Bot
29b0076659 Sync SDL3 wiki -> header 2024-07-10 19:45:01 +00:00
Ryan C. Gordon
4755055bc3 audio: Separate channel maps out of SDL_AudioSpec. 2024-07-10 15:43:57 -04:00
Anonymous Maarten
1664ac4fcb hidapi: fix 'conversion from 'size_t' to 'int', possible loss of data' of libusb functions 2024-07-10 20:27:39 +02:00
Anonymous Maarten
d1eab18de2 cmake: build ci and and release with static runtime library
(The Visual Studio projects do this as well)
2024-07-10 19:47:27 +02:00
Sam Lantinga
21aba2b19c Don't try to use D3D11 or D3D12 if the window isn't backed with an HWND
Fixes https://github.com/libsdl-org/SDL/issues/10196
2024-07-10 09:42:36 -07:00
Anonymous Maarten
001c1b29df cmake: remove SDL_STATIC_VCRT option
projects are expected to use CMAKE_MSVC_RUNTIME_LIBRARY to select the
runtime library.

With current CMake versions, this can be done with:

 -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=xxx

with xxx one of:
 "MultiThreaded"         -> -MT (static non-debug)
 "MultiThreadedDLL"      -> -MD (shared non-debug)
 "MultiThreadeDebug"     -> -MTd (static debug)
 "MultiThreadedDebugDLL" -> -MDd (shared debug)

See CMake documentation for more information:
https://cmake.org/cmake/help/latest/policy/CMP0091.html
https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
2024-07-10 18:34:34 +02:00
David Gow
1857f57686 Remove incorrect asserts from SDL_InitPixelFormatDetails()
The SDL_Surface rework in #10201 adds some extra checks that the pixel
format enum matches the SDL_PixelFormatDetails struct, which is largely
filled in with values from SDL_GetMasksForPixelFormat().

However, there are a few cases where these do not match:
- Indexed 1-, 2-, and 4-bit formats encode a bytes_per_pixel of 0, but
  SDL_GetMasksForPixelFormat() gives a value of 1.
- Packed formats, like SDL_PIXELFORMAT_XRGB8888 encode a bits_per_pixel
  of the number of used bits (24), but SDL_GetMasksForPixelFormat()
  includes the padding byte, giving a total of 32.

We could change the encoding of these in the enum, or change what we store
in the details struct to match, but I suspect we'd either break something
that relies on it, or lose some (_maybe_ useful) information. In the meantime,
this gets the tests working again.

Signed-off-by: David Gow <david@ingeniumdigital.com>
2024-07-10 09:26:46 -07:00
Frank Praznik
3b60ee666e
wayland: Note that setting the damage region in the frame callback is explicitly to work around a driver bug 2024-07-10 10:46:39 -04:00
SDL Wiki Bot
fdc04708f1 Sync SDL3 wiki -> header 2024-07-10 07:48:48 +00:00
Sam Lantinga
2ba76dbe80 Simplified SDL_Surface
SDL_Surface has been simplified and internal details are no longer in the public structure.

The `format` member of SDL_Surface is now an enumerated pixel format value. You can get the full details of the pixel format by calling `SDL_GetPixelFormatDetails(surface->format)`. You can get the palette associated with the surface by calling SDL_GetSurfacePalette(). You can get the clip rectangle by calling SDL_GetSurfaceClipRect().

SDL_PixelFormat has been renamed SDL_PixelFormatDetails and just describes the pixel format, it does not include a palette for indexed pixel types.

SDL_PixelFormatEnum has been renamed SDL_PixelFormat and is used instead of Uint32 for API functions that refer to pixel format by enumerated value.

SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB(), and SDL_GetRGBA() take an optional palette parameter for indexed color lookups.
2024-07-10 00:48:18 -07:00
Brick
40ed098ce8 Improve the bucket distribution of SDL_HashTable
SDL_HashID does no hashing, which isn't good if the lower bits of the key aren't evenly distributed.
2024-07-09 20:50:26 +01:00
Brick
d604555142 Replace BlitRGBtoRGBSurfaceAlphaMMX 2024-07-08 20:59:42 +01:00
Brick
d37f8fa2b3 Optimize BlitRGBtoRGBSurfaceAlpha 2024-07-08 20:59:42 +01:00
Brick
fde2378ccd Refactor alpha blitters, move the SSE41/AVX2 versions into SDL_blit_A.c 2024-07-08 20:59:42 +01:00
Brick
43a5da358d Set ALLOWABLE_ERROR_BLENDED to 0 2024-07-08 20:59:42 +01:00
Anonymous Maarten
1cddc7b66e sdlprocdump: exceptions are not handled 2024-07-08 21:30:49 +02:00
Anonymous Maarten
c4cbbca185 sdlprocdump: ignore C++ exceptions 2024-07-08 20:48:33 +02:00
Sam Lantinga
d6c8485f28 Make sure we're actually running on Windows before using D3D renderers 2024-07-08 11:36:11 -07:00
Sam Lantinga
4d5f139f0f Add the blit automation tests 2024-07-08 10:58:48 -07:00
Brick
c457dbb629 Fix BlitNtoNPixelAlpha for formats with no dst alpha 2024-07-08 10:53:46 -07:00
Brick
3c59d3f69c Remove old references to blitter files 2024-07-08 10:53:46 -07:00
Brick
95b683ac3e Tidy up/optimize BlitNtoNPixelAlpha_SSE4_1 2024-07-08 10:53:46 -07:00
Brick
070e48f66e Tidy up/optimize BlitNtoNPixelAlpha_AVX2 2024-07-08 10:53:46 -07:00
Brick
5d875aa94e Fix rounding in MULT_DIV_255 2024-07-08 10:53:46 -07:00
Isaac Aronson
b7b513b70b Fix bytes_per_pixel rename 2024-07-08 10:53:46 -07:00
Isaac Aronson
44d397282d Re-enable intrinsic blitters 2024-07-08 10:53:46 -07:00
Isaac Aronson
b34faf732d Implement fast 255 mult-div in SDL_blit_auto 2024-07-08 10:53:46 -07:00
Isaac Aronson
23d4e9ec13 Support VisualC-WinRT UWP build 2024-07-08 10:53:46 -07:00
Isaac Aronson
8d099d8976 Fix formatting 2024-07-08 10:53:46 -07:00
Isaac Aronson
8e3afd56f5 Restore BlitARGB 555 and 565 blending algorithms 2024-07-08 10:53:46 -07:00
Isaac Aronson
5cec91e27a Implement accurate, performant 32-bit scalar blitter for ARGB dst case 2024-07-08 10:53:46 -07:00
Isaac Aronson
e5bbe32641 Implement alpha blend as macro and replace inaccurate blitters 2024-07-08 10:53:46 -07:00