From 7d763100104e842ddc83c6c3877d11124eac0389 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 14:51:06 -0400 Subject: [PATCH 01/12] style(CHANGELOG): restyle unreleased contents a bit --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index abf7044c23..e6330c4166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ Bottom level categories: ### Major Changes #### `wgpu-core` is no longer generic over `wgpu-hal` backends + Dynamic dispatch between different backends has been moved from the user facing `wgpu` crate, to a new dynamic dispatch mechanism inside the backend abstraction layer `wgpu-hal`. @@ -72,6 +73,7 @@ https://gpuweb.github.io/gpuweb/#programmable-passes-bind-groups specifies that is nullable. This change is the start of implementing this part of the spec. Callers that specify a `Some()` value should have unchanged behavior. Handling of `None` values still needs to be implemented by backends. + For convenience, the `set_bind_group` on compute/render passes & encoders takes `impl Into>`, so most code should still work the same. From 0c1fbb4662b13579f8b7d124424f79a64665028d Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 15:34:26 -0400 Subject: [PATCH 02/12] docs(CHANGELOG): change #6257 entry to match PR title --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6330c4166..c348a15867 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,7 +157,7 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216). #### Vulkan -- Vulkan debug labels assumed no interior nul byte. By @DJMcNab in [#6257](https://github.com/gfx-rs/wgpu/pull/6257) +- Avoid undefined behaviour with adversarial debug label. By @DJMcNab in [#6257](https://github.com/gfx-rs/wgpu/pull/6257) - Add `.index_type(vk::IndexType::NONE_KHR)` when creating `AccelerationStructureGeometryTrianglesDataKHR` in the raytraced triangle example to prevent a validation error. By @Vecvec in [#6282](https://github.com/gfx-rs/wgpu/pull/6282) ### Changes From 68255eb88099aab34d43e7d0b8b00ee5f483332b Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 15:34:26 -0400 Subject: [PATCH 03/12] docs(CHANGELOG): use imperative tense for #6108 entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c348a15867..ce7e02d017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -164,7 +164,7 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216). - `wgpu_hal::gles::Adapter::new_external` now requires the context to be current when dropping the adapter and related objects. By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114). - Reduce the amount of debug and trace logs emitted by wgpu-core and wgpu-hal. By @nical in [#6065](https://github.com/gfx-rs/wgpu/issues/6065) -- `Rg11b10Float` is renamed to `Rg11b10Ufloat`. By @sagudev in [#6108](https://github.com/gfx-rs/wgpu/pull/6108) +- Rename `Rg11b10Float` to `Rg11b10Ufloat`. By @sagudev in [#6108](https://github.com/gfx-rs/wgpu/pull/6108) - Invalidate the device when we encounter driver-induced device loss or on unexpected errors. By @teoxoy in [#6229](https://github.com/gfx-rs/wgpu/pull/6229). - Make Vulkan error handling more robust. By @teoxoy in [#6119](https://github.com/gfx-rs/wgpu/pull/6119). - Add bounds checking to Buffer slice method. By @beholdnec in [#6432](https://github.com/gfx-rs/wgpu/pull/6432). From 8237da7ab72564f16282d1cf99337cf6f0fa0579 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 15:34:26 -0400 Subject: [PATCH 04/12] docs(CHANGELOG): add high-level content for release --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce7e02d017..026643f994 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,8 +40,50 @@ Bottom level categories: ## Unreleased +### Themes of this release + +This release's theme is one that is likely to repeat for a few releases: convergence with the WebGPU specification! WGPU's design and base functionality are actually determined by two specifications: one for WebGPU, and one for the WebGPU Shading Language. + +This may not sound exciting, but let us convince you otherwise! All major web browsers have committed to offering WebGPU in their environment. Even JS runtimes like [Node][nodejs-webgpu-interest] and [Deno][deno_webgpu-crate-manifest] have communities that are very interested in providing WebGPU! WebGPU is slowly [eating the world][eat-the-world-meaning], as it were. 😀 It's really important, then, that WebGPU implementations behave in ways that one would expect across all platforms. For example, if Firefox's WebGPU implementation were to break when running scripts and shaders that worked just fine in Chrome, that would mean sad users for both application authors _and_ browser authors. + +[nodejs-webgpu-interest]: https://github.com/orgs/nodejs/discussions/41994 +[deno_webgpu-crate-manifest]: https://github.com/gfx-rs/wgpu/tree/64a61ee5c69569bbb3db03563997e88a229eba17/deno_webgpu#deno_webgpu +[eat-the-world-meaning]: https://www.quora.com/What-did-Marc-Andreessen-mean-when-he-said-that-software-is-eating-the-world + +WGPU also benefits from standard, portable behavior in the same way as web browsers. Because of this behavior, it's generally fairly easy to port over usage of WebGPU in JavaScript to WGPU. It is also what lets WGPU go full circle: WGPU can be an implementation of WebGPU on native targets, but _also_ it can use _other implementations of WebGPU_ as a backend in JavaScript when compiled to WASM. Therefore, the same dynamic applies: if WGPU's own behavior were significantly different, then WGPU and end users would be _sad, sad humans_ as soon as they discover places where their nice apps are breaking, right? + +The answer is: yes, we _do_ have sad, sad humans that really want their WGPU code to work _everywhere_. As Firefox and others use WGPU to implement WebGPU, the above example of Firefox diverging from standard is, unfortunately, today's reality. It _mostly_ behaves the same as a standards-compliant WebGPU, but it still doesn't in many important ways. Of particular note is Naga, its implementation of the WebGPU Shader Language. Shaders are pretty much a black-and-white point of failure in GPU programming; if they don't compile, then you can't use the rest of the API! And yet, it's extremely easy to run into this: + +```wgsl +fn gimme_a_float() -> f32 { + return 42; // fails in Naga, but standard WGSL happily converts to `f32` +} +``` + +We intend to continue making visible strides in converging with specifications for WebGPU and WGSL, as this release has. This is, unfortunately, one of the major reasons that WGPU has no plans to work hard at keeping a SemVer-stable interface for the foreseeable future; we have an entire platform of GPU programming functionality we have to catch up with, and SemVer stability is unfortunately in tension with that. So, for now, you're going to keep seeing major releases and breaking changes. Where possible, we'll try to make that painless, but compromises to do so don't always make sense with our limited resources. + +This is also the last planned major version release of 2024; the next milestone is set for January 1st, 2025, according to our regular 12-week cadence (offset from the originally planned date of 2024-10-09 for _this_ release 😅). We'll see you next year! + +### Contributor spotlight: @sagudev + +This release, we'd like to spotlight the work of @sagudev, who has made significant contributions to the WGPU ecosystem this release. Among other things, they contributed a particularly notable feature where runtime-known indices are finally allowed for use with `const` array values. For example, this WGSL shader previously wasn't allowed: + +```wgsl +const arr: array = array(1, 2, 3, 4); + +fn what_number_should_i_use(idx: u32) -> u32 { + return arr[idx]; +} +``` + +…but now it works! This is significant because this sort of shader rejection was one of the most impactful issues we are aware of for converging with the WGSL specification. There are more still to go—some of which we expect to even more drastically change how folks author shaders—but we suspect that many more will come in the next few releases, including with @sagudev's help. + +We're excited for more of @sagudev's contributions via the Servo community. Oh, did we forget to mention that these contributions were motivated by their work on Servo? That's right, a _third_ well-known JavaScript runtime is now using WGPU to implement its WebGPU implementation. We're excited to support Servo to becoming another fully fledged browsing environment this way. + ### Major Changes +In addition to the above spotlight, we have the following particularly interesting items to call out for this release: + #### `wgpu-core` is no longer generic over `wgpu-hal` backends Dynamic dispatch between different backends has been moved from the user facing `wgpu` crate, From 8f68acbf155b47d1c28dce80ec56533bdfc6c214 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 16:46:13 -0400 Subject: [PATCH 05/12] typo(CHANGELOG): add missing "in" b/w author and PR num. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 026643f994..75903c7ff4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,7 +107,7 @@ completely. This is a step in that direction. Current users of `.global_id()` are encouraged to make use of the `PartialEq`, `Eq`, `Hash`, `PartialOrd` and `Ord` traits that have now been implemented for `wgpu` resources. -By @teoxoy [#6134](https://github.com/gfx-rs/wgpu/pull/6134). +By @teoxoy in [#6134](https://github.com/gfx-rs/wgpu/pull/6134). #### `set_bind_group` now takes an `Option` for the bind group argument. @@ -119,7 +119,7 @@ needs to be implemented by backends. For convenience, the `set_bind_group` on compute/render passes & encoders takes `impl Into>`, so most code should still work the same. -By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216). +By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). ### New Features From de1b75b5ff9d63a6187272ae9d172307488a9b9a Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 16:47:36 -0400 Subject: [PATCH 06/12] style(CHANGELOG): use imperative tense in #6276 entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75903c7ff4..8092cf3c50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,7 +157,7 @@ By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). - SPIR-V frontend splats depth texture sample and load results. Fixes [issue #4551](https://github.com/gfx-rs/wgpu/issues/4551). By @schell in [#6384](https://github.com/gfx-rs/wgpu/pull/6384). - Accept only `vec3` (not `vecN`) for the `cross` built-in. By @ErichDonGubler in [#6171](https://github.com/gfx-rs/wgpu/pull/6171). - Configure `SourceLanguage` when enabling debug info in SPV-out. By @kvark in [#6256](https://github.com/gfx-rs/wgpu/pull/6256). -- Per-polygon and flat inputs should not be considered subgroup uniform. By @magcius in [#6276](https://github.com/gfx-rs/wgpu/pull/6276). +- Do not consider per-polygon and flat inputs subgroup uniform. By @magcius in [#6276](https://github.com/gfx-rs/wgpu/pull/6276). - Validate all swizzle components are either color (rgba) or dimension (xyzw) in WGSL. By @sagudev in [#6187](https://github.com/gfx-rs/wgpu/pull/6187). - Fix detection of shl overflows to detect arithmetic overflows. By @sagudev in [#6186](https://github.com/gfx-rs/wgpu/pull/6186). - Fix type parameters to vec/mat type constructors to also support aliases. By @sagudev in [#6189](https://github.com/gfx-rs/wgpu/pull/6189). From 8cefecd25972448bc2f4109464e97c494a4a4168 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 16:51:28 -0400 Subject: [PATCH 07/12] style(CHANGELOG): end entries with periods --- CHANGELOG.md | 62 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8092cf3c50..6e6e37f725 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -137,20 +137,20 @@ By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). #### General -- Add `VideoFrame` to `ExternalImageSource` enum. By @jprochazk in [#6170](https://github.com/gfx-rs/wgpu/pull/6170) -- Add `wgpu::util::new_instance_with_webgpu_detection` & `wgpu::util::is_browser_webgpu_supported` to make it easier to support WebGPU & WebGL in the same binary. By @wumpf in [#6371](https://github.com/gfx-rs/wgpu/pull/6371) +- Add `VideoFrame` to `ExternalImageSource` enum. By @jprochazk in [#6170](https://github.com/gfx-rs/wgpu/pull/6170). +- Add `wgpu::util::new_instance_with_webgpu_detection` & `wgpu::util::is_browser_webgpu_supported` to make it easier to support WebGPU & WebGL in the same binary. By @wumpf in [#6371](https://github.com/gfx-rs/wgpu/pull/6371). #### Vulkan -- Allow using [VK_GOOGLE_display_timing](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html) unsafely with the `VULKAN_GOOGLE_DISPLAY_TIMING` feature. By @DJMcNab in [#6149](https://github.com/gfx-rs/wgpu/pull/6149) +- Allow using [VK_GOOGLE_display_timing](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html) unsafely with the `VULKAN_GOOGLE_DISPLAY_TIMING` feature. By @DJMcNab in [#6149](https://github.com/gfx-rs/wgpu/pull/6149). #### Metal -- Implement `atomicCompareExchangeWeak`. By @AsherJingkongChen in [#6265](https://github.com/gfx-rs/wgpu/pull/6265) +- Implement `atomicCompareExchangeWeak`. By @AsherJingkongChen in [#6265](https://github.com/gfx-rs/wgpu/pull/6265). ### Bug Fixes -- Fix incorrect hlsl image output type conversion. By @atlv24 in [#6123](https://github.com/gfx-rs/wgpu/pull/6123) +- Fix incorrect hlsl image output type conversion. By @atlv24 in [#6123](https://github.com/gfx-rs/wgpu/pull/6123). #### Naga @@ -170,28 +170,28 @@ By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). #### General -- If GL context creation fails retry with GLES. By @Rapdorian in [#5996](https://github.com/gfx-rs/wgpu/pull/5996) -- Fix profiling with `tracy`. By @waywardmonkeys in [#5988](https://github.com/gfx-rs/wgpu/pull/5988) -- As a workaround for [issue #4905](https://github.com/gfx-rs/wgpu/issues/4905), `wgpu-core` is undocumented unless `--cfg wgpu_core_doc` feature is enabled. By @kpreid in [#5987](https://github.com/gfx-rs/wgpu/pull/5987) -- Bump MSRV for `d3d12`/`naga`/`wgpu-core`/`wgpu-hal`/`wgpu-types`' to 1.76. By @wumpf in [#6003](https://github.com/gfx-rs/wgpu/pull/6003) -- Print requested and supported usages on `UnsupportedUsage` error. By @VladasZ in [#6007](https://github.com/gfx-rs/wgpu/pull/6007) -- Fix function for checking bind compatibility to error instead of panic. By @sagudev [#6012](https://github.com/gfx-rs/wgpu/pull/6012) -- Deduplicate bind group layouts that are created from pipelines with "auto" layouts. By @teoxoy [#6049](https://github.com/gfx-rs/wgpu/pull/6049) -- Fix crash when dropping the surface after the device. By @wumpf in [#6052](https://github.com/gfx-rs/wgpu/pull/6052) -- Fix error message that is thrown in create_render_pass to no longer say `compute_pass`. By @matthew-wong1 [#6041](https://github.com/gfx-rs/wgpu/pull/6041) -- Document `wgpu_hal` bounds-checking promises, and adapt `wgpu_core`'s lazy initialization logic to the slightly weaker-than-expected guarantees. By @jimblandy in [#6201](https://github.com/gfx-rs/wgpu/pull/6201) +- If GL context creation fails retry with GLES. By @Rapdorian in [#5996](https://github.com/gfx-rs/wgpu/pull/5996). +- Fix profiling with `tracy`. By @waywardmonkeys in [#5988](https://github.com/gfx-rs/wgpu/pull/5988). +- As a workaround for [issue #4905](https://github.com/gfx-rs/wgpu/issues/4905), `wgpu-core` is undocumented unless `--cfg wgpu_core_doc` feature is enabled. By @kpreid in [#5987](https://github.com/gfx-rs/wgpu/pull/5987). +- Bump MSRV for `d3d12`/`naga`/`wgpu-core`/`wgpu-hal`/`wgpu-types`' to 1.76. By @wumpf in [#6003](https://github.com/gfx-rs/wgpu/pull/6003). +- Print requested and supported usages on `UnsupportedUsage` error. By @VladasZ in [#6007](https://github.com/gfx-rs/wgpu/pull/6007). +- Fix function for checking bind compatibility to error instead of panic. By @sagudev [#6012](https://github.com/gfx-rs/wgpu/pull/6012). +- Deduplicate bind group layouts that are created from pipelines with "auto" layouts. By @teoxoy [#6049](https://github.com/gfx-rs/wgpu/pull/6049). +- Fix crash when dropping the surface after the device. By @wumpf in [#6052](https://github.com/gfx-rs/wgpu/pull/6052). +- Fix error message that is thrown in create_render_pass to no longer say `compute_pass`. By @matthew-wong1 [#6041](https://github.com/gfx-rs/wgpu/pull/6041). +- Document `wgpu_hal` bounds-checking promises, and adapt `wgpu_core`'s lazy initialization logic to the slightly weaker-than-expected guarantees. By @jimblandy in [#6201](https://github.com/gfx-rs/wgpu/pull/6201). - Raise validation error instead of panicking in `{Render,Compute}Pipeline::get_bind_group_layout` on native / WebGL. By @bgr360 in [#6280](https://github.com/gfx-rs/wgpu/pull/6280). - **BREAKING**: Remove the last exposed C symbols in project, located in `wgpu_core::render::bundle::bundle_ffi`, to allow multiple versions of WGPU to compile together. By @ErichDonGubler in [#6272](https://github.com/gfx-rs/wgpu/pull/6272). - Call `flush_mapped_ranges` when unmapping write-mapped buffers. By @teoxoy in [#6089](https://github.com/gfx-rs/wgpu/pull/6089). - When mapping buffers for reading, mark buffers as initialized only when they have `MAP_WRITE` usage. By @teoxoy in [#6178](https://github.com/gfx-rs/wgpu/pull/6178). - Add a separate pipeline constants error. By @teoxoy in [#6094](https://github.com/gfx-rs/wgpu/pull/6094). -- Ensure safety of indirect dispatch by injecting a compute shader that validates the content of the indirect buffer. By @teoxoy in [#5714](https://github.com/gfx-rs/wgpu/pull/5714) +- Ensure safety of indirect dispatch by injecting a compute shader that validates the content of the indirect buffer. By @teoxoy in [#5714](https://github.com/gfx-rs/wgpu/pull/5714). #### GLES / OpenGL -- Fix GL debug message callbacks not being properly cleaned up (causing UB). By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114) -- Fix calling `slice::from_raw_parts` with unaligned pointers in push constant handling. By @Imberflur in [#6341](https://github.com/gfx-rs/wgpu/pull/6341) -- Optimise fence checking when `Queue::submit` is called many times per frame. By @dinnerbone in [#6427](https://github.com/gfx-rs/wgpu/pull/6427) +- Fix GL debug message callbacks not being properly cleaned up (causing UB). By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114). +- Fix calling `slice::from_raw_parts` with unaligned pointers in push constant handling. By @Imberflur in [#6341](https://github.com/gfx-rs/wgpu/pull/6341). +- Optimise fence checking when `Queue::submit` is called many times per frame. By @dinnerbone in [#6427](https://github.com/gfx-rs/wgpu/pull/6427). #### WebGPU @@ -199,14 +199,14 @@ By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). #### Vulkan -- Avoid undefined behaviour with adversarial debug label. By @DJMcNab in [#6257](https://github.com/gfx-rs/wgpu/pull/6257) -- Add `.index_type(vk::IndexType::NONE_KHR)` when creating `AccelerationStructureGeometryTrianglesDataKHR` in the raytraced triangle example to prevent a validation error. By @Vecvec in [#6282](https://github.com/gfx-rs/wgpu/pull/6282) +- Avoid undefined behaviour with adversarial debug label. By @DJMcNab in [#6257](https://github.com/gfx-rs/wgpu/pull/6257). +- Add `.index_type(vk::IndexType::NONE_KHR)` when creating `AccelerationStructureGeometryTrianglesDataKHR` in the raytraced triangle example to prevent a validation error. By @Vecvec in [#6282](https://github.com/gfx-rs/wgpu/pull/6282). ### Changes - `wgpu_hal::gles::Adapter::new_external` now requires the context to be current when dropping the adapter and related objects. By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114). -- Reduce the amount of debug and trace logs emitted by wgpu-core and wgpu-hal. By @nical in [#6065](https://github.com/gfx-rs/wgpu/issues/6065) -- Rename `Rg11b10Float` to `Rg11b10Ufloat`. By @sagudev in [#6108](https://github.com/gfx-rs/wgpu/pull/6108) +- Reduce the amount of debug and trace logs emitted by wgpu-core and wgpu-hal. By @nical in [#6065](https://github.com/gfx-rs/wgpu/issues/6065). +- Rename `Rg11b10Float` to `Rg11b10Ufloat`. By @sagudev in [#6108](https://github.com/gfx-rs/wgpu/pull/6108). - Invalidate the device when we encounter driver-induced device loss or on unexpected errors. By @teoxoy in [#6229](https://github.com/gfx-rs/wgpu/pull/6229). - Make Vulkan error handling more robust. By @teoxoy in [#6119](https://github.com/gfx-rs/wgpu/pull/6119). - Add bounds checking to Buffer slice method. By @beholdnec in [#6432](https://github.com/gfx-rs/wgpu/pull/6432). @@ -222,29 +222,29 @@ By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). #### HAL -- Change the inconsistent `DropGuard` based API on Vulkan and GLES to a consistent, callback-based one. By @jerzywilczek in [#6164](https://github.com/gfx-rs/wgpu/pull/6164) +- Change the inconsistent `DropGuard` based API on Vulkan and GLES to a consistent, callback-based one. By @jerzywilczek in [#6164](https://github.com/gfx-rs/wgpu/pull/6164). ### Documentation -- Removed some OpenGL and Vulkan references from `wgpu-types` documentation. Fixed Storage texel types in examples. By @Nelarius in [#6271](https://github.com/gfx-rs/wgpu/pull/6271) +- Removed some OpenGL and Vulkan references from `wgpu-types` documentation. Fixed Storage texel types in examples. By @Nelarius in [#6271](https://github.com/gfx-rs/wgpu/pull/6271). - Used `wgpu::include_wgsl!(…)` more in examples and tests. By @ErichDonGubler in [#6326](https://github.com/gfx-rs/wgpu/pull/6326). ### Dependency Updates #### GLES -- Replace `winapi` code in WGL wrapper to use the `windows` crate. By @MarijnS95 in [#6006](https://github.com/gfx-rs/wgpu/pull/6006) -- Update `glutin` to `0.31` with `glutin-winit` crate. By @MarijnS95 in [#6150](https://github.com/gfx-rs/wgpu/pull/6150) and [#6176](https://github.com/gfx-rs/wgpu/pull/6176) -- Implement `Adapter::new_external()` for WGL (just like EGL) to import an external OpenGL ES context. By @MarijnS95 in [#6152](https://github.com/gfx-rs/wgpu/pull/6152) +- Replace `winapi` code in WGL wrapper to use the `windows` crate. By @MarijnS95 in [#6006](https://github.com/gfx-rs/wgpu/pull/6006). +- Update `glutin` to `0.31` with `glutin-winit` crate. By @MarijnS95 in [#6150](https://github.com/gfx-rs/wgpu/pull/6150) and [#6176](https://github.com/gfx-rs/wgpu/pull/6176). +- Implement `Adapter::new_external()` for WGL (just like EGL) to import an external OpenGL ES context. By @MarijnS95 in [#6152](https://github.com/gfx-rs/wgpu/pull/6152). #### DX12 -- Replace `winapi` code to use the `windows` crate. By @MarijnS95 in [#5956](https://github.com/gfx-rs/wgpu/pull/5956) and [#6173](https://github.com/gfx-rs/wgpu/pull/6173) -- Get `num_workgroups` builtin working for indirect dispatches. By @teoxoy in [#5730](https://github.com/gfx-rs/wgpu/pull/5730) +- Replace `winapi` code to use the `windows` crate. By @MarijnS95 in [#5956](https://github.com/gfx-rs/wgpu/pull/5956) and [#6173](https://github.com/gfx-rs/wgpu/pull/6173). +- Get `num_workgroups` builtin working for indirect dispatches. By @teoxoy in [#5730](https://github.com/gfx-rs/wgpu/pull/5730). #### HAL -- Update `parking_lot` to `0.12`. By @mahkoh in [#6287](https://github.com/gfx-rs/wgpu/pull/6287) +- Update `parking_lot` to `0.12`. By @mahkoh in [#6287](https://github.com/gfx-rs/wgpu/pull/6287). ## 22.0.0 (2024-07-17) From 39f010807bf9a6261b32187aaff0c0d853255515 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 16:58:28 -0400 Subject: [PATCH 08/12] docs(CHANGELOG): add `Major changes` item for `windows` ecosystem migration --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e6e37f725..9a5601472f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -121,6 +121,12 @@ so most code should still work the same. By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). +#### WGPU's DX12 backend is now based on the `windows` crate ecosystem, instead of the `d3d12` crate + +WGPU has retired the `d3d12` crate (based on `winapi`), and now uses the `windows` crate for interfacing with Windows. For many, this may not be a change that affects day-to-day work. However, for users who need to vet their dependencies, or who may vendor in dependencies, this may be a nontrivial migration. + +By @MarijnS95 in [#6006](https://github.com/gfx-rs/wgpu/pull/6006). + ### New Features #### Naga From edc8d3a246efe5308662be1c4e0a6a96b4353f51 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Sat, 26 Oct 2024 11:33:58 -0400 Subject: [PATCH 09/12] docs(CHANGELOG): add `Major changes` item for `Option`al entry points --- CHANGELOG.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a5601472f..1d0c6b9855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -121,6 +121,49 @@ so most code should still work the same. By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). +#### `entry_point`s are now `Option`al + +One of the changes in the WebGPU spec. (from [about this time last year][optional-entrypoint-in-spec] 😅) was to allow optional entry points in `GPUProgrammableStage`. In `wgpu`, this corresponds to a subset of fields in `FragmentState`, `VertexState`, and `ComputeState` as the `entry_point` member: + +```wgsl +let render_pipeline = device.createRenderPipeline(wgpu::RenderPipelineDescriptor { + module, + entry_point: Some("cs_main"), // This is now `Option`al. + // … +}); + +let compute_pipeline = device.createComputePipeline(wgpu::ComputePipelineDescriptor { + module, + entry_point: None, // This is now `Option`al. + // … +}); +``` + +When set to `None`, it's assumed that the shader only has a single entry point associated with the pipeline stage (i.e., `@compute`, `@fragment`, or `@vertex`). If there is not one and only one candidate entry point, then a validation error is returned. To continue the example, we might have written the above API usage with the following shader module: + +```wgsl +// We can't use `entry_point: None` for compute pipelines with this module, +// because there are two `@compute` entry points. + +@compute +fn cs_main() { /* … */ } + +@compute +fn other_cs_main() { /* … */ } + +// The following entry points _can_ be inferred from `entry_point: None` in a +// render pipeline, because they're the only `@vertex` and `@fragment` entry +// points: + +@vertex +fn vs_main() { /* … */ } + +@fragment +fn fs_main() { /* … */ } +``` + +[optional-entrypoint-in-spec]: https://github.com/gpuweb/gpuweb/issues/4342 + #### WGPU's DX12 backend is now based on the `windows` crate ecosystem, instead of the `d3d12` crate WGPU has retired the `d3d12` crate (based on `winapi`), and now uses the `windows` crate for interfacing with Windows. For many, this may not be a change that affects day-to-day work. However, for users who need to vet their dependencies, or who may vendor in dependencies, this may be a nontrivial migration. From 6e71892cf423519fb8d786886cc16fd102b0e1db Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Sat, 26 Oct 2024 11:38:11 -0400 Subject: [PATCH 10/12] style(CHANGELOG): join soft-wrapped lines in `Unreleased` --- CHANGELOG.md | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d0c6b9855..6a68cee048 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,38 +86,27 @@ In addition to the above spotlight, we have the following particularly interesti #### `wgpu-core` is no longer generic over `wgpu-hal` backends -Dynamic dispatch between different backends has been moved from the user facing `wgpu` crate, -to a new dynamic dispatch mechanism inside the backend abstraction layer `wgpu-hal`. +Dynamic dispatch between different backends has been moved from the user facing `wgpu` crate, to a new dynamic dispatch mechanism inside the backend abstraction layer `wgpu-hal`. -Whenever targeting more than a single backend (default on Windows & Linux) this leads to faster compile times and smaller binaries! -This also solves a long standing issue with `cargo doc` failing to run for `wgpu-core`. +Whenever targeting more than a single backend (default on Windows & Linux) this leads to faster compile times and smaller binaries! This also solves a long standing issue with `cargo doc` failing to run for `wgpu-core`. -Benchmarking indicated that compute pass recording is slower as a consequence, -whereas on render passes speed improvements have been observed. -However, this effort simplifies many of the internals of the wgpu family of crates -which we're hoping to build performance improvements upon in the future. +Benchmarking indicated that compute pass recording is slower as a consequence, whereas on render passes speed improvements have been observed. However, this effort simplifies many of the internals of the wgpu family of crates which we're hoping to build performance improvements upon in the future. By @wumpf in [#6069](https://github.com/gfx-rs/wgpu/pull/6069), [#6099](https://github.com/gfx-rs/wgpu/pull/6099), [#6100](https://github.com/gfx-rs/wgpu/pull/6100). #### `wgpu`'s resources no longer have `.global_id()` getters -`wgpu-core`'s internals no longer use nor need IDs and we are moving towards removing IDs -completely. This is a step in that direction. +`wgpu-core`'s internals no longer use nor need IDs and we are moving towards removing IDs completely. This is a step in that direction. -Current users of `.global_id()` are encouraged to make use of the `PartialEq`, `Eq`, `Hash`, `PartialOrd` and `Ord` -traits that have now been implemented for `wgpu` resources. +Current users of `.global_id()` are encouraged to make use of the `PartialEq`, `Eq`, `Hash`, `PartialOrd` and `Ord` traits that have now been implemented for `wgpu` resources. By @teoxoy in [#6134](https://github.com/gfx-rs/wgpu/pull/6134). #### `set_bind_group` now takes an `Option` for the bind group argument. -https://gpuweb.github.io/gpuweb/#programmable-passes-bind-groups specifies that bindGroup -is nullable. This change is the start of implementing this part of the spec. -Callers that specify a `Some()` value should have unchanged behavior. Handling of `None` values still -needs to be implemented by backends. +https://gpuweb.github.io/gpuweb/#programmable-passes-bind-groups specifies that bindGroup is nullable. This change is the start of implementing this part of the spec. Callers that specify a `Some()` value should have unchanged behavior. Handling of `None` values still needs to be implemented by backends. -For convenience, the `set_bind_group` on compute/render passes & encoders takes `impl Into>`, -so most code should still work the same. +For convenience, the `set_bind_group` on compute/render passes & encoders takes `impl Into>`, so most code should still work the same. By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216). From d9c5f74bbb873ee0e47eaf07db4aea8adac19d40 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 29 Oct 2024 15:29:00 -0700 Subject: [PATCH 11/12] docs(CHANGELOG): add missing entry for #6107 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a68cee048..6e1c0e0536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -185,6 +185,7 @@ By @MarijnS95 in [#6006](https://github.com/gfx-rs/wgpu/pull/6006). #### Metal - Implement `atomicCompareExchangeWeak`. By @AsherJingkongChen in [#6265](https://github.com/gfx-rs/wgpu/pull/6265). +- Unless an explicit `CAMetalLayer` is provided, surfaces now render to a sublayer. This improves resizing behavior, fixing glitches during on window resize. By @madsmtm in [#6107](https://github.com/gfx-rs/wgpu/pull/6107). ### Bug Fixes From 9afb3884c70ccb87dd8da4c87fd6f792307d0964 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 25 Oct 2024 14:54:41 -0400 Subject: [PATCH 12/12] chore: bump WGPU workspace crates to 23 --- CHANGELOG.md | 2 ++ Cargo.lock | 26 +++++++++++++------------- Cargo.toml | 20 ++++++++++---------- naga-cli/Cargo.toml | 4 ++-- naga/Cargo.toml | 2 +- naga/fuzz/Cargo.toml | 2 +- wgpu-core/Cargo.toml | 8 ++++---- wgpu-hal/Cargo.toml | 8 ++++---- wgpu-types/Cargo.toml | 2 +- 9 files changed, 38 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e1c0e0536..ef4548fa31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,8 @@ Bottom level categories: ## Unreleased +## 23.0.0 (2024-10-25) + ### Themes of this release This release's theme is one that is likely to repeat for a few releases: convergence with the WebGPU specification! WGPU's design and base functionality are actually determined by two specifications: one for WebGPU, and one for the WebGPU Shading Language. diff --git a/Cargo.lock b/Cargo.lock index 04d2b3c037..8ab3d854b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1739,7 +1739,7 @@ checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" [[package]] name = "lock-analyzer" -version = "22.0.0" +version = "23.0.0" dependencies = [ "anyhow", "ron", @@ -1875,7 +1875,7 @@ dependencies = [ [[package]] name = "naga" -version = "22.0.0" +version = "23.0.0" dependencies = [ "arbitrary", "arrayvec", @@ -1905,7 +1905,7 @@ dependencies = [ [[package]] name = "naga-cli" -version = "22.0.0" +version = "23.0.0" dependencies = [ "anyhow", "argh", @@ -2271,7 +2271,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "player" -version = "22.0.0" +version = "23.0.0" dependencies = [ "env_logger", "log", @@ -3564,7 +3564,7 @@ dependencies = [ [[package]] name = "wgpu" -version = "22.0.0" +version = "23.0.0" dependencies = [ "arrayvec", "cfg_aliases", @@ -3588,7 +3588,7 @@ dependencies = [ [[package]] name = "wgpu-benchmark" -version = "22.0.0" +version = "23.0.0" dependencies = [ "bincode", "bytemuck", @@ -3605,7 +3605,7 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "22.0.0" +version = "23.0.0" dependencies = [ "arrayvec", "bit-vec", @@ -3631,7 +3631,7 @@ dependencies = [ [[package]] name = "wgpu-examples" -version = "22.0.0" +version = "23.0.0" dependencies = [ "bytemuck", "cfg-if", @@ -3662,7 +3662,7 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "22.0.0" +version = "23.0.0" dependencies = [ "android_system_properties", "arrayvec", @@ -3712,7 +3712,7 @@ dependencies = [ [[package]] name = "wgpu-info" -version = "22.0.0" +version = "23.0.0" dependencies = [ "anyhow", "bitflags 2.6.0", @@ -3725,7 +3725,7 @@ dependencies = [ [[package]] name = "wgpu-macros" -version = "22.0.0" +version = "23.0.0" dependencies = [ "heck 0.5.0", "quote", @@ -3734,7 +3734,7 @@ dependencies = [ [[package]] name = "wgpu-test" -version = "22.0.0" +version = "23.0.0" dependencies = [ "anyhow", "arrayvec", @@ -3769,7 +3769,7 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "22.0.0" +version = "23.0.0" dependencies = [ "bitflags 2.6.0", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 1e0bb77edf..0a5481abfd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,27 +47,27 @@ keywords = ["graphics"] license = "MIT OR Apache-2.0" homepage = "https://wgpu.rs/" repository = "https://github.com/gfx-rs/wgpu" -version = "22.0.0" +version = "23.0.0" authors = ["gfx-rs developers"] [workspace.dependencies.wgc] package = "wgpu-core" path = "./wgpu-core" -version = "22.0.0" +version = "23.0.0" [workspace.dependencies.wgt] package = "wgpu-types" path = "./wgpu-types" -version = "22.0.0" +version = "23.0.0" [workspace.dependencies.hal] package = "wgpu-hal" path = "./wgpu-hal" -version = "22.0.0" +version = "23.0.0" [workspace.dependencies.naga] path = "./naga" -version = "22.0.0" +version = "23.0.0" [workspace.dependencies] anyhow = "1.0.91" @@ -126,11 +126,11 @@ static_assertions = "1.1.0" strum = { version = "0.25.0", features = ["derive"] } tracy-client = "0.17" thiserror = "1.0.65" -wgpu = { version = "22.0.0", path = "./wgpu", default-features = false } -wgpu-core = { version = "22.0.0", path = "./wgpu-core" } -wgpu-macros = { version = "22.0.0", path = "./wgpu-macros" } -wgpu-test = { version = "22.0.0", path = "./tests" } -wgpu-types = { version = "22.0.0", path = "./wgpu-types" } +wgpu = { version = "23.0.0", path = "./wgpu", default-features = false } +wgpu-core = { version = "23.0.0", path = "./wgpu-core" } +wgpu-macros = { version = "23.0.0", path = "./wgpu-macros" } +wgpu-test = { version = "23.0.0", path = "./tests" } +wgpu-types = { version = "23.0.0", path = "./wgpu-types" } winit = { version = "0.29", features = ["android-native-activity"] } # Metal dependencies diff --git a/naga-cli/Cargo.toml b/naga-cli/Cargo.toml index e9abb82d26..a429759217 100644 --- a/naga-cli/Cargo.toml +++ b/naga-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "naga-cli" -version = "22.0.0" +version = "23.0.0" authors = ["gfx-rs developers"] edition = "2021" description = "Shader translation command line tool" @@ -25,7 +25,7 @@ argh.workspace = true anyhow.workspace = true [dependencies.naga] -version = "22.0.0" +version = "23.0.0" path = "../naga" features = [ "compact", diff --git a/naga/Cargo.toml b/naga/Cargo.toml index 85c6c4847c..16682e5268 100644 --- a/naga/Cargo.toml +++ b/naga/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "naga" -version = "22.0.0" +version = "23.0.0" authors = ["gfx-rs developers"] edition = "2021" description = "Shader translation infrastructure" diff --git a/naga/fuzz/Cargo.toml b/naga/fuzz/Cargo.toml index c4dd8cd1c1..f34a6f92e9 100644 --- a/naga/fuzz/Cargo.toml +++ b/naga/fuzz/Cargo.toml @@ -15,7 +15,7 @@ libfuzzer-sys = "0.4" [target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dependencies.naga] path = ".." -version = "22.0.0" +version = "23.0.0" features = ["arbitrary", "spv-in", "wgsl-in", "glsl-in"] [[bin]] diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 60b4165a42..5906aeb339 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-core" -version = "22.0.0" +version = "23.0.0" authors = ["gfx-rs developers"] edition = "2021" description = "WebGPU core logic on wgpu-hal" @@ -129,17 +129,17 @@ thiserror.workspace = true [dependencies.naga] path = "../naga" -version = "22.0.0" +version = "23.0.0" [dependencies.wgt] package = "wgpu-types" path = "../wgpu-types" -version = "22.0.0" +version = "23.0.0" [dependencies.hal] package = "wgpu-hal" path = "../wgpu-hal" -version = "22.0.0" +version = "23.0.0" default-features = false [build-dependencies] diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 418bd5cee1..35e85f45da 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-hal" -version = "22.0.0" +version = "23.0.0" authors = ["gfx-rs developers"] edition = "2021" description = "WebGPU hardware abstraction layer" @@ -133,7 +133,7 @@ glow = { workspace = true, optional = true } [dependencies.wgt] package = "wgpu-types" path = "../wgpu-types" -version = "22.0.0" +version = "23.0.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # backend: Vulkan @@ -191,7 +191,7 @@ ndk-sys = { workspace = true, optional = true } [dependencies.naga] path = "../naga" -version = "22.0.0" +version = "23.0.0" [build-dependencies] cfg_aliases.workspace = true @@ -199,7 +199,7 @@ cfg_aliases.workspace = true # DEV dependencies [dev-dependencies.naga] path = "../naga" -version = "22.0.0" +version = "23.0.0" features = ["wgsl-in"] [dev-dependencies] diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index 38bda98bc2..e79ae330e5 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-types" -version = "22.0.0" +version = "23.0.0" authors = ["gfx-rs developers"] edition = "2021" description = "WebGPU types"