Commit Graph

7689 Commits

Author SHA1 Message Date
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
Jim Blandy
d6c4d5c5c3 [naga] Manually implement serde traits for NonMaxU32.
When the appropriate features are enabled, manually implement
`serde::Serialize` and `serde::Deserialize`, such that the serialized
form of `NonMaxU32::new(n).unwrap()` is the same as that of `n`.

This eliminates the last trace of 1-based indices from Naga's snapshot
tests, and aligns `std::fmt::Debug` with the serialized form.
2024-06-21 10:09:03 +02:00
Jim Blandy
090c906cb7 [naga] Simplify function names and comments.
Remove the phrase "zero-based" from comments and function names. Now
that there is no mix of zero-based and one-based indices, there's no
need to call out the distinction.
2024-06-21 10:09:03 +02:00
Jim Blandy
9f498fd571 [naga] Use new NonMaxU32 type for Handle indices.
Define a new type, `NonMaxU32`, that can represent any `u32` value
except `u32::MAX`, defined such that `Option<NonMaxU32>` is still a
32-bit value.

Change `Handle` to use `NonMaxU32`. Adjust all code that works
directly with handle indices to assume zero-based indices, not
one-based indices.
2024-06-21 10:09:03 +02:00
Jim Blandy
7721e33693 [naga] Delete unused constant Handle::DUMMY. 2024-06-21 10:09:03 +02:00
Jim Blandy
beb89f7956 [naga msl-out] Use Handle::write_prefixed instead of index.
This replaces all uses of `Handle::index` for generating identifiers
in `naga:🔙:msl` with uses of `Handle::write_prefixed`.

There are still some uses of `Handle::index` remaining.
2024-06-21 09:56:40 +02:00
Jim Blandy
29aa68e9a3 [naga dot-out] Use Handle::write_prefixed instead of index.
This replaces all uses of `Handle::index` in `naga:🔙:dot` with
uses of `Handle::write_prefixed`.
2024-06-21 09:56:40 +02:00
Jim Blandy
92287c30b5 [naga hlsl-out] Use Baked for baked expressions.
Make the HLSL backend more like other backends by using `back::Baked`
to generate names for baked expression identifiers. This removes the
final uses of `Handle::index` from the HLSL backend.

This is separated out from the previous commit because it changes lots
of snapshot tests, whereas the previous commit has no effect on Naga's
output.
2024-06-21 09:56:40 +02:00
Jim Blandy
2a3c35383a [naga] Introduce Baked newtype for writing baked expression names.
Introduce a newtype `naga:🔙:Baked` that wraps a
`Handle<Expression>` and formats with `std::fmt::Display` as a baked
expression identifier. Use this in all backends for generating baked
identifiers.

Delete `BAKE_PREFIX`, as it's no longer used outside of `Baked`'s
`Display` implementation.

This is a step towards making `Handle::index` less prominent in the
code base.
2024-06-21 09:56:40 +02:00
teoxoy
1e784c9c0a use TrackerIndex instead of IDs in PendingWrites's fields 2024-06-20 16:34:17 +02:00
teoxoy
2e1e1cd26e inline id getters 2024-06-20 16:34:17 +02:00