Commit Graph

8102 Commits

Author SHA1 Message Date
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
Daniel McNab
685c2133f2
hal: cargo feature to allow using VK_GOOGLE_display_timing unsafely (#6149)
* 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>
2024-08-27 11:25:04 -04:00
mfluehr
070f760940
Fix missing word in comment (#6168) 2024-08-27 14:56:35 +00:00
Teodor Tanasoaia
338678ad5f
Remove IDs from wgpu traits (#6134)
Remove `wgpu`'s `.global_id()` getters.

Implement `PartialEq`, `Eq`, `Hash`, `PartialOrd` and `Ord` for wgpu resources.
2024-08-27 10:00:19 +00:00
Kornel
c7e5d07dee Reduce size of parse error 2024-08-27 10:52:02 +02:00
dependabot[bot]
a93dcb646a
build(deps): bump crate-ci/typos from 1.23.6 to 1.24.1 (#6160)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.23.6 to 1.24.1.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.23.6...v1.24.1)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 12:01:06 -04:00
Erich Gubler
fac49ee97c chore: work around unused_qualifications from new prelude items in Rust 1.80
`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
2024-08-23 16:20:34 -04:00
Erich Gubler
754ead25ab chore: resolve wgt::Backend::Empty raising unused_qualifications 2024-08-23 16:20:34 -04:00
Jim Blandy
15d64c362e
Make wgpu_test::valid print errors it detects. (#6136)
* 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>
2024-08-23 14:17:28 +00:00
Kornel
5b148f2db6 Avoid boxing default_error_handler 2024-08-23 09:25:50 -04:00
Kornel
8e2de738bc Allocate and call handle_error once 2024-08-23 09:25:50 -04:00
Kornel
71382e13c7 DRY cfg(send_sync) error definition 2024-08-23 09:25:50 -04:00
Jim Blandy
cc11260547
Use the repo's MSRV for building docs. (#6140) 2024-08-21 03:18:35 -04:00
Valaphee The Meerkat
b4db97f97b
Add HTMLImageElement/ImageData as external source for copying images (#5668)
* Add `HTMLImageElement` as external source for copying images

* Typo
2024-08-20 12:54:24 -04:00
dependabot[bot]
70155aa03e
build(deps): bump the patch-updates group across 1 directory with 27 updates (#6135)
Bumps the patch-updates group with 20 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [arrayvec](https://github.com/bluss/arrayvec) | `0.7.4` | `0.7.6` |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.16.3` | `1.17.0` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.3.0` | `2.4.0` |
| [libc](https://github.com/rust-lang/libc) | `0.2.155` | `0.2.158` |
| [serde](https://github.com/serde-rs/serde) | `1.0.206` | `1.0.208` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.124` | `1.0.125` |
| [js-sys](https://github.com/rustwasm/wasm-bindgen) | `0.3.69` | `0.3.70` |
| [wasm-bindgen-futures](https://github.com/rustwasm/wasm-bindgen) | `0.4.42` | `0.4.43` |
| [wasm-bindgen-test](https://github.com/rustwasm/wasm-bindgen) | `0.3.42` | `0.3.43` |
| [web-sys](https://github.com/rustwasm/wasm-bindgen) | `0.3.69` | `0.3.70` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.39.2` | `1.39.3` |
| [unicode-xid](https://github.com/unicode-rs/unicode-xid) | `0.2.4` | `0.2.5` |
| [syn](https://github.com/dtolnay/syn) | `2.0.74` | `2.0.75` |
| [bytemuck_derive](https://github.com/Lokathor/bytemuck) | `1.7.0` | `1.7.1` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.10` | `1.1.13` |
| [clap](https://github.com/clap-rs/clap) | `4.5.15` | `4.5.16` |
| [cmake](https://github.com/rust-lang/cmake-rs) | `0.1.50` | `0.1.51` |
| [flate2](https://github.com/rust-lang/flate2-rs) | `1.0.31` | `1.0.32` |
| [is-terminal](https://github.com/sunfishcode/is-terminal) | `0.4.12` | `0.4.13` |
| [xcursor](https://github.com/esposm03/xcursor-rs) | `0.3.7` | `0.3.8` |



Updates `arrayvec` from 0.7.4 to 0.7.6
- [Release notes](https://github.com/bluss/arrayvec/releases)
- [Changelog](https://github.com/bluss/arrayvec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bluss/arrayvec/compare/0.7.4...0.7.6)

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

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

Updates `libc` from 0.2.155 to 0.2.158
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.158/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.155...0.2.158)

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

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

Updates `js-sys` from 0.3.69 to 0.3.70
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `wasm-bindgen` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93)

Updates `wasm-bindgen-futures` from 0.4.42 to 0.4.43
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `wasm-bindgen-test` from 0.3.42 to 0.3.43
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `web-sys` from 0.3.69 to 0.3.70
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

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

Updates `unicode-xid` from 0.2.4 to 0.2.5
- [Commits](https://github.com/unicode-rs/unicode-xid/compare/v0.2.4...v0.2.5)

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

Updates `bytemuck_derive` from 1.7.0 to 1.7.1
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/bytemuck_derive-v1.7.0...bytemuck_derive-v1.7.1)

Updates `cc` from 1.1.10 to 1.1.13
- [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.10...cc-v1.1.13)

Updates `clap` from 4.5.15 to 4.5.16
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.15...clap_complete-v4.5.16)

Updates `cmake` from 0.1.50 to 0.1.51
- [Release notes](https://github.com/rust-lang/cmake-rs/releases)
- [Changelog](https://github.com/rust-lang/cmake-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cmake-rs/compare/0.1.50...v0.1.51)

Updates `flate2` from 1.0.31 to 1.0.32
- [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.31...1.0.32)

Updates `is-terminal` from 0.4.12 to 0.4.13
- [Commits](https://github.com/sunfishcode/is-terminal/compare/v0.4.12...v0.4.13)

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

Updates `wasm-bindgen-backend` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93)

Updates `wasm-bindgen-macro` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93)

Updates `wasm-bindgen-macro-support` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93)

Updates `wasm-bindgen-shared` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93)

Updates `wasm-bindgen-test-macro` from 0.3.42 to 0.3.43
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `xcursor` from 0.3.7 to 0.3.8
- [Commits](https://github.com/esposm03/xcursor-rs/commits)

---
updated-dependencies:
- dependency-name: arrayvec
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  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: js-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-test
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: web-sys
  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-patch
  dependency-group: patch-updates
- dependency-name: unicode-xid
  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: bytemuck_derive
  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: clap
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cmake
  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: is-terminal
  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: wasm-bindgen-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-macro
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-macro-support
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-shared
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-test-macro
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: xcursor
  dependency-type: indirect
  update-type: version-update:semver-patch
  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-08-20 12:51:28 -04:00
Marijn Suijten
a157c3cf4b
[wgpu-hal] Migrate d3d12 backend over to windows-rs (#5956)
* windows-rs 0.58

* Clean up suspicious committed allocation workaround

* dx12: Flatten suballocation module
2024-08-20 11:48:37 -04:00
Kornel
222f1ea733 Reduce code size of error handling 2024-08-19 14:38:20 +01:00
Kornel
a87c8d77ba chore: #[must_use] annotations on getters and ctors 2024-08-19 14:38:05 +01:00
vero
3178ffb0d7
Fix hlsl image type conversion (#6123) 2024-08-19 10:24:40 +02:00
Deep Vora
4c8350864c chore: satisfy clippy::collapsible_else_if 2024-08-16 10:52:35 +01:00
Deep Vora
9972d2c18a chore: [wgpu-tests] use concrete error messages for failures
resolves #5727
2024-08-16 10:52:35 +01:00
Erich Gubler
abc56417bb
refactor(web): satisfy unused_qualifications (#6121) 2024-08-15 16:56:12 +00:00
Erich Gubler
23e7846400 refactor(hal): satisfy trivial_casts 2024-08-15 14:14:13 +01:00
Erich Gubler
89a64e911d refactor(hal): remove unneeded trivial_casts suppr. 2024-08-15 14:14:13 +01:00
teoxoy
2c31414517 add an Unexpected variant to DeviceError 2024-08-15 13:56:05 +01:00
teoxoy
24134e049f handle all vulkan error variants for each function explicitly 2024-08-15 13:56:05 +01:00
teoxoy
e4c5b4760b introduce a new function that handles unexpected vulkan errors that can't be mapped to DeviceError::Lost 2024-08-15 13:56:05 +01:00
teoxoy
8b6450a9ce handle all variants of gpu_descriptor::AllocationError explicitly 2024-08-15 13:56:05 +01:00
teoxoy
7103520bd3 introduce a new function for hal usage errors 2024-08-15 13:56:05 +01:00
teoxoy
a0c107f7c8 remove handling of error that is not documented to be returned by vkAllocateMemory 2024-08-15 13:56:05 +01:00
Fionn Langhans
273c2c4b1a Fixed spelling mistake in URL of d3d12 2024-08-14 23:16:58 +02:00
Andreas Reich
92ecafebac changelog entry 2024-08-14 17:34:11 +02:00
Andreas Reich
ab17d29237 re-enable docs for wgpu-core 2024-08-14 17:34:11 +02:00
Andreas Reich
0fb772b5df remove dyn render & compute pass 2024-08-14 17:34:11 +02:00
Andreas Reich
0287eaf022 Remove gfx_select. 2024-08-14 17:34:11 +02:00
Andreas Reich
9794f33823 Handle webgl's queue_copy_external_image_to_texture 2024-08-14 17:34:11 +02:00
Andreas Reich
1bfe8845d5 ignore 'arc instead of rc' warnings on wasm 2024-08-14 17:34:11 +02:00
Andreas Reich
24498f04d4 The second unraveling: hub and all types on it are generic free!
gfx_select macros are empty husks now that are waiting to be removed
2024-08-14 17:34:11 +02:00
Andreas Reich
3181251577 Core adapter no longer uses any generics 2024-08-14 17:34:11 +02:00
Andreas Reich
04cadfb369 Core's Surface, Instance and Adapter use now dynamic hal types 2024-08-14 17:34:11 +02:00
Andreas Reich
7c7e4164f1 The big unraveling: core device now has a boxed DynDevice, ripple effects from there leading to boxing of almost all hal resources 2024-08-14 17:34:11 +02:00
Andreas Reich
5b9198fd43 introduce DynInstance 2024-08-14 17:34:11 +02:00
Andreas Reich
6f01cbff06 introduce DynAdapter 2024-08-14 17:34:11 +02:00
Andreas Reich
99ffc129eb remove unnecessary debug constraints from Api (handled by Dyn traits) 2024-08-14 17:34:11 +02:00
Andreas Reich
27944debb1 DynCommandEncoder acceleration structure building 2024-08-14 17:34:11 +02:00
Andreas Reich
d87aa3635e DynCommandencoder end_encoding, reset_all 2024-08-14 17:34:11 +02:00
Andreas Reich
1a9170e57b DynDevice exit, counters, report 2024-08-14 17:34:11 +02:00
Andreas Reich
9e1f1487b4 DynDevice acceleration structure handling 2024-08-14 17:34:11 +02:00