Commit Graph

1605 Commits

Author SHA1 Message Date
teoxoy
123a59ae7b change return type of ResourceMetadataProvider.get to &Arc<T> 2024-06-20 16:34:17 +02:00
teoxoy
26eceabe86 move body of BufferUsageScope.insert_merge_single in BufferUsageScope.merge_single 2024-06-20 16:34:17 +02:00
teoxoy
aaec1c37b9 take resource lookup out of BufferUsageScope.merge_single 2024-06-20 16:34:17 +02:00
teoxoy
f5072261c7 remove ID from QueueSubmitError::BufferStillMapped 2024-06-20 16:34:17 +02:00
teoxoy
b0d2517bf4 change BindGroup.raw to BindGroup.try_raw 2024-06-20 16:34:17 +02:00
teoxoy
08f5eb82cd introduce TextureView.try_raw 2024-06-20 16:34:17 +02:00
teoxoy
7bd9195aa2 take resource lookup out of StatelessTracker.add_single 2024-06-20 16:34:17 +02:00
teoxoy
2ec7254772 remove old comment 2024-06-20 16:34:17 +02:00
teoxoy
a024afe182 consolidate destroyed texture/buffer errors and separate them from invalid ID errors 2024-06-20 16:34:17 +02:00
teoxoy
97a038a768 make return type of TextureTracker.set_single non-optional 2024-06-20 16:34:17 +02:00
teoxoy
d2218398ff take buffer lookup out of BufferBindGroupState.add_single 2024-06-20 16:34:17 +02:00
teoxoy
6a181fa634 remove IDs from StatelessBindGroupState 2024-06-20 16:34:17 +02:00
teoxoy
a979d2ed46 simplify BufferTracker.set_single's return type 2024-06-20 16:34:17 +02:00
teoxoy
862f19524f make check_texture_usage a texture method 2024-06-20 16:34:17 +02:00
teoxoy
87382d7133 make check_buffer_usage a buffer method 2024-06-20 16:34:17 +02:00
teoxoy
068da49a4c use error_ident for log instead of ID 2024-06-20 16:34:17 +02:00
teoxoy
836f016dcd use the tracker index as key in hashmap instead of ID 2024-06-20 16:34:17 +02:00
teoxoy
0c4b449644 use Arc::ptr_eq for resource equality 2024-06-20 16:34:17 +02:00
teoxoy
a21bbdccf0 remove usage of Buffer IDs in clear code 2024-06-20 16:34:17 +02:00
teoxoy
8465a64104 remove usage of Texture IDs in clear code 2024-06-20 16:34:17 +02:00
teoxoy
2a7f09aebc make clear_texture_via_render_passes infallible (in practice it was already) 2024-06-20 16:34:17 +02:00
teoxoy
8d805c99d3 remove TextureBindGroupState.add_single's return type 2024-06-20 16:34:17 +02:00
teoxoy
43177d78d6 replace uses of Id.backend() with A::VARIANT 2024-06-20 16:34:17 +02:00
Jim Blandy
584f9e189c [core] Improve resource and api logging.
- Improve logging in `StatelessTracker::remove_abandoned` to show the
  outcome of the call.

- Add similar logging to `BufferTracker` and `TextureTracker`.

- Let `device_create_buffer`'s log only the new buffer's label, id,
  and whether it's mapped at creation. It used to show the whole
  descriptor, which is too much detail.

- Have `queue_submit` log the submission id, and have `device_poll`
  log what it was waiting for, and what actually got done.

- Have `Device::drop` log the destruction of the raw device when it
  actually happens, so it's properly ordered with respect to logging
  from other parts of the device, like `Device::command_allocator`.
