Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check to ensure vulkan::CommandEncoder::discard_encoding is not called multiple times in a row #5557

Merged
merged 7 commits into from
Apr 22, 2024
Prev Previous commit
Next Next commit
Documentation and changelog
  • Loading branch information
villuna committed Apr 18, 2024
commit cf5085af82e1e9b58f068940105a2123f9b9a4a4
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ Bottom level categories:
- Implement the `device_set_device_lost_callback` method for `ContextWebGpu`. By @suti in [#5438](https://github.com/gfx-rs/wgpu/pull/5438)
- Add support for storage texture access modes `ReadOnly` and `ReadWrite`. By @JolifantoBambla in [#5434](https://github.com/gfx-rs/wgpu/pull/5434)

#### Vulkan

- Make `CommandEncoder::discard_encoding` do nothing if called multiple times, and implement `Drop` for `CommandEncoder` to call `discard_encoding`. By @villuna

### Bug Fixes

#### General
Expand Down
8 changes: 8 additions & 0 deletions wgpu-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,10 @@ pub trait Queue: WasmNotSendSync {
/// live `CommandBuffers` built from it. All the `CommandBuffer`s
/// are destroyed, and their resources are freed.
///
/// You may want to implement the [core::ops::Drop] trait to discard
/// the current commands before the encoder is dropped (e.g. using
/// [CommandEncoder::discard_encoding]).
jimblandy marked this conversation as resolved.
Show resolved Hide resolved
///
/// # Safety
///
/// - The `CommandEncoder` must be in the states described above to
Expand Down Expand Up @@ -652,6 +656,10 @@ pub trait CommandEncoder: WasmNotSendSync + fmt::Debug {
///
/// This puts this `CommandEncoder` in the "closed" state.
///
/// Implementations of this function must be idempotent, i.e.
/// if the function has just been called, calling it again should
/// not do anything.
jimblandy marked this conversation as resolved.
Show resolved Hide resolved
///
/// # Safety
///
/// This `CommandEncoder` must be in the "recording" state.
Expand Down
Loading