Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glutin version 0.31.3 #1664

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

# Version 0.31.3

- Change `Surface` to be `Send`. This makes it consistent with the context, so now they are both `Send` but not `Sync`.

# Version 0.31.2

- Fixed EGL not setting context version with EGL versions before 1.5 and missing context ext.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A low-level library for OpenGL context creation.

```toml
[dependencies]
glutin = "0.31.2"
glutin = "0.31.3"
```

## [Documentation](https://docs.rs/glutin)
Expand Down
2 changes: 1 addition & 1 deletion glutin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "glutin"
version = "0.31.2"
version = "0.31.3"
authors = ["Kirill Chibisov <[email protected]>"]
description = "Cross-platform OpenGL context provider."
keywords = ["windowing", "opengl", "egl"]
Expand Down
7 changes: 5 additions & 2 deletions glutin/src/api/cgl/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Display {
config: config.clone(),
ns_view,
ns_window,
_nosendsync: PhantomData,
_nosync: PhantomData,
_ty: PhantomData,
};
Ok(surface)
Expand All @@ -94,10 +94,13 @@ pub struct Surface<T: SurfaceTypeTrait> {
config: Config,
pub(crate) ns_view: MainThreadBound<Id<NSView>>,
ns_window: MainThreadBound<Id<NSWindow>>,
_nosendsync: PhantomData<*const std::ffi::c_void>,
_nosync: PhantomData<*const std::ffi::c_void>,
_ty: PhantomData<T>,
}

// Impl only `Send` for Surface.
unsafe impl<T: SurfaceTypeTrait> Send for Surface<T> {}

impl<T: SurfaceTypeTrait> GlSurface<T> for Surface<T> {
type Context = PossiblyCurrentContext;
type SurfaceType = T;
Expand Down
3 changes: 3 additions & 0 deletions glutin/src/api/egl/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ pub struct Surface<T: SurfaceTypeTrait> {
_ty: PhantomData<T>,
}

// Impl only `Send` for Surface.
unsafe impl<T: SurfaceTypeTrait> Send for Surface<T> {}

impl<T: SurfaceTypeTrait> Surface<T> {
/// Swaps the underlying back buffers when the surface is not single
/// buffered and pass the [`Rect`] information to the system
Expand Down
3 changes: 3 additions & 0 deletions glutin/src/api/glx/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ pub struct Surface<T: SurfaceTypeTrait> {
_ty: PhantomData<T>,
}

// Impl only `Send` for Surface.
unsafe impl<T: SurfaceTypeTrait> Send for Surface<T> {}

impl<T: SurfaceTypeTrait> Surface<T> {
/// # Safety
///
Expand Down
3 changes: 3 additions & 0 deletions glutin/src/api/wgl/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ pub struct Surface<T: SurfaceTypeTrait> {
_ty: PhantomData<T>,
}

// Impl only `Send` for Surface.
unsafe impl<T: SurfaceTypeTrait> Send for Surface<T> {}

impl<T: SurfaceTypeTrait> Drop for Surface<T> {
fn drop(&mut self) {
unsafe {
Expand Down
7 changes: 4 additions & 3 deletions glutin/src/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,11 @@ pub enum SurfaceType {

/// The GL surface that is used for rendering.
///
/// The GL surface is not thread safe, it can neither be [`Send`] nor [`Sync`],
/// so it should be created on the thread it'll be used to render.
/// Similar to the context, the GL surface is [`Send`] but not [`Sync`]. This
/// means it could be sent to a different thread as long as it is not current on
/// another thread.
///
/// ```compile_fail
/// ```no_run
/// fn test_send<T: Send>() {}
/// test_send::<glutin::surface::Surface<glutin::surface::WindowSurface>>();
/// ```
Expand Down
Loading
Loading