Commit graph

65 commits

Author SHA1 Message Date
Olivier Goffart
526c5da24c Don't use the extended debug of the DisplayHandle in the error message
Keep the error message in one line.
Error such as

```
Error: Error creating OpenGL display (Ok(
    DisplayHandle(
        Wayland(
            WaylandDisplayHandle {
                display: 0x00005641c528e590,
            },
        ),
    ),
)) with glutin: not found
```

Are not easy to parse because of all the new lines
2025-06-25 15:06:21 +02:00
Simon Hausmann
94b257bdd4 Skia: Delegate texture import to the surface trait
This makes it easier to keep cfg'ed code in the cfg' surfaces than cfg'ing in cached_image.rs :)
2025-05-05 15:34:52 +02:00
Simon Hausmann
302926edfa
Skia: Improve multi-window rendering resource consumption (#8304)
Share Vulkan instance as well as Metal device and command queue across windows.
2025-04-29 18:58:09 +02:00
Simon Hausmann
33581182ef backend-selector: Add the ability to configure WGPU
The `require_wgpu_24` function accepts either a fully setup WGPU, or one
can configure individual aspects such as features/limits.

The wgpu_texture example uses this to add push constants to the required
features and thus eliminates the need for uniform buffers.
2025-04-29 17:46:57 +02:00
Simon Hausmann
6595aee73c
Replace use of Rc<winit:🪟:Window> with Arc (#8257)
In preparation for wgpu usage, where the wgpu API requires the window
handle to be send, i.e. Arc<dyn HasWindowHandle>.
2025-04-24 13:28:51 +02:00
Yuri Astrakhan
feb7a864df Auto-fixed clippy::useless_format
See https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::useless_format

cargo fmt --all
```

`__CARGO_FIX_YOLO=1` is a hack, but it does help a lot with the tedious fixes where the result is fairly clear.
2025-02-07 13:16:50 +01:00
Yuri Astrakhan
6324b35e94 Auto-fixed clippy::needless_borrow
`__CARGO_FIX_YOLO=1` is a hack, but it does help a lot with the tedious fixes where the result is fairly clear.

See https://rust-lang.github.io/rust-clippy/master/index.html#/needless_borrow

```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::needless_borrow

cargo fmt --all
```
2025-02-07 09:02:45 +01:00
Simon Hausmann
0d36f88152 Revamp BackendSelector API
Based on API review, PlatformBuilder becomes BackendSelector with
a slightly smaller API surface but more options, such as selecting
Metal or Vulkan rendering.
2024-12-16 13:06:05 +01:00
Simon Hausmann
37f66789c5 macOS: Replace use of old apple creates with modern objc2 replacements 2024-11-28 10:00:24 +01:00
Simon Hausmann
3f8084cdc0 When using Skia with softbuffer and partial rendering, report damages to softbuffer
Co-Authored-By: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-19 21:31:04 +01:00
Simon Hausmann
9b7de3f806 Pass the buffer age to the Skia software renderer 2024-11-19 21:31:04 +01:00
Ian Hattendorf
3cc44dc670 Add version to OpenGLAPI 2024-10-23 11:13:49 +02:00
Ian Hattendorf
ac9b85049a Add PlatformBuilder API to allow selecting OpenGL API
Right now this just allows selecting between OpenGL and OpenGL ES.
2024-10-23 11:13:49 +02:00
Simon Hausmann
9bef3e47f4 Fix GBM rendering on mali EGL drivers
Combining an EGL config with EGL_ALPHA_SIZE == 8 with an Xrgb8888 surface yields a bad match on eglCreateWindowSurface.
That's fair, and we should accomodate for that by avoiding such EGL configs.
2024-07-30 13:04:48 +02:00
Olivier Goffart
5d9682b2ad Remove PhantomData 2024-06-18 17:48:17 +02:00
Simon Hausmann
1c54cce021 Skia: Fix windows build 2024-06-18 17:48:17 +02:00
Simon Hausmann
4c888bf1ae Port the Skia renderer to rwh06 and the new softbuffer
... by accepting an Rc<dyn Has*Handle> in the interface. This is required for softbuffer use.
2024-06-18 17:48:17 +02:00
Olivier Goffart
865e3e940d WIP: update winit, glutin, raw-window-handle 2024-06-18 17:48:17 +02:00
Simon Hausmann
0e67654431 Fix jitter when resizing a window on macOS
Commit 1e450abc9c originally fixed this. Meanwhile, after many refactorings, this doesn't work anymore for the FemtoVG renderer. That's because the contents placement (or layer's contents gravity) is set before the hidden layer NSOpenGLContext creates is associated with the view.

For the Skia GL surface that already works, but for clarify the code is moved into the same location.

For Skia Metal rendering, apply the same on the metal layer (through the view). For this to work the contents scale also needs to be applied. To avoid further visual effects, the scale needs to be applied as early as possible, so apply it right after creating the
surface and latest at rendering time.

Fixes #5258
2024-06-06 08:34:58 -07:00
Simon Hausmann
ef8299a394 Bump Skia Rust bindings to 0.75
This updates Skia to milestone 126 and (among other things) fixes
SKIA_DEBUG=1 builds.

See https://github.com/rust-skia/rust-skia/releases/tag/0.75.0 for more
details.
2024-06-03 08:35:26 -07:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Simon Hausmann
02e40e7e61 Update to Skia 0.71
Release notes at https://github.com/rust-skia/rust-skia/releases/tag/0.71.0
2024-02-28 15:42:06 +01:00
Simon Hausmann
f5bf6e5dc0 Skia: Clean up pre present notify callback API
Move this back out of render() again and make it stateful in the renderer. Reduces the amount of book-keeping required and it's always the same callback anyway.
2024-01-04 10:35:09 +01:00
Simon Hausmann
3069e8e503 Add support for frame throttling on Wayland
Use winit's pre_present_notify() API to allow for the compositor to throttle rendering.

Fixes #4200
cc #1695
2024-01-04 09:21:53 +01:00
Simon Hausmann
3b51c8e30a
LinuxKMS: Add support for synthetic display rotations (#4166)
This patch adds support for the `SLINT_KMS_ROTATION` environment
variable, that instructs the Skia/FemtoVG renderers to rotate
the scene before rendering.
2023-12-18 17:49:05 +01:00
Simon Hausmann
c04298647e Skia: Fix OpenGL rendering on devices that don't support GLES 3.0
Fall back to a GLES 2.0 context. After commit 2329bf9eb1 we bumped the minimum to 3.0, but that breaks
rendering on the stm32mp157 with linuxkms.
2023-12-15 16:48:23 +01:00
Simon Hausmann
f941357337 Upgrade to glutin 0.31.1 to fix window transparency on macOS
Fixes #3760
2023-10-30 08:58:25 +01:00
Simon Hausmann
bdd275811e Bump skia-safe version
This updates to m118. See
https://github.com/rust-skia/rust-skia/releases/tag/0.67.0 for more
details.
2023-10-26 10:45:36 +02:00
Simon Hausmann
4aa1cfa99c Simplify Skia GL initialization code
Since our GL display API preferences slice has only a single entry, we can
remove the loop that iterates through the slice of one :)
2023-10-25 11:48:10 +02:00
Simon Hausmann
a6f9ee539b Decouple the Skia renderer from winit
Remove support for GLX. The primary use-case is indirect GPU accelerated
rendering over remote X (say via ssh and X forwarding). That comes at
the expense of an otherwise ugly API (see earlier revisions of this PR)
and issues like #3757, because the GLX error handling requires hooking
into the process-global X error handler. This was already supported only
when using Skia with winit (and thus Rust), not when using the C++ Skia
renderer.

Instead, if GLX is not available, we will fall back to software
rendering as per #3716.
2023-10-25 11:48:10 +02:00
Simon Hausmann
9884b14ee0 Make GL rendering work again on macOS
Disable transparency support to work around https://github.com/rust-windowing/glutin/issues/1640
2023-10-25 08:43:42 +02:00
Simon Hausmann
0aa4c42989 skia: Add support for Skia's software renderer 2023-10-23 13:55:23 +02:00
Simon Hausmann
2329bf9eb1 Fix Skia not rendering with some Radeon drivers on Windows
Sometimes Radon drivers report on Windows erroneously that it supports
GL_NV_framebuffer_blit as extension but when looking up
glBlitFramebufferNV via getProcAddress it returns a null pointer.

The issue goes away when bumping the GLES version. GLES 2.0 was released
in 2003 and 3.0 in 2012. Practically everyone supports it nowadays (even
Safari), so that's the easiest solution for the Skia renderer.
2023-10-23 11:42:54 +02:00
Olivier Goffart
6594729395 skia: correct default for the supports_graphics_api 2023-09-21 17:23:08 +02:00
Simon Hausmann
fd123b27bd Default to vsync for OpenGL rendering
Fixes #3516
2023-09-20 12:00:04 +02:00
Simon Hausmann
84f120bcd1 Don't panic when the windowing system tries to assign a zero size to a GL surface
Apply https://github.com/slint-ui/slint/pull/3179 also to the Skia OpenGL surface.

A zero size is permitted with Metal for example, but
we panic'ed.

Fixes #3472
2023-09-14 17:38:28 +02:00
Simon Hausmann
a2d72f75bb Minor build fix for Android
We always enable the x11 feature when selecting `backend-winit`
2023-08-23 09:18:53 +02:00
Simon Hausmann
6dd60113f1 Add some information about the display handle when glutin::display::Display::new() fails
The error from glutin is just a string.

cc #3312
2023-08-21 17:16:55 +02:00
Simon Hausmann
b503733d03 Update to a new release of the Rust Skia bindings 2023-07-31 16:18:42 +02:00
Simon Hausmann
a71e73b549 Make the surfaces part of the Skia renderer API 2023-07-28 13:40:37 +02:00
Simon Hausmann
49fe2b1bb4 Skia: Make the surface type a dyn
This will allow falling back to different surfaces/renderers.
2023-07-28 13:40:37 +02:00
Simon Hausmann
3565023a15 Improve error handling in C++ Skia Renderer API
- Don't try to create a GLX context when we only have an XCB window handle,
  XLib is required for that.
- Make it possible to create a NativeWindowHandle from Xlib data types.

Fixes #2978
2023-07-14 15:33:03 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Simon Hausmann
1d5dcec2e4 Print a warning to stderr in the event of unclean Skia GL renderer
destruction

Amends 488f34dcd7 as advised by Olivier.
2023-06-30 09:54:43 +02:00
Simon Hausmann
488f34dcd7 Improve error handling when dropping Skia OpenGL renderer
In the unlikely-yet-seen-before scenarion that we've lost the OpenGL context and can't make it current anymore in the destructor,
gracefully conveny this crucial information to Skia and don't panic.
2023-06-30 08:21:46 +02:00
Simon Hausmann
7af8d16b8d Fix build with renderer-winit-skia-opengl 2023-06-19 10:16:09 +02:00
Simon Hausmann
7c36121082 Sanity check that the OpenGL context we have provides what we need
On Windows without OpenGL, wgl might succeed all the way, but get_proc_address will fail.
2023-06-16 12:52:15 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00