Commit Graph

1932 Commits

Author SHA1 Message Date
Erich Gubler
2f81ae156c
style: use concat!(…) in DOWNLEVEL_*_MESSAGE (#6305) 2024-09-22 00:27:32 +00:00
Erich Gubler
841e7c8857
fix: only log Device::maintain waits if they happen (#6303) 2024-09-21 18:47:35 +02:00
Erich Gubler
9977edc51f
chore!: remove #[no_mangle] … extern "C" … from fns in bundle_ffi (#6272) 2024-09-21 16:33:13 +00:00
Erich Gubler
0d339fc9f1
chore: suppress unused_qualifications for wgpu_core::id const. assertions (#6295) 2024-09-18 21:48:04 +02:00
Teodor Tanasoaia
c8beade187
remove backend from ID (#6263) 2024-09-13 17:30:38 +02:00
Adam Winiarczuk
f3cbd6ce54
fix: Set mip_level_count in TextureInitTracker for externally created textures (#6249)
Co-authored-by: Adam Winiarczuk <tsu@liv.tv>
2024-09-10 22:28:36 +00:00
teoxoy
c4110afc7f [wgpu-core] inline Storage.insert_impl() 2024-09-10 11:58:54 +02:00
teoxoy
2addb267fc [wgpu-core] remove FutureId.into_id() 2024-09-10 11:58:54 +02:00
teoxoy
c182d3f24f [wgpu-core] rename .strict_unregister() & .strict_remove() to .remove() 2024-09-10 11:58:54 +02:00
teoxoy
ac74f36590 [wgpu-core] rename .strict_get() to .get() 2024-09-10 11:58:54 +02:00
teoxoy
31edbfd0dc [wgpu-core] use .strict_get() & .strict_unregister() for command buffers
We now only rely on the presence of the inner `CommandBufferMutable` to determine if command buffers are invalid.
2024-09-10 11:58:54 +02:00
teoxoy
c0c594eff2 [wgpu-core] use Fallible for RenderBundle 2024-09-10 11:58:54 +02:00
teoxoy
ee3b63a9af [wgpu-core] use Fallible for PipelineCache 2024-09-10 11:58:54 +02:00
teoxoy
5bcdd4266e [wgpu-core] use Fallible for ShaderModule 2024-09-10 11:58:54 +02:00
teoxoy
1c5793afb3 [wgpu-core] use Fallible for PipelineLayout 2024-09-10 11:58:54 +02:00
teoxoy
e444e78d94 [wgpu-core] use Fallible for BindGroupLayout 2024-09-10 11:58:54 +02:00
teoxoy
45206e553d [wgpu-core] use Fallible for RenderPipeline 2024-09-10 11:58:54 +02:00
teoxoy
82ce2ea747 [wgpu-core] use Fallible for ComputePipeline 2024-09-10 11:58:54 +02:00
teoxoy
b42500ee40 [wgpu-core] use Fallible for BindGroup 2024-09-10 11:58:54 +02:00
teoxoy
2ea314e978 [wgpu-core] remove Arc around StagingBuffer 2024-09-10 11:58:54 +02:00
teoxoy
b14fe14e88 [wgpu-core] use Fallible for QuerySet 2024-09-10 11:58:54 +02:00
teoxoy
3ed1abc492 [wgpu-core] use Fallible for Sampler 2024-09-10 11:58:54 +02:00
teoxoy
04f17d4197 [wgpu-core] use Fallible for TextureView 2024-09-10 11:58:54 +02:00
teoxoy
c630821f1d [wgpu-core] use Fallible for Texture 2024-09-10 11:58:54 +02:00
teoxoy
68e8b7d4a8 [wgpu-core] introduce Fallible and use it for Buffer (first step of invalidity internalization) 2024-09-10 11:58:54 +02:00
teoxoy
3437589107 [wgpu-core] use .strict_get() & .strict_unregister() for devices
This works because we never assign errors to devices (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy
07c397a1e5 [wgpu-core] use .strict_get() & .strict_unregister() for queues
This works because we never assign errors to queues (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy
aa280ecd44 [wgpu-core] change return type of device creation methods to be more rusty
This is fine from the WebGPU spec's perspective as device creation returns a promise that can reject.
2024-09-10 11:58:54 +02:00
teoxoy
da9afea271 [wgpu-core] use .strict_get() & .strict_unregister() for surfaces
This works because we never assign errors to surfaces (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy
98426329a4 [wgpu-core] introduce Registry .strict_get() & .strict_unregister() and use them for adapters
This works because we never assign errors to adapters (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy
70a9c01b48 [wgpu-core] make the Registry generic over T: Clone 2024-09-10 11:58:54 +02:00
teoxoy
d550342f47 [wgpu-core] use device.instance_flags when possible 2024-09-10 11:58:54 +02:00
teoxoy
480abae331 fix ordering of device.valid.store in device_destroy 2024-09-09 15:03:19 +02:00
teoxoy
eb47449eb9 invalidate the device when we encounter driver-induced device loss or on unexpected errors 2024-09-09 15:03:19 +02:00
Brad Werth
9b36a3e129
Make bind group an Option for set_bind_group calls. (#6216)
This is just an API change for all the "set_bind_group" calls. Calls
that pass a Some() argument should have unchanged behavior. The None
cases are left as TODOs.
2024-09-06 14:29:09 -07:00
Erich Gubler
0e352f5b34
Resolve lints for Rust 1.78-1.81 that can be preempted before upgrade (#6225)
* chore: remove `Context` methods detected as dead code

This is detected by `rustc` as of Rust 1.79.0.

* refactor: satisfy `clippy::manual_inspect`

Detected as of Rust 1.81.0.

* refactor: satisfy `clippy::needless_borrows_for_generic_args`

Detected as of Rust 1.81.0.

* refactor: suppress false-positive `dead_code` lint for `SubmissionIndex`

* chore: eliminate `dead_code` when `target_os = "emscripten"`
2024-09-06 11:55:22 +02:00
Valaphee The Meerkat
07684d3623
Rename Rg11b10UFloat to Rg11b10Ufloat (#6226) 2024-09-06 11:46:49 +02:00
Nicolas Silva
81963e24ca
Fix the internal buffer and texture count (#6223)
Currently, we only increment the internal buffer/texture counters when creating them in the regular way (not when creating them from externally built hal objects (create_texture_from_hal/create_buffer_from_hal). However we decrement the counter in all cases, which makes the counters incorrect when these externally created resources are involved.

This commit fixes it by adding hooks (add_raw_buffer and add_raw_texture) in the hal device abstractions to inform when buffer or textures are created externally.
2024-09-05 18:53:01 +00:00
Erich Gubler
ec21000521 refactor: lock::observing: extract fn addr from ref. conv. to usize 2024-09-05 11:08:51 -04:00
Erich Gubler
63a24d37c3 chore: satisfy clippy::ref_as_ptr 2024-09-05 11:08:51 -04:00
Jim Blandy
36124b12c5
[core] Update docs for private items. (#6219)
Make `cargo doc --document-private-items` work again in wgpu-core.
2024-09-05 10:15:27 +02:00
Teodor Tanasoaia
4e78829d82
[wgpu-core] when mapping buffers for reading, mark buffers as initialized only when they have MAP_WRITE usage (#6178) 2024-09-04 14:57:08 +00:00
Jim Blandy
ee35b0e586 [core, hal, types] Clarify wgpu_hal's bounds check promises.
In `wgpu_hal`:

- Document that `wgpu_hal` guarantees that shaders will not access buffer
  contents beyond the bindgroups' bound regions, rounded up to some
  adapter-specific alignment. Introduce the term "accessible region" for
  the portion of the buffer that shaders can actually get at.

- Document that all bets are off if you disable bounds checks with
  `ShaderModuleDescriptor::runtime_checks`.

- Provide this alignment in `wgpu_hal::Alignments`. Update all backends
  appropriately.

- In the Vulkan backend, use Naga to inject bounds checks on buffer accesses
  unless `robustBufferAccess2` is available; `robustBufferAccess` is not
  sufficient. Retrieve `VK_EXT_robustness2`'s properties, as needed to discover
  the alignment above.

In `wgpu_core`:

- Use buffer bindings' accessible regions to determine which parts of the buffer
  need to be initialized.

In `wgpu_types`:

- Document some of the possible effects of using
  `ShaderBoundsChecks::unchecked`.

Fixes #1813.
2024-09-03 12:33:02 -04:00
Jim Blandy
de7765bd28 [core]: Let Device::create_buffer_binding get limits from self.
Rather than passing `self.limits` to `Device::create_buffer_binding`
as an argument, let it simply refer to `self.limits` itself.
2024-09-03 12:33:02 -04:00
Jim Blandy
9ebc50fc1e [core] Remove unnecessary pub(crate) from Device methods.
Remove the `pub(crate)` visibility marking from various associated
functions of `Device` that are defined in, and not used outside of,
the `wgpu_core::device::resource` module.
2024-09-03 12:33:02 -04:00
Jim Blandy
9d24406d29 [core] Simplify self types in device::resource.
Change various functions that have no need to create an owning
reference to the `Device` to accept `&self` instead of `&Arc<Self>`.

Change `ParentDevice::same_device` to accept `&Device` as the point of
comparison, not `&Arc<Device>`. Call sites will use Deref conversion,
so no callers need to be changed.
2024-09-03 12:33:02 -04:00
Jim Blandy
504ff3e1a6 [core] Rename map_buffer to resolve_buffer, etc.
In `Device::create_bind_group`, name the functions that convert
resource ids to Arcs `resolve_foo`, not `map_foo`:

- The types that hold Arcs are usually called `ResolvedBlah`.

- The name `map_buffer` is misleading.
2024-09-03 12:33:02 -04:00
BlackStone1123
8eb0e6451b
fix wrong count buffer id (#6194)
Co-authored-by: Jasper Wu <wuq141@vanke.com>
2024-09-02 11:37:37 +00:00
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
Jim Blandy
3f6f1d766c [core] Add #[track_caller] to Registry lock methods. 2024-08-28 22:44:20 -04:00