Commit Graph

7027 Commits

Author SHA1 Message Date
Brad Werth
56d9d32a07
[wgpu-core] Ensure that DeviceLostCallback is always called exactly once
* Ensure device lost closure is called exactly once before being dropped.

This requires a change to the Rust callback signature, which is now Fn
instead of FnOnce. When the Rust callback or the C closure are dropped,
they will panic if they haven't been called. `device_drop` is changed
to call the closure with a message of "Device dropped." A test is added.
2023-12-19 23:16:10 +00:00
Nicolas Silva
aade481bdf
Remove some locks in BindGroup (#4894)
* Remove some locks in BindGroup

These are only written to clear the vectors when triaging bindgroups for destruction, which is not necessary. We can let the reference counts drop when the bind group is dropped.

* Make the mem_leak test pass again
2023-12-19 10:29:32 +01:00
Nicolas Silva
a1b183f736
Avoid allocating memory every time we might log a label (#4893)
We allocate a String every time we want to get a label for logging. The string is also allocated when logging is disabled. Either way, the allocation is unnecessary. This commit replaces the String with a dyn Debug reference which does not need any allocation.
2023-12-18 13:08:18 +01:00
Nicolas Silva
625165e60e
Make the naga version in trunk as high as the latest published one. (#4891) 2023-12-18 04:05:16 -05:00
Nicolas Silva
192a2fe16c
Simplify ResourceMaps (#4880)
* Remove the abstractions in resource maps

ResourceMaps had a rather convoluted system for erasing types that isn't needed anywhere except in one place in the triage_resource function. Everywhere else we are always dealing with specific types so using a member of the resource maps is simpler than going through an abstraction. More importantly there was a constraint that all contents of the resource maps implement the Resource trait which got in the way of some of the ongoing buffer snatching changes.

This commit simplifies this by removing the abstraction. Each resource type has its hash map directly in ResourceMaps and it is easier to have different requirements and behaviors depending on the type of the each resource.
2023-12-18 08:27:58 +00:00
dependabot[bot]
790c40fd44
Bump thiserror from 1.0.50 to 1.0.51 (#4890)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-17 22:10:40 -05:00
daxpedda
bcdc240a9a
WebGL: add support for more RawWindowHandle variants (#4888) 2023-12-17 20:47:38 -05:00
Mikko Lehtonen
159ac9e373
validation: More detailed on incompatible BGL (#4826) 2023-12-17 18:22:39 -05:00
Andreas Reich
ba56dd2901
Document wgpu & wgpu-core features (#4886) 2023-12-17 22:10:38 +00:00
Nicolas Silva
10dd5844ac
Allow clippy::pattern_type_mismatch (#4887) 2023-12-17 15:00:02 -05:00
daxpedda
2053358d89
Add wgpu crate features for backends (#4815)
* Introduce `dx12` and `metal` crate features to `wgpu`

* Implement dummy `Context` to allow compilation with `--no-default-features`

* Address review

* Remove `dummy::Context` in favor of `hal::api::Empty`

* Add changelog entry

* Panic early in `Instance::new()` if no backend is enabled

Co-Authored-By: Andreas Reich <1220815+Wumpf@users.noreply.github.com>

---------

Co-authored-by: Andreas Reich <1220815+Wumpf@users.noreply.github.com>
2023-12-16 10:39:53 +01:00
Nicolas Silva
855b06977f
Refactor create_buffer so that we can snatch the raw buffer in the error path. (#4878)
The general idea is to register postpone reigistering the buffer until towards the end of the function so that our unique reference to it lets us easily snatch the raw buffer if an error happens.
2023-12-15 10:08:03 +01:00
dependabot[bot]
96dacbbb4d
Bump zerocopy from 0.7.26 to 0.7.31 (#4882)
Bumps [zerocopy](https://github.com/google/zerocopy) from 0.7.26 to 0.7.31.
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.7.26...v0.7.31)

---
updated-dependencies:
- dependency-name: zerocopy
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 08:42:28 +01:00
Nicolas Silva
c5e6122b65
Reintroduce buffer snatching Part 1 (#4867)
Introduce snatch guards
2023-12-14 13:14:49 +01:00
Jim Blandy
d9d051b7a5 [naga wgsl] Let unary operators accept and produce abstract types.
Fixes #4445.
Fixes #4492.
Fixes #4435.
2023-12-14 10:54:46 +01:00
Jim Blandy
c4b43875e5 [naga wgsl-in] Support abstract operands to binary operators. 2023-12-13 08:42:26 -08:00
Jim Blandy
f2828ace38 [naga wgsl-in] Separate out convert_to_leaf_scalar.
Abstract out the body of `convert_slice_to_common_leaf_scalar`'s main
loop into its own function. Code motion only, no intended change of
behavior.
2023-12-13 08:42:26 -08:00
Jim Blandy
0df496062e [naga wgsl-in] Rename convert_slice_to_common_leaf_scalar.
This is a mouthful, but it's going to align better with functions to
be introduced in later commits.
2023-12-13 08:42:26 -08:00
Jim Blandy
f4161189fa [naga wgsl-in] Relax arg type for automatic_conversion_consensus. 2023-12-13 08:42:26 -08:00
Jim Blandy
84c74adec2 [naga wgsl-in] Relocate automatic_conversion_consensus.
Move `naga::front::wgsl::lower:🚧:automatic_conversion_consensus`
into `conversion.rs`, and make it a method of `ExpressionContext`.
2023-12-13 08:42:26 -08:00
Jim Blandy
3ffd5a1e56 [naga wgsl-out] Include the f suffix on f32 literals.
Without the suffix, `Expression::Literal(Literal::F32)` expressions
get written without any suffix on the number, meaning that they get
re-parsed as `AbstractFloat` values. In theory, this should always be
fine, but since we don't actually support abstract types yet in all
the places we should, having them appear in the output causes
validation problems.

See also: #4863, which did the same for `i32` literals.
2023-12-13 13:42:05 +01:00
dependabot[bot]
4d1e316197
Bump syn from 2.0.40 to 2.0.41 (#4874)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-13 00:20:29 -05:00
dependabot[bot]
08fce4ae36
Bump ctor from 0.2.5 to 0.2.6 (#4873)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-13 00:20:12 -05:00
Xiaopeng Li
ecc301ea16
fix present mode for wgl (#4865) 2023-12-12 13:36:43 -05:00
Jim Blandy
6dc9ccab85
[naga wgsl-out] Include the i suffix on i32 literals. (#4863)
Without the suffix, `Expression::Literal(Literal::I32)` expressions
get written without any suffix on the decimal number, meaning that
they get re-parsed as AbstractInt values. In theory, this should
always be fine, but since we don't actually support abstract types yet
in all the places we should, having them appear in the output causes
validation problems.
2023-12-12 12:07:10 +00:00
Jim Blandy
4b6a2d1dfa [naga] Teach the constant evaluator vector/vector operators.
Allow constant evaluation of binary operators whose left and right
operands are both vectors.
2023-12-12 12:48:10 +01:00
Jim Blandy
0e41cfe4ca [naga] Change operators.wgsl to use values that matter.
Change `splat` to take run-time values as arguments, to prevent
constant evaluation from boiling everything away.
2023-12-12 12:48:10 +01:00
Jim Blandy
439bf3c1b4 [naga wgsl-in] Improve error message for failed concretization. 2023-12-12 12:48:10 +01:00
dependabot[bot]
d9bfab5bec
Bump syn from 2.0.39 to 2.0.40 (#4864)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.39 to 2.0.40.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.39...2.0.40)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-12 09:28:31 +01:00
dependabot[bot]
f7c876788d
Bump tokio from 1.34.0 to 1.35.0 (#4856)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-10 21:47:44 -05:00
dependabot[bot]
6d02bbd85f
Bump profiling from 1.0.11 to 1.0.12 (#4855)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-10 21:47:26 -05:00
dependabot[bot]
714a908b85
Bump libc from 0.2.150 to 0.2.151 (#4854)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-10 21:47:09 -05:00
Michael Palmos
eff9a362be
Add COPY_SRC to Metal's surface usage bits. (#4852) 2023-12-10 08:32:36 +00:00
Valaphee The Meerkat
6c4128b4e7
[wgpu] correct doc for resolve query set (#4849)
* Correct doc for resolve query set

* Add note about wgpu::QUERY_SIZE

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2023-12-09 22:56:09 +00:00
Nicolas Silva
af701fb26d
Format extent and origin types as tuples. (#4853)
* Format extent and origin types as tuples.

* Update wgpu-types/src/lib.rs

Co-authored-by: Andreas Reich <r_andreas2@web.de>

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2023-12-09 22:43:53 +00:00
Andreas Reich
d801c6111d
Fix BufferMapRange not being Send/Sync (on native) (#4818)
* Make `BufferMappedRange` trait WasmNotSendSync

* make QueueWriteBuffer trait Debug

* add changelog

* fix pr numbers in changelog

* missing send/sync on web.rs on BufferMappedRange for fragile-send-sync-non-atomic-wasm + !atomics
2023-12-09 11:25:27 +00:00
dependabot[bot]
0a81ec377a
Bump once_cell from 1.18.0 to 1.19.0 (#4847)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.18.0 to 1.19.0.
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.18.0...v1.19.0)

---
updated-dependencies:
- dependency-name: once_cell
  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>
2023-12-07 23:47:27 -05:00
Theo Dulka
cf8e11efc3
Use VK_EXT_robustness2 only when not using an outdated intel iGPU driver (#4602) 2023-12-07 14:08:21 -05:00
Teodor Tanasoaia
0cbabcf229
Update multi-planar texture API (#4837) 2023-12-07 14:06:56 -05:00
teoxoy
411c1e5b21 [spv-out] Decorate all non-uniform binding array access chains as NonUniform, not just buffer binding arrays.
Apply the `NonUniform` decoration to the results of all access chains rooted in binding arrays that use non-uniform values as indices, regardless of the binding array's element type and address space. Previously, Naga only decorated non-uniform access chains for binding arrays of buffers.
2023-12-07 19:01:04 +01:00
Nicolas Silva
ff7b2c3993 Work around cbindgen issue
cbindgen spins out of control if wgpu_hal reexports a wgpu_types type using pub type in stead of pub use while keeping the same name.
2023-12-07 11:45:57 +01:00
Connor Fitzgerald
dc842ae289
Some minor cleanups (#4843) 2023-12-07 08:55:02 +01:00
Connor Fitzgerald
2c2145c3a6
Remove expose-ids Feature (#4841)
* Remove expose-ids feature

* Changelog
2023-12-06 17:09:10 -05:00
Douglas Dwyer
10253db555
Fix Javascript exception on repeated BufferSlice::get_mapped_range calls (#4726)
* Add reusable buffer mappings for WASM

* Run cargo fmt

* Update CHANGELOG.md

* Update web.rs

* Add documentation for WebBuffer struct
2023-12-06 21:24:09 +00:00
Daniel Keitel
0f4df52b5a
[wgpu-hal] Inline RayQuery Support (#3507)
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-06 21:12:41 +00:00
daxpedda
3e0fb2c14e
Expose shader validation (#4811)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-06 21:06:04 +00:00
dependabot[bot]
63657b3352
Bump futures-lite from 2.0.1 to 2.1.0 (#4820)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-06 15:57:36 -05:00
Valaphee The Meerkat
5022a6244b
[gl] add support for line and point polygon modes (#4836)
Co-authored-by: Nicolas Silva <nical@fastmail.com>
2023-12-06 15:51:27 -05:00
Valaphee The Meerkat
a1fafe394f
Remove DX11 backend (#4828) 2023-12-06 15:12:46 -05:00
Teodor Tanasoaia
12869e36fe
[vk] remove (old) unused blocklist for dual source blending (#4758) 2023-12-06 15:50:10 +01:00