Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
janKilika authored Sep 5, 2024
2 parents cb7d8b0 + 6eded55 commit 2c0d908
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 99 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,23 @@ jobs:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
- uses: taiki-e/checkout-action@v1
- uses: dtolnay/rust-toolchain@nightly
with:
rust-version: nightly
components: rustfmt
- uses: taiki-e/install-action@v2
with:
tool: typos-cli
- name: Check Formatting
run: cargo +nightly fmt --all -- --check
- name: Run Typos
run: cargo fmt --all -- --check
- name: run typos
run: typos
- name: Typos info
if: failure()
run: |
echo 'To fix typos, please run `typos -w`'
echo 'To check for a diff, run `typos`'
echo 'You can find typos here: https://crates.io/crates/typos'
tests:
name: Tests
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Fixed EGL's `Device::query_devices()` being too strict about required extensions
- Fixed crash in `EglGetProcAddress` on Win32-x86 platform due to wrong calling convention
- Fixed EGL's `Display::device()` always returning an error due to invalid pointer-argument passing inside
- Fixed EGL's `Display::new()` making an `EGLDisplay::Khr` when the EGL version for the display is 1.4 or lower.

# Version 0.32.0
Expand Down
13 changes: 10 additions & 3 deletions glutin/src/api/egl/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
use std::collections::HashSet;
use std::ffi::{self, CStr};
use std::fmt;
use std::mem::MaybeUninit;
use std::ops::Deref;
use std::os::raw::c_char;
use std::sync::Arc;
use std::{fmt, ptr};

use glutin_egl_sys::egl;
use glutin_egl_sys::egl::types::{EGLAttrib, EGLDisplay, EGLint};
Expand Down Expand Up @@ -193,12 +193,12 @@ impl Display {
.into());
}

let device = ptr::null_mut();
let mut device = MaybeUninit::uninit();
if unsafe {
self.inner.egl.QueryDisplayAttribEXT(
*self.inner.raw,
egl::DEVICE_EXT as EGLint,
device as *mut _,
device.as_mut_ptr(),
)
} == egl::FALSE
{
Expand All @@ -211,6 +211,13 @@ impl Display {
}));
}

let device = unsafe { device.assume_init() } as egl::types::EGLDeviceEXT;
debug_assert_ne!(
device,
egl::NO_DEVICE_EXT,
"eglQueryDisplayAttribEXT(EGL_DEVICE_EXT) should never return EGL_NO_DEVICE_EXT on \
success"
);
Device::from_ptr(self.inner.egl, device)
}

Expand Down
2 changes: 1 addition & 1 deletion glutin_examples/examples/egl_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ mod example {
}

let path = Path::new(IMG_PATH);
let file = OpenOptions::new().write(true).truncate(true).open(path).unwrap();
let file = OpenOptions::new().create(true).write(true).truncate(true).open(path).unwrap();

let mut encoder = png::Encoder::new(file, 1280, 720);
encoder.set_depth(png::BitDepth::Eight);
Expand Down
Loading

0 comments on commit 2c0d908

Please sign in to comment.