Commit Graph

143 Commits (b322d27f6297e881c08732e3c3951e8f8d077425)

Author SHA1 Message Date
Sam Lantinga fcb132b8e8 Allow building testffmpeg without Vulkan support 2024-03-08 16:45:27 -08:00
Sam Lantinga dbec2150d0 testffmpeg: added support for Vulkan rendering 2024-03-04 09:29:36 -08:00
Anonymous Maarten 0a961915dc cmake: testffmpeg requires link to EGL library for EGL feature 2024-02-27 12:28:06 +01:00
Ryan C. Gordon b1ed49772c camera: Replace testcamera.c with testcameraminimal.c 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 0b8617f71d test: Fixed CMake to build testcameraminimal correctly on WinRT. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 7ae955ce68 camera: Renamed everything from "video capture" to "camera", wired to CMake. 2024-02-20 15:56:26 -05:00
Sam Lantinga f6b92c9b88 Re-added a simplified version of SDL_SetWindowShape()
In order to handle mouse click transparency this needs to be implemented inside SDL
2024-02-09 16:04:46 -08:00
Sam Lantinga 2039c46d2c Added support for creating an SDL texture from a CVPixelBufferRef 2024-02-06 15:40:47 -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
Frank Praznik 4f3d4bd110 wayland: Add the ability to import and wrap external surfaces
Add the ability to import and wrap external surfaces from external toolkits such as Qt and GTK.

Wayland surfaces and windows are more intrinsically tied to the client library than other windowing systems, so it is necessary to provide a way to initialize SDL with an existing wl_display object, which needs to be set prior to video system initialization, or export the internal SDL wl_display object for use by external applications or toolkits. For this, the global property SDL_PROPERTY_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER is used.

A Wayland example was added to testnative, and a basic example of Qt 6 interoperation is provided in the Wayland readme to demonstrate the use of external windows with both SDL owning the wl_display, and an external toolkit owning it.
2024-01-15 13:54:35 -05:00
Frank Praznik f7dd0f9491 wayland: Allow the creation of roleless window surfaces for custom application use
Allow for the creation of SDL windows with a roleless surface that applications can use for their own purposes, such as with a windowing protocol other than XDG toplevel.

The property `wayland.surface_role_custom` will create a window with a surface that SDL can render to and handles input for, but is not associated with a toplevel window, so applications can use it for their own, custom purposes (e.g. wlr_layer_shell).

A test/minimal example is included in tests/testwaylandcustom.c
2024-01-08 14:54:47 -05:00
Anonymous Maarten fea6e7afb1 cmake: copy sources to binary directory in separate target
Don't do it in POST_BUILD to avoid multiple parallel builds
stepping on each others toes.
Also don't use copy_if_different, but unconditionally copy it.
The build system should take care of dependencies.
2023-11-28 22:16:54 +01:00
Anonymous Maarten a45b371de0 cmake: create and install SDL3::Jar target for Android 2023-11-23 02:13:08 +01:00
Christoph Reichenbach 7c80ac6df7 API for pressure-sensitive pens + XInput2/Wayland
This patch adds an API for querying pressure-
sensitive pens, cf. SDL_pen.h:
- Enumerate all pens
- Get pen capabilities, names, GUIDs
- Distinguishes pens and erasers
- Distinguish attached and detached pens
- Pressure and tilt support
- Rotation, distance, throttle wheel support
  (throttle wheel untested)
- Pen type and meta-information reporting
  (partially tested)

Pen event reporting:
- Three new event structures: PenTip, PenMotion, and
  PenButton
- Report location with sub-pixel precision
- Include axis and button status, is-eraser flag

Internal pen tracker, intended to be independent
of platform APIs, cf. SDL_pen_c.h:
- Track known pens
- Handle pen hotplugging

Automatic test:
- testautomation_pen.c

Other features:
- XInput2 implementation, incl. hotplugging
- Wayland implementation, incl. hotplugging
- Backward compatibility: pen events default to
  emulating pens with mouse ID SDL_PEN_MOUSEID
- Can be toggled via SDL_HINT_PEN_NOT_MOUSE
- Test/demo program (testpen)
- Wacom pen feature identification by pen ID

Acknowledgements:
- Ping Cheng (Wacom) provided extensive feedback
  on Wacom pen features and detection so that
  hopefully untested Wacom devices have a
  realistic chance of working out of the box.
2023-11-12 09:52:02 -08:00
Sylvain 59f93e20a7 Add SDL Video Capture, with back-end for linux/macos/ios/android 2023-11-09 08:36:23 -08:00
Anonymous Maarten a6541166bc cmake: also install pdb files of static libraries 2023-11-09 02:17:07 +01:00
Ryan C. Gordon 9c664b0062
main: Added _optional_ callback entry points.
This lets apps optionally have a handful of callbacks for their entry points instead of a single main function. If used, the actual main/SDL_main/whatever entry point will be implemented in the single-header library SDL_main.h and the app will implement four separate functions:

