Commit Graph
905 Commits
Author SHA1 Message Date
Nicolas Silva f25e07b984 Fix soundness issue with Snatchable
The code was written with the incorrect assumption that if no lifetime is specified in a method definition, then all lifetimes are elided to the lifetime of self. In fact only lifetimes in the returned value are elided to the lifetime of self, and other parameters get their own lifetimes.

Kudos to @teoxoy for catching the issue!
2024-07-01 18:41:12 +02:00
Andreas Reich 0a76c0fa84 Renderpass take resource ownership (#5884)
* share timestamp write struct

* Make name of set_push_constants methods consistently plural

* remove lifetime bounds of resources passed into render pass

* first render pass resource ownership test

* introduce dynrenderpass & immediately create ArcCommands and take ownership of resources passed on pass creation

* Use of dynrenderpass in deno

* Separate active occlusion & pipeline statitics query

* resolve render/compute command is now behind `replay` feature

* add vertex & index buffer to ownership test

* test for pipeline statistics query

* add occlusion query set to pass resource test

* add tests for resource ownership of render pass query timestamps

* RenderPass can now be made 'static just like ComputePass. Add respective test

* Extend encoder_operations_fail_while_pass_alive test to also check encoder locking errors with render passes

* improve changelog entry on lifetime bounds
2024-07-01 18:36:24 +02:00
teoxoy a2c60cea4f remove render pipeline id from set render pipeline scope
and make sure that we use `ResourceErrorIdent` in all relevant inner errors
2024-06-27 10:20:11 +02:00
XiaoPeng 82210e1cdc remove stale weak refs before insert view/bind_groups 2024-06-26 10:18:07 +02:00
XiaoPeng 3d5d7dec02 clear refs to died texture views 2024-06-26 10:18:07 +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 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 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 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
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 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 08f5eb82cd introduce TextureView.try_raw 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 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 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 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 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
Elabajaba 2eb872e6f7 Deduplicate submitted surfaces to avoid a vulkan deadlock/crash (#5799) 2024-06-12 14:39:26 -04:00