Skip to content

Conversation

@madsmtm
Copy link
Member

@madsmtm madsmtm commented Jan 27, 2026

Move the list of alternatives and license lower, and instead write some high-level information on how to use Softbuffer and how it works (or at least how it should work once we're zero-copy on all platforms).

@madsmtm madsmtm added the documentation Improvements or additions to documentation label Jan 27, 2026
Comment on lines 11 to 38
## How it works

## License & Credits
Most platforms have a compositor of some sort (WindowServer on macOS, Desktop Window Manager on
Windows, the Wayland compositor, etc). This is a separate process that applications communicate
with over IPC, and it is responsible for taking the various surfaces that applications send to it
and mash ("composite") them together in the right way to render the user's desktop on the
connected monitors.

This library is dual-licensed under MIT or Apache-2.0, just like minifb and rust. Significant portions of code were taken
from the minifb library to do platform-specific work.
The role of Softbuffer then is to create a shared memory region (i.e. [`Buffer`]) that can be
written to from the CPU, and then handed to the compositor (in [`Buffer::present`]). Softbuffer
keeps a set of buffers around per surface to implement double-buffering (depending on platform
requirements).

Softbuffer strives to present buffers in a zero-copy manner. One interesting wrinkle here is that
the compositor is often GPU-accelerated, so on platforms without a unified memory architecture,
some copying is inherently necessary (though when possible, it is done in hardware using DMA).
Copy link
Member Author

@madsmtm madsmtm Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly confident in most this section, or at least confident that this is a good mental model for how Softbuffer should work internally, but would ideally like some more eyes on it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a fairly good description to me.

Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one has been a long time coming.

It's more relevant to list actual features etc. at the top, than to list
alternatives.
Provide motivation and recommend `tiny-skia` and `vello_cpu` for drawing
primitives.
@madsmtm
Copy link
Member Author

madsmtm commented Jan 30, 2026

Thanks for the reviews!

@madsmtm madsmtm merged commit 061aca8 into master Jan 30, 2026
40 checks passed
@madsmtm madsmtm deleted the madsmtm/readme branch January 30, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Development

Successfully merging this pull request may close these issues.

4 participants