First:

    int SDL_AppInit(int argc, char **argv);

This will be called once before anything else. argc/argv work like they always do. If this returns 0, the app runs. If it returns < 0, the app calls SDL_AppQuit and terminates with an exit code that reports an error to the platform. If it returns > 0, the app calls SDL_AppQuit and terminates with an exit code that reports success to the platform. This function should not go into an infinite mainloop; it should do any one-time startup it requires and then return.

Then:

     int SDL_AppIterate(void);

This is called over and over, possibly at the refresh rate of the display or some other metric that the platform dictates. This is where the heart of your app runs. It should return as quickly as reasonably possible, but it's not a "run one memcpy and that's all the time you have" sort of thing. The app should do any game updates, and render a frame of video. If it returns < 0, SDL will call SDL_AppQuit and terminate the process with an exit code that reports an error to the platform. If it returns > 0, the app calls SDL_AppQuit and terminates with an exit code that reports success to the platform. If it returns 0, then SDL_AppIterate will be called again at some regular frequency. The platform may choose to run this more or less (perhaps less in the background, etc), or it might just call this function in a loop as fast as possible. You do not check the event queue in this function (SDL_AppEvent exists for that).

Next:

    int SDL_AppEvent(const SDL_Event *event);

This will be called once for each event pushed into the SDL queue. This may be called from any thread, and possibly in parallel to SDL_AppIterate. The fields in event do not need to be free'd (as you would normally need to do for SDL_EVENT_DROP_FILE, etc), and your app should not call SDL_PollEvent, SDL_PumpEvent, etc, as SDL will manage this for you. Return values are the same as from SDL_AppIterate(), so you can terminate in response to SDL_EVENT_QUIT, etc.

Finally:

    void SDL_AppQuit(void);

