rust-windowing / rust-windowing/softbuffer
Is `Context` needed for anything other than performance?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 506
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
I've read https://github.com/rust-windowing/softbuffer/issues/37 and https://github.com/rust-windowing/softbuffer/pull/64, and from my understanding, the split between Context and Surface is purely for performance, to allow sharing resources that are expensive to create.
Is that correct?
If so, then I feel it might make sense to add a convenience wrapper like:
impl<W: HasDisplayHandle + HasWindowHandle> Surface<W, W> {
pub fn new_single_window_bikeshed(window: W) -> Result<Self, CreationError> {
// Conceptual implementation, needs to be done differently in reality
// since the window needs to only be stored in the surface.
let context = Context::new(window);
Self::new(&context, window)
}
}
And perhaps change Surface to be something like struct Surface<D, W = D> (make the two type parameters default to be the same type).
This would simplify the common use-case of having a single window to be:
struct App {
surface: softbuffer::Surface<winit::Window>,
// + possibly an `Option` if you want to support Android too.
}
While still allowing the more complex multi-window case:
struct App {
context: softbuffer::Context<winit::OwnedDisplayHandle>,
surfaces: Vec<softbuffer::Surface<winit::OwnedDisplayHandle, winit::Window>>,
}
See relatedly https://github.com/rust-windowing/softbuffer/issues/298.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked softbuffer issue 37, pull request 64, and related issue 298 to verify why Context and Surface are split. Then inspect the public Context and Surface APIs and their ownership constraints. Done means reaching a settled API decision for the single-window convenience case without breaking multi-window usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, desktop-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100