Commit Graph

8399 Commits

Author SHA1 Message Date
Nicolas Silva
81963e24ca
Fix the internal buffer and texture count (#6223)
Currently, we only increment the internal buffer/texture counters when creating them in the regular way (not when creating them from externally built hal objects (create_texture_from_hal/create_buffer_from_hal). However we decrement the counter in all cases, which makes the counters incorrect when these externally created resources are involved.

This commit fixes it by adding hooks (add_raw_buffer and add_raw_texture) in the hal device abstractions to inform when buffer or textures are created externally.
2024-09-05 18:53:01 +00:00
Erich Gubler
ec21000521 refactor: lock::observing: extract fn addr from ref. conv. to usize 2024-09-05 11:08:51 -04:00
Erich Gubler
63a24d37c3 chore: satisfy clippy::ref_as_ptr 2024-09-05 11:08:51 -04:00
Jim Blandy
aeac0f29fe
[naga] Make tests compile without the WGSL front end. (#6217) 2024-09-05 10:18:20 +02:00
Jim Blandy
36124b12c5
[core] Update docs for private items. (#6219)
Make `cargo doc --document-private-items` work again in wgpu-core.
2024-09-05 10:15:27 +02:00
Jim Blandy
64ea7efc04
[naga] Update docs for private items. (#6218)
Make `cargo doc --document-private-items` work again in Naga.

Update some documentation missed by the local const work in #6156.
2024-09-05 10:15:02 +02:00
Jim Blandy
9ff161d5e0 [hal] Document some CommandEncoder trait methods.
Add documentation for the following `CommandEncoder` trait methods:
- `set_bind_group`
- `begin_render_pass`
- `begin_compute_pass`
- `end_render_pass`
- `end_compute_pass`
2024-09-04 16:31:33 -07:00
Erich Gubler
2aa69e1bb2 test(wgsl): note link b/w cross and bad_cross_builtin_args tests 2024-09-04 15:08:56 -04:00
Erich Gubler
fcbec57d84 test(wgsl): test explicit center with {perspective,linear} interpolation 2024-09-04 15:08:56 -04:00
Marijn Suijten
960555a426
[wgpu-hal] Allow importing external WGL contexts as with EGL (#6152) 2024-09-04 15:11:47 +00:00
Teodor Tanasoaia
4e78829d82
[wgpu-core] when mapping buffers for reading, mark buffers as initialized only when they have MAP_WRITE usage (#6178) 2024-09-04 14:57:08 +00:00
Jim Blandy
ee35b0e586 [core, hal, types] Clarify wgpu_hal's bounds check promises.
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.
2024-09-03 12:33:02 -04:00
Jim Blandy
de7765bd28 [core]: Let Device::create_buffer_binding get limits from self.
Rather than passing `self.limits` to `Device::create_buffer_binding`
as an argument, let it simply refer to `self.limits` itself.
2024-09-03 12:33:02 -04:00
Jim Blandy
9ebc50fc1e [core] Remove unnecessary pub(crate) from Device methods.
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.
2024-09-03 12:33:02 -04:00
Jim Blandy
9d24406d29 [core] Simplify self types in device::resource.
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.
2024-09-03 12:33:02 -04:00
Jim Blandy
504ff3e1a6 [core] Rename map_buffer to resolve_buffer, etc.
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.
2024-09-03 12:33:02 -04:00
dependabot[bot]
a9a98d6056
build(deps): bump the patch-updates group across 1 directory with 28 updates (#6206)
Bumps the patch-updates group with 23 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.17.0` | `1.17.1` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.4.0` | `2.5.0` |
| [serde](https://github.com/serde-rs/serde) | `1.0.208` | `1.0.209` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.125` | `1.0.127` |
| [tracy-client](https://github.com/nagisa/rust_tracy_client) | `0.17.1` | `0.17.3` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.39.3` | `1.40.0` |
| [quote](https://github.com/dtolnay/quote) | `1.0.36` | `1.0.37` |
| [syn](https://github.com/dtolnay/syn) | `2.0.75` | `2.0.77` |
| [async-trait](https://github.com/dtolnay/async-trait) | `0.1.81` | `0.1.82` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.13` | `1.1.15` |
| [const_panic](https://github.com/rodrimati1992/const_panic) | `0.2.8` | `0.2.9` |
| [fastrand](https://github.com/smol-rs/fastrand) | `2.1.0` | `2.1.1` |
| [flate2](https://github.com/rust-lang/flate2-rs) | `1.0.32` | `1.0.33` |
| [generator](https://github.com/Xudong-Huang/generator-rs) | `0.8.2` | `0.8.3` |
| [mio](https://github.com/tokio-rs/mio) | `1.0.1` | `1.0.2` |
| [num_enum](https://github.com/illicitonion/num_enum) | `0.7.2` | `0.7.3` |
| [object](https://github.com/gimli-rs/object) | `0.36.3` | `0.36.4` |
| [proc-macro-crate](https://github.com/bkchr/proc-macro-crate) | `3.1.0` | `3.2.0` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.34` | `0.38.35` |
| [sctk-adwaita](https://github.com/PolyMeilex/sctk-adwaita) | `0.8.1` | `0.8.3` |
| [tracy-client-sys](https://github.com/nagisa/rust_tracy_client) | `0.23.0` | `0.24.0` |
| [wayland-client](https://github.com/smithay/wayland-rs) | `0.31.2` | `0.31.5` |
| [wayland-cursor](https://github.com/smithay/wayland-rs) | `0.31.1` | `0.31.5` |



Updates `bytemuck` from 1.17.0 to 1.17.1
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.17.0...v1.17.1)

Updates `indexmap` from 2.4.0 to 2.5.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.4.0...2.5.0)

Updates `serde` from 1.0.208 to 1.0.209
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.208...v1.0.209)

Updates `serde_json` from 1.0.125 to 1.0.127
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/1.0.125...1.0.127)

Updates `tracy-client` from 0.17.1 to 0.17.3
- [Commits](https://github.com/nagisa/rust_tracy_client/compare/tracy-client-v0.17.1...tracy-client-v0.17.3)

Updates `tokio` from 1.39.3 to 1.40.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.39.3...tokio-1.40.0)

Updates `quote` from 1.0.36 to 1.0.37
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.36...1.0.37)

Updates `syn` from 2.0.75 to 2.0.77
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.75...2.0.77)

Updates `async-trait` from 0.1.81 to 0.1.82
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.81...0.1.82)

Updates `cc` from 1.1.13 to 1.1.15
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.13...cc-v1.1.15)

Updates `const_panic` from 0.2.8 to 0.2.9
- [Release notes](https://github.com/rodrimati1992/const_panic/releases)
- [Changelog](https://github.com/rodrimati1992/const_panic/blob/main/Changelog.md)
- [Commits](https://github.com/rodrimati1992/const_panic/commits)

Updates `fastrand` from 2.1.0 to 2.1.1
- [Release notes](https://github.com/smol-rs/fastrand/releases)
- [Changelog](https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/fastrand/compare/v2.1.0...v2.1.1)

Updates `flate2` from 1.0.32 to 1.0.33
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Changelog](https://github.com/rust-lang/flate2-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.32...1.0.33)

Updates `generator` from 0.8.2 to 0.8.3
- [Release notes](https://github.com/Xudong-Huang/generator-rs/releases)
- [Commits](https://github.com/Xudong-Huang/generator-rs/compare/0.8.2...0.8.3)

Updates `mio` from 1.0.1 to 1.0.2
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/compare/v1.0.1...v1.0.2)

Updates `num_enum` from 0.7.2 to 0.7.3
- [Commits](https://github.com/illicitonion/num_enum/compare/0.7.2...0.7.3)

Updates `num_enum_derive` from 0.7.2 to 0.7.3
- [Commits](https://github.com/illicitonion/num_enum/compare/0.7.2...0.7.3)

Updates `object` from 0.36.3 to 0.36.4
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.36.3...0.36.4)

Updates `proc-macro-crate` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/bkchr/proc-macro-crate/releases)
- [Commits](https://github.com/bkchr/proc-macro-crate/commits/v3.2.0)

Updates `rustix` from 0.38.34 to 0.38.35
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.34...v0.38.35)

Updates `sctk-adwaita` from 0.8.1 to 0.8.3
- [Release notes](https://github.com/PolyMeilex/sctk-adwaita/releases)
- [Changelog](https://github.com/PolyMeilex/sctk-adwaita/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PolyMeilex/sctk-adwaita/commits)

Updates `serde_derive` from 1.0.208 to 1.0.209
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.208...v1.0.209)

Updates `toml_edit` from 0.21.1 to 0.22.20
- [Commits](https://github.com/toml-rs/toml/compare/v0.21.1...v0.22.20)

Updates `tracy-client-sys` from 0.23.0 to 0.24.0
- [Commits](https://github.com/nagisa/rust_tracy_client/compare/tracy-client-sys-v0.23.0...tracy-client-sys-v0.24.0)

Updates `wayland-client` from 0.31.2 to 0.31.5
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Updates `wayland-cursor` from 0.31.1 to 0.31.5
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Updates `wayland-scanner` from 0.31.1 to 0.31.4
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Updates `winnow` from 0.5.40 to 0.6.18
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.5.40...v0.6.18)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tracy-client
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: async-trait
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: const_panic
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: fastrand
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: flate2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: generator
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: mio
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: num_enum
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: num_enum_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: proc-macro-crate
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: sctk-adwaita
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: toml_edit
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: tracy-client-sys
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: wayland-client
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wayland-cursor
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wayland-scanner
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: winnow
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 12:32:26 -04:00
teoxoy
07becfe5b5 [tests] don't create a new instance/adapter for DEVICE_LIFETIME_CHECK & MULTIPLE_DEVICES tests
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.
2024-09-03 17:15:19 +02:00
teoxoy
595ae7cb47 [wgpu-hal] add null terminations to symbols to avoid reallocation 2024-09-03 17:15:19 +02:00
teoxoy
9d24888848 [d3d12] use windows-rs's bindings for DXC instead of hassle-rs 2024-09-03 17:15:19 +02:00
teoxoy
912bdcd336 [d3d12] simplify enumerate_adapters() fn
Also fixes an issue where only high performance adapters would be enumerated if DXGI 1.6 is available.
2024-09-03 17:15:19 +02:00
teoxoy
6c2f23c6a2 [d3d12] simplify create_factory() fn 2024-09-03 17:15:19 +02:00
teoxoy
dd01b6d209 [d3d12] make DxgiLib and D3D12Lib methods consistent 2024-09-03 17:15:19 +02:00
teoxoy
29e288f81c move hal_usage_error from the vk backend to lib.rs 2024-09-03 17:15:19 +02:00
teoxoy
e25051ec8f [d3d12] treat failure to populate references to resources as DeviceError::Unexpected
These are guaranteed to be populated if the creation methods didn't error. If they are not, the driver/runtime is at fault.
2024-09-03 17:15:19 +02:00
teoxoy
43f6279605 [d3d12] refactor buffer/texture creation functions to return resources instead of using out params 2024-09-03 17:15:19 +02:00
Erich Gubler
85346dfd20 chore: use std::mem::size_of{,_val} s'more
As before, this is to minimize diffs. with Rust 1.80.
2024-09-03 10:18:25 -04:00
Erich Gubler
e1c0aed520 chore(dx12): satisfy clippy::manual_bits 2024-09-03 10:18:25 -04:00
Erich Gubler
e323817425 chore: satisfy unused_qualifications _again_ 😩 2024-09-03 10:18:25 -04:00
Samson
4e9a2a5003
[naga wgsl] Impl const_assert (#6198)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-09-02 17:37:04 +00:00
Samson
ace2e201cf
[naga wgsl-in] allow global vars without explicit type (#6199)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-09-02 18:27:52 +02:00
Samson
105cb9db31
[naga wgsl-in] Proper singular generic in vec and matrix (#6189)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-09-02 14:04:51 +02:00
BlackStone1123
8eb0e6451b
fix wrong count buffer id (#6194)
Co-authored-by: Jasper Wu <wuq141@vanke.com>
2024-09-02 11:37:37 +00:00
Samson
26398ea0db
Use checked_mul or leading_zeros for shl overflows (#6186)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-31 11:31:50 +02:00
Samson
585f4a1036
[naga wgsl] all swizzle components must be either color or dimension (#6187) 2024-08-31 11:08:34 +02:00
Erich Gubler
04618b36a8
feat(wgsl): add first and either sampling for @interpolate(flat, …) (#6181) 2024-08-30 15:08:00 +00:00
Samson
34bb9e4ceb
[naga wgsl] Implement local const declarations (#6156) 2024-08-30 11:55:03 +02:00
Marijn Suijten
4454cbfaab
[wgpu-hal] #5956 windows-rs migration followups and cleanups (#6173)
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.
2024-08-30 11:02:38 +02:00
Jim Blandy
bbdbafdf8a [core] Add lock::observing module, for analyzing lock acquisition.
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.
2024-08-28 22:44:20 -04:00
Jim Blandy
3f6f1d766c [core] Add #[track_caller] to Registry lock methods. 2024-08-28 22:44:20 -04:00
Jim Blandy
f56914cea9 [core] Rename LockRankSet::name to member_name. 2024-08-28 22:44:20 -04:00
Erich Gubler
0ce5996891 refactor(naga): split out cross handling to separate match arm 2024-08-28 13:26:54 -04:00
Erich Gubler
7164f3eb4e fix(wgsl): narrow accepted args. of cross to vec3<$float> 2024-08-28 13:26:54 -04:00
Erich Gubler
327b92e92b test(wgsl): check that vec3 args. are accepted in cross built-in 2024-08-28 13:26:54 -04:00
Teodor Tanasoaia
aadca17885
[wgpu] fix as_hal methods (#6179) 2024-08-28 10:55:07 +00:00
Marijn Suijten
71b41c6638 [wgpu-hal] Make raw-gles runnable on X11 and Wayland platforms again
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).
2024-08-28 09:55:07 +02:00
Jan Procházka
5deaef3b67
Add VideoFrame to ExternalImageSource enum (#6170) 2024-08-27 18:05:45 +00:00
Marijn Suijten
690a3fb3fb
[wgpu-hal] Upgrade glutin to 0.31 (#6150)
* [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
2024-08-27 13:05:47 -04:00
Jerzy Wilczek
a9047c2af5
Change the DropGuard public API to a callback-based one. (#6164)
This patch also unifies the behavior of the the `DropGuard`-ish
constructs in the Vulkan-based implementation.
2024-08-27 16:44:34 +00:00
Imbris
fccd2981d0
Ensure glow::Context is current when dropped (#6114)
Cleanup code in glow needs the context to be current (mainly for debug
message callbacks).

See https://docs.rs/glow/0.14.0/glow/trait.HasContext.html#safety
2024-08-27 12:15:41 -04:00