Commit Graph

7999 Commits

Author SHA1 Message Date
XiaoPeng
3d5d7dec02 clear refs to died texture views 2024-06-26 10:18:07 +02:00
Nicolas Silva
e92e543b7b Allow clippy::pattern_type_mismatch in hal
For the same reasons we allow it in core.
2024-06-25 15:11:47 +02:00
teoxoy
bfcb5457c6 remove unnecessary unsafe block 2024-06-25 11:14:41 +02:00
teoxoy
ad2d797f81 move InvalidQueueId error variant to top level error types 2024-06-25 11:14:41 +02:00
teoxoy
3005b46a29 inline ComputePass.parent_id() 2024-06-25 11:14:41 +02:00
teoxoy
f55fa6e217 make ResourceInfo.label private 2024-06-25 11:14:41 +02:00
teoxoy
a56698cbe6 use .error_ident() in a few more places 2024-06-25 11:14:41 +02:00
teoxoy
8106028f23 remove ResourceInfo.label() 2024-06-25 11:14:41 +02:00
teoxoy
c4e067b394 use .error_ident() for resource_log! in Drop impls 2024-06-25 11:14:41 +02:00
teoxoy
5f78485f30 pass Label to ResourceInfo::new 2024-06-25 11:14:41 +02:00
teoxoy
beaa6e95e4 remove duplicate label fields 2024-06-25 11:14:41 +02:00
teoxoy
bbf824767d remove IDs from Destroyed{Buffer,Texture} 2024-06-25 11:14:41 +02:00
teoxoy
d5d806a474 pass through pipeline_id instead of getting it via .as_info().id() 2024-06-25 11:14:41 +02:00
teoxoy
1b40c8c745 replace check_valid_to_use with ParentDevice.same_device checks 2024-06-25 11:14:41 +02:00
teoxoy
06da3e88d0 remove IDs from QueryResetMap 2024-06-25 11:14:41 +02:00
teoxoy
d30c02ffa3 use .error_ident() for resource logging 2024-06-25 11:14:41 +02:00
teoxoy
eeb57e1cee pass BufferId to unmap for tracing 2024-06-25 11:14:41 +02:00
teoxoy
1a4f6aca6f trace as soon as possible 2024-06-25 11:14:41 +02:00
teoxoy
fd52ec8997 remove tracing from deferred texture view and bind group destruction
we already trace texture view and bind group drop in the corresponding `Global` methods so we might end up with double drop actions
2024-06-25 11:14:41 +02:00
teoxoy
812a562331 remove tracing from Destroyed{Buffer,Texture} drop impl
we already trace buffer drop and destroy in the corresponding `Global` methods so we might end up with double drop/destroy actions
2024-06-25 11:14:41 +02:00
teoxoy
f2ea30772c move destroy/drop tracing actions in Global's methods 2024-06-25 11:14:41 +02:00
teoxoy
e2c4348959 replace .then_some(()).ok_or_else(e) with ifs 2024-06-25 11:14:41 +02:00
Andreas Reich
b4c7987aa7
Separate renderpass arc resolve & renderpass consume on end (#5794) 2024-06-25 09:37:29 +02:00
Jim Blandy
29e3b984a4 [naga] Use HandleSet in Validator::needs_visit.
Change the type of `naga::valid::Validator::needs_visit` from `BitSet`
to `HandleSet`. Adjust uses.

Add `HandleSet` method `iter`.
2024-06-25 09:34:30 +02:00
Jim Blandy
71a52bdba4 [naga spv-out] Use HandleSet in ExpressionConstnessTracker.
Change `naga:🔙:spv::ExpressionConstnessTracker::inner` from a
`BitSet` to a `HandleSet<Expression>`. Adjust uses.
2024-06-25 09:34:30 +02:00
Jim Blandy
43f390e86f [naga] Use HandleSet in Validator::valid_expression_set.
Add `HandleSet` methods `new`, `clear`, `clear_for_arena`, and
`remove`.

Change the type of `naga::valid::Validator::valid_expression_set` from
`BitSet` to `HandleSet`. Adjust uses.
2024-06-25 09:34:30 +02:00
Jim Blandy
f262dce065 [naga] Change HandleSet::insert to return a bool.
Change `HandleSet::insert` to return `true` if the handle was not
already in the set.

Change uses in `naga::compact` which were taking advantage of the
prior return type of `()` to avoid needing to use semicolons in
`match` arms.
2024-06-25 09:34:30 +02:00
Jim Blandy
0656fb8ea8 [naga] Use HandleSet in naga::proc::index.
Change `naga::proc::index::find_checked_indexes` to return a
`HandleSet<Expression>`, rather than an untyped `BitSet`.

Fix uses in the Metal Shading Language backend.
2024-06-25 09:34:30 +02:00
Jim Blandy
aac6fc7267 [naga] Move HandleSet from compact into arena. 2024-06-25 09:34:30 +02:00
Jim Blandy
34f5376517 [naga] Clarify Debug form of arena::Range.
Change the `std::fmt::Debug` impl for `naga::arena::Range` to print a
start-inclusive, end-exclusive range.

- This is more consistent with Rust's `std::ops::Range`.

- This is consistent with the serialization form used in snapshots,
  which simply uses the serialization of `std::ops::Range`.

- It is not consistent with Naga's constructor function
  `Range::new_from_bounds`, which takes an inclusive end value, or
  with `Range::first_and_last`, which returns an inclusive end value.
  Both of these need to represent ranges' end points as `Handle`s, but
  exclusive end values might not be valid `Handle` values. I think
  this divergence is tolerable.
2024-06-25 09:27:15 +02:00
Jim Blandy
a5d57db269 [naga] Break naga::arena up into submodules.
This commit is almost entirely code motion. The only meaningful
changes should be:

- changes to imports
- changes to visibility
- changes to use visible associated constructor functions instead of
  trying to construct values directly using now-invisible fields
- moving the crate-level "Arena" docs into the `arena` module
2024-06-24 12:42:02 -07:00
Jim Blandy
bef9eb4074 [naga] Move naga/src/arena.rs to naga/src/arena/mod.rs. 2024-06-24 12:42:02 -07:00
Jim Blandy
3623c54fb7 [naga] Use Handle::new, don't construct the Handle directly.
In preparation for making `Handle` fields private to another module,
have the `Iterator` implementation for `arena::Range` call
`Handle::new` to construct the handle being produced, rather than
building it using a struct literal.
2024-06-24 12:42:02 -07:00
Jim Blandy
3e20909ade [naga] Use Range::from_index_range in Arena::range_from.
Use the associated function `Range::from_index_range` to construct the
return value of `Arena::range_from`, rather than constructing the
`Range` directly, in preparation for those fields becoming private.
2024-06-24 12:42:02 -07:00
9SMTM6
a7d4d2c79f
Allow using include_wgsl! in const contexts (#5872)
* include_wgsl! Switch from into() call to construction

This allows usage in const contexts.

* Describe constification of include_wgsl! in changelog
2024-06-24 17:46:30 +00:00
teoxoy
333ed78529 [gl] reorder program_cache & context lock acquisition
We are using `program_cache.try_lock()` when creting pipelines which is covered by a guard gotten from `context.lock()`. For the `.try_lock()` to always succeed we need to make sure that the other lock acquisitions are also covered by a `context.lock()`.

The `wgpu_examples::hello_compute::tests::multithreaded_compute` test has been failing intermittently in CI due to this.
2024-06-24 16:57:06 +02:00
Teodor Tanasoaia
7cf071195b [glsl] add more reserved keywords from previous specs 2024-06-24 16:55:36 +02:00
Nicolas Silva
ddff69ba21
Avoid leaking submitted command encoders (#5141)
* Avoid leaking submitted command encoders

* changelog
2024-06-24 12:16:55 +00:00
Kamil Jarosz
355613342e [naga] Add packed as a keyword for GLSL
Turns out that sometimes `packed` is a keyword,
and the produced GLSL had syntax errors due to that.
2024-06-24 11:21:24 +02:00
Nicolas Silva
1de04926b1
Add infrastructure for counting and reporting internal resources (#5708)
* Add an optional system for counting and reporting internal resources and events
* Count API objects in wgpu-hal
* Expose internal counters in wgpu-core and wgpu.
2024-06-24 11:20:10 +02:00
Jim Blandy
afc8e38fc1 [naga] Use HandleVec in Layouter.
Change `naga::proc::layouter::Layouter::layouts` to be a `HandleVec`,
not a `Vec`.
2024-06-24 10:32:49 +02:00
Jim Blandy
9f0a7cb184 [naga] Use HandleVec in ExpressionKindTracker.
Change `naga::proc::constant_evaluator::ExpressionKindTracker::inner`
from a `Vec` to a `HandleVec`, for better type-checking and more
convenient indexing. Change uses accordingly.
2024-06-24 10:32:34 +02:00
Jim Blandy
056d0db43e [naga] Use HandleVec in Typeifier.
Change `naga::front::Typifier::resolutions` to be a
`HandleVec<Expression, TypeResolution>`, not a plain `Vec`.
2024-06-24 10:32:20 +02:00
dependabot[bot]
4b485fdb0e
build(deps): bump crate-ci/typos from 1.22.7 to 1.22.9 (#5867)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.22.7 to 1.22.9.
- [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.22.7...v1.22.9)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  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>
2024-06-24 09:11:59 +02:00
Erich Gubler
f227ca1258 docs(CHANGELOG): add entry for #5812
Permalink: <https://github.com/gfx-rs/wgpu/issues/5812>
2024-06-23 03:40:32 -07:00
Théo Monnom
0f6abc99ee
[naga-cli] add --defines options for the glsl parser (#5859) 2024-06-23 07:21:56 +00:00
Schell Carl Scivally
6405dcf611 [naga spv-in] Adjust types of globals used by atomic instructions.
To support atomic instructions in the SPIR-V front end, observe which
global variables the input accesses using atomic instructions, and
adjust their types from ordinary scalars to atomic values.

See comments in `naga::front::atomic_upgrade`.
2024-06-21 21:51:25 -07:00
Jim Blandy
717507977e [naga] Fix cargo doc --document-private-items. 2024-06-21 21:51:25 -07:00
Elabajaba
35477dff9a automatically check for subgroup support when creating a naga Validator 2024-06-21 10:20:25 +02:00
Jim Blandy
9b5035cee1 [naga] Introduce HandleVec.
Introduce a new type, `HandleVec<T, U>`, which is basically a
`Vec<U>`, except that it's indexed by values of type `Handle<T>`. This
gives us a more strictly typed way to build tables of data parallel to
some other `Arena`.

Change `naga:🔙:pipeline_constants` to use `HandleVec` instead of
`Vec`. This removes many calls to `Handle::index`, and makes the types
more informative.

In `naga:🔙:spv`, change `Writer` and `BlockContext` to use
`HandleVec` instead of `Vec` for various handle-indexed tables.
2024-06-21 10:16:01 +02:00