Owned pixel buffer for no-copy presentation

This is based on the API that will be used for no-copy presentation. But
wraps it in `set_buffer`.

This also fixes the Wayland buffer code to set `self.width` and
`self.height` on resize, and set the length of the shared memory file
when the buffer is created.

Co-authored-by: jtnunley <jtnunley01@gmail.com>
This commit is contained in:
Ian Douglas Scott 2023-04-06 00:30:59 -07:00 committed by GitHub
parent e5d546ff9e
commit a09e4cf679
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 1176 additions and 438 deletions

View file

@ -1,8 +1,10 @@
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
use std::error::Error;
use std::num::NonZeroU32;
use thiserror::Error;
#[derive(Error, Debug)]
#[allow(missing_docs)] // TODO
#[non_exhaustive]
pub enum SoftBufferError {
#[error(
@ -27,6 +29,12 @@ pub enum SoftBufferError {
#[error("The provided display handle is null.")]
IncompleteDisplayHandle,
#[error("Surface size {width}x{height} out of range for backend.")]
SizeOutOfRange {
width: NonZeroU32,
height: NonZeroU32,
},
#[error("Platform error")]
PlatformError(Option<String>, Option<Box<dyn Error>>),
}