Skip to content

Commit 91d872e

Browse files
authored
Merge branch 'trunk' into master
2 parents 7469572 + 234dea1 commit 91d872e

File tree

30 files changed

+1007
-199
lines changed

30 files changed

+1007
-199
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ jobs:
138138
set -e
139139
140140
# build for WebGPU
141+
cargo clippy --target ${{ matrix.target }} --tests --features glsl,spirv,fragile-send-sync-non-atomic-wasm
141142
cargo clippy --target ${{ matrix.target }} --tests --features glsl,spirv
142143
cargo doc --target ${{ matrix.target }} --no-deps --features glsl,spirv
143144

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Bottom level categories:
4545
#### Misc Breaking Changes
4646

4747
- Change `AdapterInfo::{device,vendor}` to be `u32` instead of `usize`. By @ameknite in [#3760](https://github.com/gfx-rs/wgpu/pull/3760)
48+
- Remove the `backend_bits` parameter in `initialize_adapter_from_env` and `initialize_adapter_from_env_or_default` - use [InstanceDescriptor::backends](https://docs.rs/wgpu/latest/wgpu/struct.InstanceDescriptor.html#structfield.backends) instead. By @fornwall in [#3904](https://github.com/gfx-rs/wgpu/pull/3904)
4849
- Arcanization of wgpu core resources: Removed 'Token' and 'LifeTime' related management,
4950
removed 'RefCount' and 'MultiRefCount' in favour of using only 'Arc' internal reference count, removing mut from resources and added instead internal members locks on demand or atomics operations, resources now implement Drop and destroy stuff when last 'Arc' resources is released, resources hold an 'Arc' in order to be able to implement Drop, resources have an utility to retrieve the id of the resource itself, removed all guards and just retrive the 'Arc' needed on-demand to unlock registry of resources asap removing locking from hot paths. By @gents83 in [#3626](https://github.com/gfx-rs/wgpu/pull/3626) and tnx also to @jimblandy
5051

@@ -55,6 +56,7 @@ removed 'RefCount' and 'MultiRefCount' in favour of using only 'Arc' internal re
5556
#### Vulkan
5657

5758
- Work around [Vulkan-ValidationLayers#5671](https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5671) by ignoring reports of violations of [VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912](https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912). By @jimblandy in [#3809](https://github.com/gfx-rs/wgpu/pull/3809).
59+
- Implement depth-clip-control using depthClamp instead of VK_EXT_depth_clip_enable. By @AlbinBernhardssonARM [#3892](https://github.com/gfx-rs/wgpu/pull/3892).
5860

5961
### Added/New Features
6062

@@ -63,17 +65,20 @@ removed 'RefCount' and 'MultiRefCount' in favour of using only 'Arc' internal re
6365
### Documentation
6466

6567
- Better documentation for draw, draw_indexed, set_viewport and set_scissor_rect. By @genusistimelord in [#3860](https://github.com/gfx-rs/wgpu/pull/3860)
68+
- Fix link to `GPUVertexBufferLayout`. By @fornwall in [#3906](https://github.com/gfx-rs/wgpu/pull/3906)
6669

6770
#### General
6871

6972
- Document feature requirements for `DEPTH32FLOAT_STENCIL8` by @ErichDonGubler in [#3734](https://github.com/gfx-rs/wgpu/pull/3734).
7073
- Flesh out docs. for `AdapterInfo::{device,vendor}` by @ErichDonGubler in [#3763](https://github.com/gfx-rs/wgpu/pull/3763).
7174
- Spell out which sizes are in bytes. By @jimblandy in [#3773](https://github.com/gfx-rs/wgpu/pull/3773).
75+
- On Web, types don't implement `Send` or `Sync` anymore. By @daxpedda in [#3691](https://github.com/gfx-rs/wgpu/pull/3691)
7276

7377
### Bug Fixes
7478

7579
- Fix order of arguments to glPolygonOffset by @komadori in [#3783](https://github.com/gfx-rs/wgpu/pull/3783).
7680
- Fix OpenGL/EGL backend not respecting non-sRGB texture formats in `SurfaceConfiguration`. by @liquidev in [#3817](https://github.com/gfx-rs/wgpu/pull/3817)
81+
- Make write- and read-only marked buffers match non-readonly layouts. by @fornwall in [#3893](https://github.com/gfx-rs/wgpu/pull/3893)
7782

7883
#### Metal
7984

Cargo.lock

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/common/src/framework.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,9 @@ async fn setup<E: Example>(title: &str) -> Setup {
180180

181181
(size, surface)
182182
};
183-
let adapter =
184-
wgpu::util::initialize_adapter_from_env_or_default(&instance, backends, Some(&surface))
185-
.await
186-
.expect("No suitable GPU adapters found on the system!");
183+
let adapter = wgpu::util::initialize_adapter_from_env_or_default(&instance, Some(&surface))
184+
.await
185+
.expect("No suitable GPU adapters found on the system!");
187186

188187
#[cfg(not(target_arch = "wasm32"))]
189188
{

tests/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ fn initialize_adapter() -> (Adapter, SurfaceGuard) {
422422
let compatible_surface: Option<&Surface> = compatible_surface.as_ref();
423423
let adapter = pollster::block_on(wgpu::util::initialize_adapter_from_env_or_default(
424424
&instance,
425-
backends,
426425
compatible_surface,
427426
))
428427
.expect("could not find suitable adapter on the system");

wgpu-core/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ targets = [
2222
[lib]
2323

2424
[features]
25-
default = []
25+
default = ["link"]
2626

2727
# Backends, passed through to wgpu-hal
2828
metal = ["hal/metal"]
@@ -31,6 +31,9 @@ gles = ["hal/gles"]
3131
dx11 = ["hal/dx11"]
3232
dx12 = ["hal/dx12"]
3333

34+
# Use static linking for libraries. Disale to manually link. Enabled by default.
35+
link = ["hal/link"]
36+
3437
# Support the Renderdoc graphics debugger:
3538
# https://renderdoc.org/
3639
renderdoc = ["hal/renderdoc"]
@@ -48,6 +51,8 @@ serial-pass = ["serde", "wgt/serde", "arrayvec/serde"]
4851
id32 = []
4952
# Enable `ShaderModuleSource::Wgsl`
5053
wgsl = ["naga/wgsl-in"]
54+
# Implement `Send` and `Sync` on Wasm.
55+
fragile-send-sync-non-atomic-wasm = ["hal/fragile-send-sync-non-atomic-wasm", "wgt/fragile-send-sync-non-atomic-wasm"]
5156

5257
[dependencies]
5358
arrayvec = "0.7"
@@ -80,6 +85,7 @@ version = "0.16"
8085
package = "wgpu-hal"
8186
path = "../wgpu-hal"
8287
version = "0.16"
88+
default_features = false
8389

8490
[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
8591
web-sys = { version = "0.3.60", features = ["HtmlCanvasElement", "OffscreenCanvas"] }

wgpu-core/src/command/bundle.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,21 @@ pub struct RenderBundle<A: HalApi> {
745745
pub(crate) info: ResourceInfo<RenderBundleId>,
746746
}
747747

748+
#[cfg(any(
749+
not(target_arch = "wasm32"),
750+
all(
751+
feature = "fragile-send-sync-non-atomic-wasm",
752+
not(target_feature = "atomics")
753+
)
754+
))]
748755
unsafe impl<A: HalApi> Send for RenderBundle<A> {}
756+
#[cfg(any(
757+
not(target_arch = "wasm32"),
758+
all(
759+
feature = "fragile-send-sync-non-atomic-wasm",
760+
not(target_feature = "atomics")
761+
)
762+
))]
749763
unsafe impl<A: HalApi> Sync for RenderBundle<A> {}
750764

751765
impl<A: HalApi> RenderBundle<A> {

wgpu-core/src/device/queue.rs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ pub struct SubmittedWorkDoneClosureC {
4444
pub user_data: *mut u8,
4545
}
4646

47+
#[cfg(any(
48+
not(target_arch = "wasm32"),
49+
all(
50+
feature = "fragile-send-sync-non-atomic-wasm",
51+
not(target_feature = "atomics")
52+
)
53+
))]
4754
unsafe impl Send for SubmittedWorkDoneClosureC {}
4855

4956
pub struct SubmittedWorkDoneClosure {
@@ -52,17 +59,30 @@ pub struct SubmittedWorkDoneClosure {
5259
inner: SubmittedWorkDoneClosureInner,
5360
}
5461

62+
#[cfg(any(
63+
not(target_arch = "wasm32"),
64+
all(
65+
feature = "fragile-send-sync-non-atomic-wasm",
66+
not(target_feature = "atomics")
67+
)
68+
))]
69+
type SubmittedWorkDoneCallback = Box<dyn FnOnce() + Send + 'static>;
70+
#[cfg(not(any(
71+
not(target_arch = "wasm32"),
72+
all(
73+
feature = "fragile-send-sync-non-atomic-wasm",
74+
not(target_feature = "atomics")
75+
)
76+
)))]
77+
type SubmittedWorkDoneCallback = Box<dyn FnOnce() + 'static>;
78+
5579
enum SubmittedWorkDoneClosureInner {
56-
Rust {
57-
callback: Box<dyn FnOnce() + Send + 'static>,
58-
},
59-
C {
60-
inner: SubmittedWorkDoneClosureC,
61-
},
80+
Rust { callback: SubmittedWorkDoneCallback },
81+
C { inner: SubmittedWorkDoneClosureC },
6282
}
6383

6484
impl SubmittedWorkDoneClosure {
65-
pub fn from_rust(callback: Box<dyn FnOnce() + Send + 'static>) -> Self {
85+
pub fn from_rust(callback: SubmittedWorkDoneCallback) -> Self {
6686
Self {
6787
inner: SubmittedWorkDoneClosureInner::Rust { callback },
6888
}

wgpu-core/src/error.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,22 @@ pub fn format_pretty_any(
162162
#[derive(Debug)]
163163
pub struct ContextError {
164164
pub string: &'static str,
165+
#[cfg(any(
166+
not(target_arch = "wasm32"),
167+
all(
168+
feature = "fragile-send-sync-non-atomic-wasm",
169+
not(target_feature = "atomics")
170+
)
171+
))]
165172
pub cause: Box<dyn Error + Send + Sync + 'static>,
173+
#[cfg(not(any(
174+
not(target_arch = "wasm32"),
175+
all(
176+
feature = "fragile-send-sync-non-atomic-wasm",
177+
not(target_feature = "atomics")
178+
)
179+
)))]
180+
pub cause: Box<dyn Error + 'static>,
166181
pub label_key: &'static str,
167182
pub label: String,
168183
}

wgpu-core/src/global.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,16 @@ impl<G: GlobalIdentityHandlerFactory> Drop for Global<G> {
161161
}
162162
}
163163

164-
#[cfg(test)]
164+
#[cfg(all(
165+
test,
166+
any(
167+
not(target_arch = "wasm32"),
168+
all(
169+
feature = "fragile-send-sync-non-atomic-wasm",
170+
not(target_feature = "atomics")
171+
)
172+
)
173+
))]
165174
fn _test_send_sync(global: &Global<crate::identity::IdentityManagerFactory>) {
166175
fn test_internal<T: Send + Sync>(_: T) {}
167176
test_internal(global)

0 commit comments

Comments
 (0)