This is called once before terminating the app--assuming the app isn't being forcibly killed or crashed--as a last chance to clean up. After this returns, SDL will call SDL_Quit so the app doesn't have to (but it's safe for the app to call it, too). Process termination proceeds as if the app returned normally from main(), so atexit handles will run, if your platform supports that.

The app does not implement SDL_main if using this. To turn this on, define SDL_MAIN_USE_CALLBACKS before including SDL_main.h. Defines like SDL_MAIN_HANDLED and SDL_MAIN_NOIMPL are also respected for callbacks, if the app wants to do some sort of magic main implementation thing.

In theory, on most platforms these can be implemented in the app itself, but this saves some #ifdefs in the app and lets everyone struggle less against some platforms, and might be more efficient in the long run, too.

On some platforms, it's possible this is the only reasonable way to go, but we haven't actually hit one that 100% requires it yet (but we will, if we want to write a RetroArch backend, for example).

Using the callback entry points works on every platform, because on platforms that don't require them, we can fake them with a simple loop in an internal implementation of the usual SDL_main.

The primary way we expect people to write SDL apps is with SDL_main, and this is not intended to replace it. If the app chooses to use this, it just removes some platform-specific details they might have to otherwise manage, and maybe removes a barrier to entry on some future platform.

Fixes #6785.
Reference PR #8247.
2023-11-01 18:40:41 -04:00
Sam Lantinga 516d6f9efc testffmpeg: added support for YUVA formats using swscale
Fixes https://github.com/libsdl-org/SDL/issues/8377
2023-10-12 14:10:25 -07:00
Anonymous Maarten 1ae33f6751 cmake: optionally install pdb's 2023-10-12 02:26:48 +02:00
Anonymous Maarten ee53e4d319 cmake: check ffmpeg capability instead of version 2023-10-10 21:58:10 +02:00
Sam Lantinga 303f4e965c testffmpeg works with ffmpeg 5.1.3 and newer 2023-10-10 03:58:57 -07:00
Sam Lantinga a842446f62 Added support for 0-copy decode and display using D3D11
FIXME: We need a way to do this that doesn't involve reaching into the D3D11 texture internals
2023-10-10 03:32:46 -07:00
Sam Lantinga d830cd140b Added support for 0-copy decode and display using Apple VideoToolbox 2023-10-10 03:32:46 -07:00
Sam Lantinga 1bf913b29a Added support for 0-copy decode and display using VAAPI and EGL 2023-10-10 03:32:46 -07:00
Sam Lantinga ce8161e0cf Make sure we're building with ffmpeg 6.0 or newer 2023-10-10 03:32:46 -07:00
Sam Lantinga ed6381b68d Allow setting any number of sprites over the video
Default to no sprites over the video
2023-10-10 03:32:46 -07:00
Anonymous Maarten ebf5e08fa1 cmake: use *_STATIC_* variables when linking to a static ffmpeg 2023-10-10 03:32:46 -07:00
Sam Lantinga 88f2fb9dcf Added an example of video decoding with ffmpeg 2023-10-10 03:32:46 -07:00
Anonymous Maarten f5886f11d0 cmake: let every test depends on pretest 2023-09-25 18:02:40 +02:00
Anonymous Maarten f45761908a Move check for SDL_Delay upper bounds to testtimer 2023-09-25 18:02:40 +02:00
Anonymous Maarten 0e955a9127 cmake: run testautomation with CTest 2023-09-25 18:02:40 +02:00
Anonymous Maarten 4c3e84897f testspriteminimal: make standalone by embedding icon.bmp 2023-09-19 17:58:25 +02:00
Anonymous Maarten a2e17852d9 cmake: make sure SDL_GetPrefPath is run before testfilesystem
60 seconds timeout ought to be sufficient.
2023-09-08 09:05:58 -04:00
Anonymous Maarten a5d9db0cd0 cmake: build tests for UWP 2023-08-12 17:37:52 +02:00
Anonymous Maarten 1a7a74fb2e cmake: build emscripten tests as html page 2023-08-12 17:37:20 +02:00
Anonymous Maarten 64d570f027 Add minimal http server for emscripten test apps 2023-08-12 17:37:20 +02:00
Simon McVittie 55cf1abaa6 test: Don't flag testsurround as suitable for non-interactive use
According to #8088 it has no value as an automated test, and by
default it takes long enough to hit the default test timeout.

Resolves: #8088
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-08 08:45:57 -07:00
Ryan C. Gordon 2de9253b6c
test: Added testaudio 2023-08-02 15:02:32 -04:00
Ryan C. Gordon 0eda582160
testaudiostreamdynamicresample: Load sample.wav correctly. 2023-07-30 23:00:52 -04:00
Ryan C. Gordon 47b0321ebf
test: Removed loopwavequeue.c; obsolete in SDL3. 2023-07-30 11:55:57 -04:00
Anonymous Maarten 3ab4665956 cmake: bump minimum required CMake version to 3.16
main features:

- No more sdl-build-options/sdl-shared-build-options/sdl-global-options
- Dependency information is stored on SDL3-collector for sdl3.pc
- Use helper functions to modify the SDL targets;
    - sdl_sources to add sources
    - sdl_glob_sources to add glob soruces
    - sdl_link_dependency to add a link dependency that might also
      appear in sdl3.pc/SDL3Config.cmake
    - sdl_compile_definitions to add macro's
    - sdl_compile_options for compile options
    - sdl_include_directories for include directories
  They avoid repeated checks for existence of the SDL targets
- A nice feature of the previous is the ability to generate
  a sdl3.pc or SDL3Config.cmake that describes its dependencies
  accurately.

various:

- remove duplicate libc symbol list
- add CheckVulkan
- remove unused HAVE_MPROTECT
- add checks for getpagesize
2023-07-20 17:58:06 +02:00
Anonymous Maarten a4bb4eef73 cmake: create Android jars + apks for tests 2023-07-20 16:54:29 +02:00
Anonymous Maarten 87ccb886fe cmake: remove ability to build tests as a standalone project 2023-07-16 20:22:41 +02:00
Anonymous Maarten 80da0cf06d cmake: convert bmp images to c headers using python script
A pure CMake script was too slow
2023-07-16 16:31:06 +02:00
Sam Lantinga 505a8dfb15 testcontroller replaces gamepadmap 2023-07-16 04:32:12 -07:00
Sam Lantinga ca492dff18 Renamed testgamepad to testcontroller
The program does more than just test gamepads, and will eventually map them as well.
2023-07-16 04:32:12 -07:00
Sam Lantinga d2d26c7b1e testgamepad replaces testjoystick 2023-07-16 04:32:12 -07:00
Sam Lantinga 8f5ec2f596 Added shared code between testgamepad and gamepadmap
The goal is to eventually create a single program that can do mapping and testing of game controllers.
2023-07-09 19:24:36 -07:00
Anonymous Maarten b4291412a4 tests: build tests with C90 standard
C90 mode is disabled for:
- testautomation: use of isnan/isfinite
- testlock: use of kill
- testvulkan: use of c++ style strings in vulkan.h
2023-05-27 01:49:07 +02:00
Ryan C. Gordon e474047ff8 rwlock: Added SDL_rwlock API for shared locks. 2023-04-27 21:54:02 -04:00