Commit Graph
1024 Commits
Author SHA1 Message Date
Jim Blandy bbdbafdf8a [core] Add lock::observing module, for analyzing lock acquisition.
Add a new module `lock::observing`, enabled by the `observe-locks`
feature, that records all nested lock acquisitions in trace files.

Add a new utility to the workspace, `lock-analyzer`, that reads the
files written by the `observe-locks` feature and writes out a new
`define_lock_ranks!` macro invocation that covers all observed lock
usage, along with comments giving the held and acquired source
locations.
2024-08-28 22:44:20 -04:00
teoxoy 2c31414517 add an Unexpected variant to DeviceError 2024-08-15 13:56:05 +01:00
Andreas Reich 9794f33823 Handle webgl's queue_copy_external_image_to_texture 2024-08-14 17:34:11 +02:00
Andreas Reich 24498f04d4 The second unraveling: hub and all types on it are generic free!
gfx_select macros are empty husks now that are waiting to be removed
2024-08-14 17:34:11 +02:00
Andreas Reich 3181251577 Core adapter no longer uses any generics 2024-08-14 17:34:11 +02:00
Andreas Reich 04cadfb369 Core's Surface, Instance and Adapter use now dynamic hal types 2024-08-14 17:34:11 +02:00
Andreas Reich 7c7e4164f1 The big unraveling: core device now has a boxed DynDevice, ripple effects from there leading to boxing of almost all hal resources 2024-08-14 17:34:11 +02:00
Andreas Reich 276753f963 DynDevice create/destroy bind group
bindgroup fixup
2024-08-14 17:34:11 +02:00
Andreas Reich cda9d9af65 Buffer bindings no longer depend on hal api struct, but directly on buffer type 2024-08-14 17:34:11 +02:00
teoxoy 1aaaec22f6 use ManuallyDrop for texture views of TextureClearMode 2024-08-13 00:55:32 +02:00
teoxoy ce9c9b76f6 remove Option around A::SurfaceTexture
We can rely on the snatching mechanism to take the surface texture.
2024-08-13 00:55:32 +02:00
teoxoy 19843c9c5f use ManuallyDrop for Device.fence 2024-08-13 00:55:32 +02:00
teoxoy 728b288fda use ManuallyDrop for Device.zero_buffer 2024-08-13 00:55:32 +02:00
teoxoy c1bc0864c5 use ManuallyDrop for remaining resources 2024-08-13 00:55:32 +02:00
teoxoy cf5706c24b use Device.raw() instead of Device.raw.as_ref().unwrap() 2024-08-13 00:55:32 +02:00
teoxoy a6bc2f6f53 fix check for flush_mapped_ranges in map_buffer
`flush_mapped_ranges` needs to be called when mappings are not coherent.
We can also omit flushing for write-mapped buffers since we always flush them on unmap.
2024-08-12 14:20:56 +01:00
teoxoy f0875e8fda remove Buffer.sync_mapped_writes
`zero_init_needs_flush_now` was always equal to `mapping.is_coherent`
which is not correct but is fixed by the next commit.
2024-08-12 14:20:56 +01:00
teoxoy 5617f0fd17 call flush_mapped_ranges when unmapping write-mapped buffers
I'm not sure how things worked without this.
2024-08-12 14:20:56 +01:00
Teodor Tanasoaia 94f54b3dc8 Add a separate pipeline constants error (#6094) 2024-08-12 09:20:36 +02:00
Mehmet Oguz Derin 34b0df277c Support texture-compression-bc-sliced-3d in wgpu (#5751) 2024-08-10 12:02:29 +02:00
teoxoy f6a3eef77e change Device.create_shader_module to return an Arc<ShaderModule<A> 2024-08-08 18:49:52 +02:00
teoxoy d8b1c5788a change Device.create_command_encoder to return an Arc<CommandBuffer<A> 2024-08-08 18:49:52 +02:00
teoxoy 9ce1772f8e change Device.create_pipeline_cache to return an Arc<PipelineCache<A> 2024-08-08 18:49:52 +02:00
teoxoy 47465ddb1c change Device.create_pipeline_layout to return an Arc<PipelineLayout<A> 2024-08-08 18:49:52 +02:00
teoxoy 36c998a558 change Device.create_bind_group_layout to return an Arc<BindGroupLayout<A> 2024-08-08 18:49:52 +02:00
teoxoy 781b54a8b9 remove TrackingData from resources that are not tracked 2024-08-08 14:42:13 +02:00
teoxoy 8c7c5c4974 decouple device and queue IDs
Devices and queues can have different lifetimes, we shouldn't assume that their IDs match.
2024-08-05 15:46:12 +02:00
teoxoy 4e777bd0e7 merge the texture and texture view trackers of BindGroupStates 2024-08-03 11:58:14 +02:00
teoxoy 62af9d78b5 rename {Buffer,Texture}BindGroupState's add_single to insert_single
Also change it's definition to take an owned `Arc`. This makes these functions consistent with the other trackers.
2024-08-03 11:58:14 +02:00
teoxoy 5cb1be63aa refactor the StatelessTracker to hold a Vec of Arcs
Also removes the `StatelessBindGroupState` since it does the same thing.
2024-08-03 11:58:14 +02:00
teoxoy 3a5ad193db remove all internal BindGroupState Mutexes 2024-08-03 11:58:14 +02:00
Nicolas Silva 9c6ae1beae Log spring cleaning (#6065)
Remove unused logs in wgpu-core and wgpu-hal
2024-07-31 16:24:23 +00:00
AthosOfAthos bfad205cf5 Reduced verbosity for 'Device::maintain: waiting for submission index… (#6044) 2024-07-30 10:58:38 +02:00
teoxoy 650054bbcd [player] simplify sync buffer writing 2024-07-29 17:31:24 +02:00
teoxoy 7502e65213 remove unused Global.device_get_buffer_sub_data 2024-07-29 17:31:24 +02:00
teoxoy 2ea081fabf remove waiting functionality from Global.{buffer,texture,texture_view}_drop()
Those resources won't be destroyed if used by a submission anyway.
2024-07-29 17:31:24 +02:00
Samson 7462754bde Remove 'de: 'static" serde bound and replace &'static str with Cow in some errors (#6048)
* Remove `serde(bound(deserialize = "'de: 'static"))` and replace `&'static str` with `Cow` in deser errors

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Allow `clippy::result_large_err`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-29 09:07:26 +02:00
Andreas Reich d3c38a4fd0 Fix AnyDevice drop implementation dropping the wrong thing (#6052) 2024-07-26 10:31:36 +02:00
teoxoy 03f6d24ea6 deduplicate derived BGLs 2024-07-25 18:15:29 +02:00
Erich Gubler 65b6e15f0f chore: satisfy clippy::unused_qualifications 2024-07-24 12:09:15 -04:00
Erich Gubler 723995d9a9 refactor: warn on and satisfy clippy::{ptr_as_ptr,ref_as_ptr} in wgpu-{core,hal,types}
…using `cargo +1.79.0 clippy --workspace --all-features --all-targets
--fix`, plus some manual changes to (1) catch some missed cases (not run
on all platforms?) and (2) `--fix` doesn't make things compile again. 😀
2024-07-24 12:09:15 -04:00
Jim Blandy ebb011fc6b [core] Use ManuallyDrop for wgpu_core::device::Queue::raw.
Change the field `wgpu_core::device::Queue::raw` from an
`Option<A::Queue>` to a `std::mem::ManuallyDrop<A::Queue>`. Replace
various `.as_ref().unwrap()` chains with calls to a new accessor
function `Queue::raw`.

An `Option` is misleading, as this field is always populated during
the lifetime of a `Queue`. Instead, we simply have a field whose value
needs to be moved in `<Queue as Drop>::drop`; `ManuallyDrop` is the
Rust idiom for this situation.
2024-07-23 14:02:16 -07:00
teoxoy 205f1e3ab6 [wgpu-core] fix length of copy in queue_write_texture #2
Follow-up to 6f16ea460a & 7e112ca4c0.
2024-07-22 12:25:07 +02:00
Vladas Zakrevskis 5a0e2187f0 Print requested and supported usages on UnsupportedUsage error (#6007)
* Print requested and supported usages on UnsupportedUsage error

* fmt

* changelog
2024-07-21 21:12:28 -04:00
sagudev fc87033b30 Make BufferAccessError (de)serializable
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-19 13:37:57 -04:00
Brad Werth 6cd387412f Remove vertex_pulling_transfrom from PipelineCompilationOptions.
This option was only evaluated for Metal backends, and now it's required
there so the option is going away. It is still configurable for tests
via the PipelineOptions struct, deserialized from .ron files.

This also fixes some type problems with the unpack functions in
writer.rs. Metal << operator extends operand to int-sized, which then
has to be cast back down to the real size before as_type bit conversion.
The math for the snorm values is corrected, in some cases using the
metal unpack_snorm2x16_to_float function because we can't directly
cast a bit-shifted ushort value to half.
2024-07-19 17:13:45 +02:00
Nicolas Silva bc7622f641 Expose GPU allocation reports in wgpu, wgpu-core and wgpu-hal 2024-07-19 10:16:29 +02:00
Connor Fitzgerald 3c3b532cf3 Remove latest_submission_index (#5976)
* Remove latest_submission_index

* CI

* Comments
2024-07-18 16:43:39 +00:00
teoxoy 9a0adefe88 use ManuallyDrop instead of Option for PendingWrites 2024-07-18 10:30:11 -04:00
teoxoy 77e45d46df add missing device valid check in create_texture_view 2024-07-18 10:29:08 -04:00