In `wgpu_hal`:
- Document that `wgpu_hal` guarantees that shaders will not access buffer
contents beyond the bindgroups' bound regions, rounded up to some
adapter-specific alignment. Introduce the term "accessible region" for
the portion of the buffer that shaders can actually get at.
- Document that all bets are off if you disable bounds checks with
`ShaderModuleDescriptor::runtime_checks`.
- Provide this alignment in `wgpu_hal::Alignments`. Update all backends
appropriately.
- In the Vulkan backend, use Naga to inject bounds checks on buffer accesses
unless `robustBufferAccess2` is available; `robustBufferAccess` is not
sufficient. Retrieve `VK_EXT_robustness2`'s properties, as needed to discover
the alignment above.
In `wgpu_core`:
- Use buffer bindings' accessible regions to determine which parts of the buffer
need to be initialized.
In `wgpu_types`:
- Document some of the possible effects of using
`ShaderBoundsChecks::unchecked`.
Fixes#1813.
Remove the `pub(crate)` visibility marking from various associated
functions of `Device` that are defined in, and not used outside of,
the `wgpu_core::device::resource` module.
Change various functions that have no need to create an owning
reference to the `Device` to accept `&self` instead of `&Arc<Self>`.
Change `ParentDevice::same_device` to accept `&Device` as the point of
comparison, not `&Arc<Device>`. Call sites will use Deref conversion,
so no callers need to be changed.
In `Device::create_bind_group`, name the functions that convert
resource ids to Arcs `resolve_foo`, not `map_foo`:
- The types that hold Arcs are usually called `ResolvedBlah`.
- The name `map_buffer` is misleading.
The test harness creates the instance and adapter that a test should use. Tests should not create these with default configurations or configs from the environment.
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.
Add a new module `lock::observing`, enabled by the `observe-locks`
feature, that records all nested lock acquisitions in trace files.
Add a new utility to the workspace, `lock-analyzer`, that reads the
files written by the `observe-locks` feature and writes out a new
`define_lock_ranks!` macro invocation that covers all observed lock
usage, along with comments giving the held and acquired source
locations.
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
* Make `wgpu_test::valid` print errors it detects.
When a block passed to `wgpu_test::valid` actually raises validation
errors, include the full error in the panic message.
---------
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>