* Change the signature of `wgpu_core::Global::queue_submit` to return
a `(SubmissionIndex, …)` in addition to its current error type.
* Change the control flow of errors in `Queue::submit` to break to the
end of a block. This is similar to what we already do in many APIs in
`wgpu_core`.
* Hoist the scope of the local `submit_index` binding so it can be used
at the point where we need to convert current error paths to also
return the submission index.
Later, we will likely want to avoid actually retrieving a new submission
index so we can minimize the critical section of code. We'll need to
figure out a strategy for returning a valid (but not necessarily unique)
index in the case of failures that prevent successful submission.
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.
* 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"`
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.
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.
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.
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.
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.
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.