Commit Graph
1479 Commits
Author SHA1 Message Date
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
Elabajaba 35477dff9a automatically check for subgroup support when creating a naga Validator 2024-06-21 10:20:25 +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
teoxoy ef2da1a6d7 rename UsageConflict to ResourceUsageCompatibilityError 2024-06-20 16:34:17 +02:00
teoxoy 5f6848eddf remove IDs from UsageConflict variants 2024-06-20 16:34:17 +02:00
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