Skip to content

Commit 061aca8

Browse files
committed
Add "how it works" section to README
1 parent 7ea3e56 commit 061aca8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@ like [`tiny-skia`](https://docs.rs/tiny-skia/) or [`vello_cpu`](https://docs.rs/
2020

2121
[`raw_window_handle::HasWindowHandle`]: https://docs.rs/raw-window-handle/0.6.2/raw_window_handle/trait.HasWindowHandle.html
2222

23+
## How it works
24+
25+
Most platforms have a compositor of some sort (WindowServer on macOS, Desktop Window Manager on
26+
Windows, the Wayland compositor, etc). This is a separate process that applications communicate
27+
with over IPC, and it is responsible for taking the various surfaces that applications send to it
28+
and mash ("composite") them together in the right way to render the user's desktop on the
29+
connected monitors.
30+
31+
The role of Softbuffer then is to create a shared memory region (i.e. [`Buffer`]) that can be
32+
written to from the CPU, and then handed to the compositor (in [`Buffer::present`]). Softbuffer
33+
keeps a set of buffers around per surface to implement double-buffering (depending on platform
34+
requirements).
35+
36+
Softbuffer strives to present buffers in a zero-copy manner. One interesting wrinkle here is that
37+
the compositor is often GPU-accelerated, so on platforms without a unified memory architecture,
38+
some copying is inherently necessary (though when possible, it is done in hardware using DMA).
39+
2340
## Platform support
2441

2542
Softbuffer supports many platforms, some to a higher degree than others. This is codified with a "tier" system. Tier 1 platforms can be thought of as "tested and guaranteed to work", tier 2 as "will likely work", and tier 3 as "builds in CI".

0 commit comments

Comments
 (0)