PR #5956 wasn't fully complete and still had some outstanding minor
issues and cleanups to be done, as well as hidden semantic changes.
This addresses a bunch of them:
- Remove unnecessary `Error` mapping to `String` as `windows-rs`'s
`Error` has a more complete `Display` representation by itself.
- Remove `into_result()` as every call could have formatted the
`windows-rs` `Error` in a log call directly.
- Pass `None` instead of a pointer to an empty slice wherever possible
(waiting for https://github.com/microsoft/win32metadata/pull/1971 to
trickle down into `windows-rs`).
- Remove `.clone()` on COM objects (temporarily increasing the refcount)
when it can be avoided by inverting the order of operations on `raw`
variables.
PR #6150 suffered a much larger rebase "hell" than I anticipated. On
my Linux box I made this change, but lost it while force-pushing from
Windows (and created some other compiler errors while at it...).
By disabling all features on `glutin`/`glutin-winit` (the latter only
uses `x11`, and only forwards `wayland` to `glutin`) we may have dropped
a lot of "unused" dependencies for other GL backends, but also made the
crate unable to import X11 (Xlib/Xcb) and Wayland handles into EGL.
Also import the missing `glutin::context::Version` struct again which
was added last-minute to #6150 (to make sure my Intel card on Windows
creates a GLES 3.0+ instead of GLES 2.0 context) while the import was
accidentally squashed into #6152 (not merged yet).
* [wgpu-hal] Upgrade `glutin` to `0.31`
`glutin 0.30` onwards completely refactored its internals to no longer
be reliant on `winit`, as they (by default) have no direct relation
except needing to perform _some_ operations (platform-specific) at
strategic times in window creation and event loop handling. Most of
that is handled by a new `glutin-winit` introp crate, while the core
`glutin` crate now exclusively focuses on wrapping the various OpenGL
context APIs (CGL, EGL, WGL, ...).
This does result in a little more verbose handling to get the right
`GLDisplay`, `GLConfig`, `GLContext` and `GLSurface`, but gives much
more control and makes all intricacies more explicit. Most of the
code was copied from `glutin 0.31`'s example crate, with the code for
transparency support removed.
Note that the example doesn't at all handle event loop events properly:
resizes and redraws are not listened to, and mobile-specific surface
events (`Resumed` and `Suspended`) are equally ignored.
* [wgpu-hal] Implement proper `Surface` availability semantics in `raw-gles` example
* Expose the raw swapchain from a vulkan `Surface`
* Allow setting the present timing information on hal Vulkan
* Fix clippy without the feature enabled
* CHANGELOG
* Revert inadvertently formatted Cargo.toml
* Move display timing to a feature
* Update the changelog
* Whitespace and doc wording tweaks
* Apply suggestions from code review
Co-authored-by: Marijn Suijten <marijns95@gmail.com>
* Revert inadvertent formatting changes again
* Remove unused qualification
Co-authored-by: Marijn Suijten <marijns95@gmail.com>
* Address review feedback
* Fix flow of sentence and follow intra-doc-link
* Add more docs to `set_next_present_time`, and rename
* Also rename `next_present_times`
* Apply suggestions from code review
Co-authored-by: Marijn Suijten <marijns95@gmail.com>
---------
Co-authored-by: Marijn Suijten <marijns95@gmail.com>
`std::mem::{size,align}_of{,_val}` was added to `std::prelude` in Rust
1.80; see
[`rust`#123168](https://github.com/rust-lang/rust/pull/123168/).
However, we don't have an MSRV at 1.80 or higher yet. So, let's work
around it by importing these items fully. Since neither `clippy` nor
`rustc` lint against shadowed `prelude` items yet (see also a [proposed
`clippy` lint] for such), that lets us remove the explicit `std::mem::*`
imports later at our leisure.
[proposed `clippy` lint]: https://github.com/rust-lang/rust-clippy/issues/8439