Fix BufferMapRange not being Send/Sync (on native) (#4818)

* Make `BufferMappedRange` trait WasmNotSendSync

* make QueueWriteBuffer trait Debug

* add changelog

* fix pr numbers in changelog

* missing send/sync on web.rs on BufferMappedRange for fragile-send-sync-non-atomic-wasm + !atomics
This commit is contained in:
Andreas Reich authored and GitHub committed 2023-12-09 11:25:27 +00:00
1 parent 0a81ec377a
commit d801c6111d
3 files changed
+17 -3

No files matched your search

+5 -1
View File
@@ -59,7 +59,7 @@ This feature allowed you to call `global_id` on any wgpu opaque handle to get a
#### General
- Added `DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW` to know if `@builtin(vertex_index)` and `@builtin(instance_index)` will respect the `first_vertex` / `first_instance` in indirect calls. If this is not present, both will always start counting from 0. Currently enabled on all backends except DX12. By @cwfitzgerald in [#4722](https://github.com/gfx-rs/wgpu/pull/4722)
- No longer validate surfaces against their allowed extent range on configure. This caused warnings that were almost impossible to avoid. As before, the resulting behavior depends on the compositor. By @wumpf in [#????](https://github.com/gfx-rs/wgpu/pull/????)
- No longer validate surfaces against their allowed extent range on configure. This caused warnings that were almost impossible to avoid. As before, the resulting behavior depends on the compositor. By @wumpf in [#4796](https://github.com/gfx-rs/wgpu/pull/4796)
- Added support for the float32-filterable feature. By @almarklein in [#4759](https://github.com/gfx-rs/wgpu/pull/4759)
#### OpenGL
@@ -157,6 +157,10 @@ Passing an owned value `window` to `Surface` will return a `Surface<'static>`. S
### Bug Fixes
#### General
- `BufferMappedRange` trait is now `WasmNotSendSync`, i.e. it is `Send`/`Sync` if not on wasm or `fragile-send-sync-non-atomic-wasm` is enabled. By @wumpf in [#4818](https://github.com/gfx-rs/wgpu/pull/4818)
#### Vulkan
- Use `VK_EXT_robustness2` only when not using an outdated intel iGPU driver. By @TheoDulka in [#4602](https://github.com/gfx-rs/wgpu/pull/4602).
+10
View File
@@ -92,6 +92,16 @@ unsafe impl Send for Context {}
not(target_feature = "atomics")
))]
unsafe impl Sync for Context {}
#[cfg(all(
feature = "fragile-send-sync-non-atomic-wasm",
not(target_feature = "atomics")
))]
unsafe impl Send for BufferMappedRange {}
#[cfg(all(
feature = "fragile-send-sync-non-atomic-wasm",
not(target_feature = "atomics")
))]
unsafe impl Sync for BufferMappedRange {}
impl fmt::Debug for Context {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+2 -2
View File
@@ -4089,7 +4089,7 @@ where
}
}
pub trait QueueWriteBuffer: WasmNotSendSync {
pub trait QueueWriteBuffer: WasmNotSendSync + Debug {
fn slice(&self) -> &[u8];
fn slice_mut(&mut self) -> &mut [u8];
@@ -4097,7 +4097,7 @@ pub trait QueueWriteBuffer: WasmNotSendSync {
fn as_any(&self) -> &dyn Any;
}
pub trait BufferMappedRange: Debug {
pub trait BufferMappedRange: WasmNotSendSync + Debug {
fn slice(&self) -> &[u8];
fn slice_mut(&mut self) -> &mut [u8];
}