2024-06-19 21:13:38 -07:00
teoxoy
284c807abc reorder map_async validation steps 2024-06-19 14:05:18 +02:00
teoxoy
cc7b2db235 move map_async body in a new buffer method 2024-06-19 14:05:18 +02:00
teoxoy
0b7a5b054b move command encoder/buffer creation in a new device method 2024-06-19 14:05:18 +02:00
teoxoy
4b5666ceff move most device validity checks inside the device's methods 2024-06-19 14:05:18 +02:00
teoxoy
edc2cd9615 introduce Device.check_is_valid 2024-06-19 14:05:18 +02:00
teoxoy
508ece312d remove device invalidity checks from property accessors
accessing those properties is always fine
2024-06-19 14:05:18 +02:00
teoxoy
3e44a98088 remove device validity checks from create_{texture,buffer}_from_hal
those resources have been created already, we don't need to make sure the device is valid
2024-06-19 14:05:18 +02:00
teoxoy
14e750205a move BGL same device check inside create_bind_group 2024-06-19 11:15:38 +02:00
teoxoy
c01a1335aa rename WrongDevice to DeviceMismatch 2024-06-19 11:15:38 +02:00
teoxoy
ce716adb5e improve device mismatch errors 2024-06-19 11:15:38 +02:00
teoxoy
adfb183dc0 move same device validation in compute_pass_end_impl 2024-06-19 11:15:38 +02:00
teoxoy
53f8477b15 validate for same device via Arc::ptr_eq rather than IDs 2024-06-19 11:15:38 +02:00
Erich Gubler
4a1174b5ed refactor: use linear flow instead of broken loop for determining fallback 2024-06-17 05:26:03 -04:00
Erich Gubler
b9e787e667 refactor: satisfy clippy::never_loop 2024-06-17 05:26:03 -04:00
Erich Gubler
702c8cb693
style: strip trailing whitespace from lock::ranked module (#5815) 2024-06-14 13:45:34 -04:00
Erich Gubler
d7a35ecda0
typo: s/StatelessBindGroupSate/StatelessBindGroupState/ (#5810) 2024-06-13 13:03:00 -04:00
Elabajaba
2eb872e6f7
Deduplicate submitted surfaces to avoid a vulkan deadlock/crash (#5799) 2024-06-12 14:39:26 -04:00
Andreas Reich
eb24be47e1
Validate for device mismatch during compute pass recording (#5779)
* compute pass recording device validation

* add changelog entry

* validate device of timestamp query set as well
2024-06-10 12:19:50 +02:00
Atlas Dostal
abba12ae4e Add support for 64 bit integer atomic operations in shaders.
Add the following flags to `wgpu_types::Features`:

- `SHADER_INT64_ATOMIC_ALL_OPS` enables all atomic operations on `atomic<i64>` and
  `atomic<u64>` values.

- `SHADER_INT64_ATOMIC_MIN_MAX` is a subset of the above, enabling only
  `AtomicFunction::Min` and `AtomicFunction::Max` operations on `atomic<i64>` and
  `atomic<u64>` values in the `Storage` address space. These are the only 64-bit
  atomic operations available on Metal as of 3.1.

Add corresponding flags to `naga::valid::Capabilities`. These are supported by the
WGSL front end, and all Naga backends.

Platform support:

- On Direct3d 12, in `D3D12_FEATURE_DATA_D3D12_OPTIONS9`, if
  `AtomicInt64OnTypedResourceSupported` and `AtomicInt64OnGroupSharedSupported` are
  both available, then both wgpu features described above are available.

- On Metal, `SHADER_INT64_ATOMIC_MIN_MAX` is available on Apple9 hardware, and on
  hardware that advertises both Apple8 and Mac2 support. This also requires Metal
  Shading Language 2.4 or later. Metal does not yet support the more general
  `SHADER_INT64_ATOMIC_ALL_OPS`.

- On Vulkan, if the `VK_KHR_shader_atomic_int64` extension is available with both the
  `shader_buffer_int64_atomics` and `shader_shared_int64_atomics` features, then both
  wgpu features described above are available.
2024-06-08 18:36:26 -07:00
Andreas Reich
9a27ba53ca
Fix QuerySet ownership of ComputePass (#5671)
* add new tests for checking on query set lifetime

* Fix ownership management of query sets on compute passes for write_timestamp, timestamp_writes (on desc) and pipeline statistic queries

* changelog entry
2024-06-04 07:47:27 +00:00
dependabot[bot]
dd86dcf8f8
build(deps): bump the patch-updates group with 19 updates (#5770)
Bumps the patch-updates group with 19 updates:

| Package | From | To |
| --- | --- | --- |
| [parking_lot](https://github.com/Amanieu/parking_lot) | `0.12.2` | `0.12.3` |
| [serde](https://github.com/serde-rs/serde) | `1.0.202` | `1.0.203` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.37.0` | `1.38.0` |
| [syn](https://github.com/dtolnay/syn) | `2.0.65` | `2.0.66` |
| [backtrace](https://github.com/rust-lang/backtrace-rs) | `0.3.71` | `0.3.72` |
| [bytemuck_derive](https://github.com/Lokathor/bytemuck) | `1.6.0` | `1.7.0` |
| [crc32fast](https://github.com/srijs/rust-crc32fast) | `1.4.0` | `1.4.2` |
| [deno_unsync](https://github.com/denoland/deno_unsync) | `0.3.3` | `0.3.4` |
| [gimli](https://github.com/gimli-rs/gimli) | `0.28.1` | `0.29.0` |
| [objc-sys](https://github.com/madsmtm/objc2) | `0.3.3` | `0.3.5` |
| [object](https://github.com/gimli-rs/object) | `0.32.2` | `0.35.0` |
| [plotters](https://github.com/plotters-rs/plotters) | `0.3.5` | `0.3.6` |
| [plotters-backend](https://github.com/plotters-rs/plotters) | `0.3.5` | `0.3.6` |
| [plotters-svg](https://github.com/plotters-rs/plotters) | `0.3.5` | `0.3.6` |
| [polling](https://github.com/smol-rs/polling) | `3.7.0` | `3.7.1` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.83` | `1.0.85` |
| [serde_derive](https://github.com/serde-rs/serde) | `1.0.202` | `1.0.203` |
| [tokio-macros](https://github.com/tokio-rs/tokio) | `2.2.0` | `2.3.0` |
| [wayland-backend](https://github.com/smithay/wayland-rs) | `0.3.3` | `0.3.4` |


Updates `parking_lot` from 0.12.2 to 0.12.3
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/compare/0.12.2...0.12.3)

Updates `serde` from 1.0.202 to 1.0.203
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.202...v1.0.203)

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

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

Updates `backtrace` from 0.3.71 to 0.3.72
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.71...0.3.72)

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

Updates `crc32fast` from 1.4.0 to 1.4.2
- [Commits](https://github.com/srijs/rust-crc32fast/compare/v1.4.0...v1.4.2)

Updates `deno_unsync` from 0.3.3 to 0.3.4
- [Commits](https://github.com/denoland/deno_unsync/commits)

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

Updates `objc-sys` from 0.3.3 to 0.3.5
- [Commits](https://github.com/madsmtm/objc2/compare/objc-sys-0.3.3...objc-sys-0.3.5)

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

Updates `plotters` from 0.3.5 to 0.3.6
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.5...v0.3.6)

Updates `plotters-backend` from 0.3.5 to 0.3.6
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.5...v0.3.6)

Updates `plotters-svg` from 0.3.5 to 0.3.6
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.5...v0.3.6)

Updates `polling` from 3.7.0 to 3.7.1
- [Release notes](https://github.com/smol-rs/polling/releases)
- [Changelog](https://github.com/smol-rs/polling/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/polling/compare/v3.7.0...v3.7.1)

Updates `proc-macro2` from 1.0.83 to 1.0.85
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.83...1.0.85)

Updates `serde_derive` from 1.0.202 to 1.0.203
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.202...v1.0.203)

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

Updates `wayland-backend` from 0.3.3 to 0.3.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)

---
updated-dependencies:
- dependency-name: parking_lot
  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: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: backtrace
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck_derive
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: crc32fast
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: deno_unsync
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: gimli
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: objc-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: plotters
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: plotters-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: plotters-svg
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: polling
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: proc-macro2
  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: tokio-macros
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: wayland-backend
  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-06-03 09:20:29 +02:00
Connor Fitzgerald
c7458638d1
[hal/vk] Rework Submission and Surface Synchronization (#5681)
Fix two major synchronization issues in `wgpu_val::vulkan`:

- Properly order queue command buffer submissions. Due to Mesa bugs, two semaphores are required even though the Vulkan spec says that only one should be necessary.

- Properly manage surface texture acquisition and presentation:

    - Acquiring a surface texture can return while the presentation engine is still displaying the texture. Applications must wait for a semaphore to be signaled before using the acquired texture.

    - Presenting a surface texture requires a semaphore to ensure that drawing is complete before presentation occurs.

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-05-30 13:53:34 -07:00
Brad Werth
9b7a965667 Add an experimental vertex pulling flag to Metal pipelines.
This proves a flag in msl::PipelineOptions that attempts to write all
Metal vertex entry points to use a vertex pulling technique. It does
this by:

1) Forcing the _buffer_sizes structure to be generated for all vertex
entry points. The structure has additional buffer_size members that
contain the byte sizes of the vertex buffers.
2) Adding new args to vertex entry points for the vertex id and/or
the instance id and for the bound buffers. If there is an existing
@builtin(vertex_index) or @builtin(instance_index) param, then no
duplicate arg is created.
3) Adding code at the beginning of the function for vertex entry points
to compare the vertex id or instance id against the lengths of all the
bound buffers, and force an early-exit if the bounds are violated.
4) Extracting the raw bytes from the vertex buffer(s) and unpacking
those bytes into the bound attributes with the expected types.
5) Replacing the varyings input and instead using the unpacked
attributes to fill any structs-as-args that are rebuilt in the entry
point.

A new naga test is added which exercises this flag and demonstrates the
effect of the transform. The msl generated by this test passes
validation.

Eventually this transformation will be the default, always-on behavior
for Metal pipelines, though the flag may remain so that naga
translation tests can be run with and without the tranformation.
2024-05-30 13:08:59 +02:00
Mads Marquart
60a14c67fb
Remove the link Cargo feature (#5752) 2024-05-29 15:55:33 -07:00
Andreas Reich
588950110a
Remove lifetime dependency of ComputePass to its parent command encoder (#5620)
* lift encoder->computepass lifetime constraint and add now failing test
* compute passes now take an arc to their parent command encoder, thus removing compile time dependency to it
* Command encoder goes now into locked state while compute pass is open
* changelog entry
* share most of the code between get_encoder and lock_encoder
2024-05-29 22:43:24 +00:00
Teodor Tanasoaia
b5b39f670d remove redundant code in module interface validation
`TypeInner.size()` already handles the array case
2024-05-28 14:09:56 -04:00