fix(deps): update rust crate wgpu to v23 #153
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.20
->23.0
Release Notes
gfx-rs/wgpu (wgpu)
v23.0.0
Compare Source
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 and Deno have communities that are very interested in providing WebGPU! WebGPU is slowly eating the world, 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.
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 a case like that from #4400:
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:…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 overwgpu-hal
backendsDynamic dispatch between different backends has been moved from the user facing
wgpu
crate, to a new dynamic dispatch mechanism inside the backend abstraction layerwgpu-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 forwgpu-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.
By @wumpf in #6069, #6099, #6100.
wgpu
's resources no longer have.global_id()
getterswgpu-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 thePartialEq
,Eq
,Hash
,PartialOrd
andOrd
traits that have now been implemented forwgpu
resources.By @teoxoy in #6134.
set_bind_group
now takes anOption
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 ofNone
values still needs to be implemented by backends.For convenience, the
set_bind_group
on compute/render passes & encoders takesimpl Into<Option<&BindGroup>>
, so most code should still work the same.By @bradwerth in #6216.
entry_point
s are nowOption
alOne of the changes in the WebGPU spec. (from about this time last year 😅) was to allow optional entry points in
GPUProgrammableStage
. Inwgpu
, this corresponds to a subset of fields inFragmentState
,VertexState
, andComputeState
as theentry_point
member: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:WGPU's DX12 backend is now based on the
windows
crate ecosystem, instead of thed3d12
crateWGPU has retired the
d3d12
crate (based onwinapi
), and now uses thewindows
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.
New Features
Naga
firstLeadingBit
andfirstTrailingBit
numeric built-ins in WGSL. Front-ends that translate to these built-ins also benefit from constant evaluation. By @ErichDonGubler in #5101.first
andeither
sampling types for@interpolate(flat, …)
in WGSL. By @ErichDonGubler in #6181.const
declarations in WGSL. By @sagudev in #6156.const_assert
in WGSL. By @sagudev in #6198.inverse
in WGSL. By @chyyran in #6385.requires
,enable
, anddiagnostic
directives. No extensions or diagnostic filters are yet supported, but diagnostics have improved dramatically. By @ErichDonGubler in #6352, #6424, #6437.General
VideoFrame
toExternalImageSource
enum. By @jprochazk in #6170.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.Vulkan
VULKAN_GOOGLE_DISPLAY_TIMING
feature. By @DJMcNab in #6149.Metal
atomicCompareExchangeWeak
. By @AsherJingkongChen in #6265.CAMetalLayer
is provided, surfaces now render to a sublayer. This improves resizing behavior, fixing glitches during on window resize. By @madsmtm in #6107.Bug Fixes
Naga
vec3
(notvecN
) for thecross
built-in. By @ErichDonGubler in #6171.SourceLanguage
when enabling debug info in SPV-out. By @kvark in #6256.var
s without explicit type. By @sagudev in #6199.gl_DrawID
to glsl andDrawIndex
to spv. By @ChosenName in #6325.textureQueryLevels
to the GLSL parser. By @magcius in #6325.General
tracy
. By @waywardmonkeys in #5988.wgpu-core
is undocumented unless--cfg wgpu_core_doc
feature is enabled. By @kpreid in #5987.d3d12
/naga
/wgpu-core
/wgpu-hal
/wgpu-types
' to 1.76. By @wumpf in #6003.UnsupportedUsage
error. By @VladasZ in #6007.compute_pass
. By @matthew-wong1 #6041.wgpu_hal
bounds-checking promises, and adaptwgpu_core
's lazy initialization logic to the slightly weaker-than-expected guarantees. By @jimblandy in #6201.{Render,Compute}Pipeline::get_bind_group_layout
on native / WebGL. By @bgr360 in #6280.wgpu_core::render::bundle::bundle_ffi
, to allow multiple versions of WGPU to compile together. By @ErichDonGubler in #6272.flush_mapped_ranges
when unmapping write-mapped buffers. By @teoxoy in #6089.MAP_WRITE
usage. By @teoxoy in #6178.GLES / OpenGL
slice::from_raw_parts
with unaligned pointers in push constant handling. By @Imberflur in #6341.Queue::submit
is called many times per frame. By @dinnerbone in #6427.WebGPU
TypeError
exception inInstance::request_adapter
when browser doesn't support WebGPU butwgpu
not compiled withwebgl
support. By @bgr360 in #6197.Vulkan
.index_type(vk::IndexType::NONE_KHR)
when creatingAccelerationStructureGeometryTrianglesDataKHR
in the raytraced triangle example to prevent a validation error. By @Vecvec in #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.Rg11b10Float
toRg11b10Ufloat
. By @sagudev in #6108.impl From<StorageFormat> for ScalarKind
withimpl From<StorageFormat> for Scalar
so that byte width is included. By @atlv24 in #6451.Internal
ManuallyDrop
in remaining places. By @teoxoy in #6092.Registry
. By @teoxoy in #6243.backend
from ID. By @teoxoy in #6263.HAL
DropGuard
based API on Vulkan and GLES to a consistent, callback-based one. By @jerzywilczek in #6164.Documentation
wgpu-types
documentation. Fixed Storage texel types in examples. By @Nelarius in #6271.wgpu::include_wgsl!(…)
more in examples and tests. By @ErichDonGubler in #6326.Dependency Updates
GLES
winapi
code in WGL wrapper to use thewindows
crate. By @MarijnS95 in #6006.glutin
to0.31
withglutin-winit
crate. By @MarijnS95 in #6150 and #6176.Adapter::new_external()
for WGL (just like EGL) to import an external OpenGL ES context. By @MarijnS95 in #6152.DX12
winapi
code to use thewindows
crate. By @MarijnS95 in #5956 and #6173.num_workgroups
builtin working for indirect dispatches. By @teoxoy in #5730.HAL
parking_lot
to0.12
. By @mahkoh in #6287.v22.1.0
Compare Source
This release includes
wgpu
,wgpu-core
andnaga
. All other crates remain at 22.0.0.Added
Naga
Bug Fixes
General
tracy
. By @waywardmonkeys in #5988queue_write_texture
. By @teoxoy in #6009compute_pass
. By @matthew-wong1 #6041wgpu-core
is undocumented unless--cfg wgpu_core_doc
feature is enabled. By @kpreid in #5987v22.0.0
Compare Source
Overview
Our first major version release!
For the first time ever, WGPU is being released with a major version (i.e., 22.* instead of 0.22.*)! Maintainership has decided to fully adhere to Semantic Versioning's recommendations for versioning production software. According to SemVer 2.0.0's Q&A about when to use 1.0.0 versions (and beyond):
It is a well-known fact that WGPU has been used for applications and platforms already in production for years, at this point. We are often concerned with tracking breaking changes, and affecting these consumers' ability to ship. By releasing our first major version, we publicly acknowledge that this is the case. We encourage other projects in the Rust ecosystem to follow suit.
Note that while we start to use the major version number, WGPU is not "going stable", as many Rust projects do. We anticipate many breaking changes before we fully comply with the WebGPU spec., which we expect to take a small number of years.
Overview
A major (pun intended) theme of this release is incremental improvement. Among the typically large set of bug fixes, new features, and other adjustments to WGPU by the many contributors listed below, @wumpf and @teoxoy have merged a series of many simplifications to WGPU's internals and, in one case, to the render and compute pass recording APIs. Many of these change WGPU to use atomically reference-counted resource tracking (i.e.,
Arc<…>
), rather than using IDs to manage the lifetimes of platform-specific graphics resources in a registry of separate reference counts. This has led us to diagnose and fix many long-standing bugs, and net some neat performance improvements on the order of 40% or more of some workloads.While the above is exciting, we acknowledge already finding and fixing some (easy-to-fix) regressions from the above work. If you migrate to WGPU 22 and encounter such bugs, please engage us in the issue tracker right away!
Major Changes
Lifetime bounds on
wgpu::RenderPass
&wgpu::ComputePass
wgpu::RenderPass
&wgpu::ComputePass
recording methods (e.g.wgpu::RenderPass:set_render_pipeline
) no longer impose a lifetime constraint to objects passed to a pass (like pipelines/buffers/bindgroups/query-sets etc.).This means the following pattern works now as expected:
Previously, a set pipeline (or other resource) had to outlive pass recording which often affected wider systems,
meaning that users needed to prove to the borrow checker that
Vec<wgpu::RenderPipeline>
(or similar constructs)aren't accessed mutably for the duration of pass recording.
Furthermore, you can now opt out of
wgpu::RenderPass
/wgpu::ComputePass
's lifetime dependency on its parentwgpu::CommandEncoder
usingwgpu::RenderPass::forget_lifetime
/wgpu::ComputePass::forget_lifetime
:wgpu::RenderPass
/wgpu::ComputePass
is pending for a givenwgpu::CommandEncoder
, creation of a compute or render pass is an error and invalidates thewgpu::CommandEncoder
.forget_lifetime
can be very useful for library authors, but opens up an easy way for incorrect use, so use with care.This method doesn't add any additional overhead and has no side effects on pass recording.
By @wumpf in #5569, #5575, #5620, #5768 (together with @kpreid), #5671, #5794, #5884.
Querying shader compilation errors
Wgpu now supports querying shader compilation info.
This allows you to get more structured information about compilation errors, warnings and info:
By @stefnotch in #5410
64 bit integer atomic support in shaders.
Add support for 64 bit integer atomic operations in shaders.
Add the following flags to
wgpu_types::Features
:SHADER_INT64_ATOMIC_ALL_OPS
enables all atomic operations onatomic<i64>
andatomic<u64>
values.SHADER_INT64_ATOMIC_MIN_MAX
is a subset of the above, enabling onlyAtomicFunction::Min
andAtomicFunction::Max
operations onatomic<i64>
andatomic<u64>
values in theStorage
address space. These are the only 64-bitatomic operations available on Metal as of 3.1.
Add corresponding flags to
naga::valid::Capabilities
. These are supported by theWGSL front end, and all Naga backends.
Platform support:
On Direct3d 12, in
D3D12_FEATURE_DATA_D3D12_OPTIONS9
, ifAtomicInt64OnTypedResourceSupported
andAtomicInt64OnGroupSharedSupported
areboth available, then both wgpu features described above are available.
On Metal,
SHADER_INT64_ATOMIC_MIN_MAX
is available on Apple9 hardware, and onhardware that advertises both Apple8 and Mac2 support. This also requires Metal
Shading Language 2.4 or later. Metal does not yet support the more general
SHADER_INT64_ATOMIC_ALL_OPS
.On Vulkan, if the
VK_KHR_shader_atomic_int64
extension is available with both theshader_buffer_int64_atomics
andshader_shared_int64_atomics
features, then bothwgpu features described above are available.
By @atlv24 in #5383
A compatible surface is now required for
request_adapter()
on WebGL2 +enumerate_adapters()
is now native only.When targeting WebGL2, it has always been the case that a surface had to be created before calling
request_adapter()
.We now make this requirement explicit.
Validation was also added to prevent configuring the surface with a device that doesn't share the same underlying
WebGL2 context since this has never worked.
Calling
enumerate_adapters()
when targeting WebGPU used to return an emptyVec
and since we now require usersto pass a compatible surface when targeting WebGL2, having
enumerate_adapters()
doesn't make sense.By @teoxoy in #5901
New features
General
as_hal
forBuffer
to access wgpu created buffers form wgpu-hal. By @JasondeWolff in #5724include_wgsl!
is now callable in const contexts by @9SMTM6 in #5872DeviceDescriptor
by @nical in #5875MemoryHints::Performance
, the default, favors performance over memory usage and will likely cause large amounts of VRAM to be allocated up-front. This hint is typically good for games.MemoryHints::MemoryUsage
favors memory usage over performance. This hint is typically useful for smaller applications or UI libraries.MemoryHints::Manual
allows the user to specify parameters for the underlying GPU memory allocator. These parameters are subject to change.HTMLImageElement
andImageData
as external source for copying images. By @Valaphee in #5668Naga
Added -D, --defines option to naga CLI to define preprocessor macros by @theomonnom in #5859
Added type upgrades to SPIR-V atomic support. Added related infrastructure. Tracking issue is here. By @schell in #5775.
Implement
WGSL
'sunpack4xI8
,unpack4xU8
,pack4xI8
andpack4xU8
. By @VlaDexa in #5424Began work adding support for atomics to the SPIR-V frontend. Tracking issue is here. By @schell in #5702.
In hlsl-out, allow passing information about the fragment entry point to omit vertex outputs that are not in the fragment inputs. By @Imberflur in #5531
In spv-out, allow passing
acceleration_structure
as a function argument. By @kvark in #5961HLSL & MSL output can now be added conditionally on the target via the
msl-out-if-target-apple
andhlsl-out-if-target-windows
features. This is used in wgpu-hal to no longer compile with MSL output whenmetal
is enabled & MacOS isn't targeted and no longer compile with HLSL output whendx12
is enabled & Windows isn't targeted. By @wumpf in #5919Vulkan
PipelineCache
resource to allow using Vulkan pipeline caches. By @DJMcNab in #5319WebGPU
Changes
General
StageError::InputNotConsumed
,Features::SHADER_UNUSED_VERTEX_OUTPUT
, and associated validation. By @Imberflur in #5531wgpu::Error
is nowSync
, making it possible to be wrapped inanyhow::Error
oreyre::Report
. By @nolanderc in #5820.submit()
by 39-64% (.submit()
+.poll()
by 22-32%). By @teoxoy in #5910trace
wgpu feature has been temporarily removed. By @teoxoy in #5975Metal
Removed the
link
Cargo feature.This was used to allow weakly linking frameworks. This can be achieved with putting something like the following in your
.cargo/config.toml
instead:By @madsmtm in #5752
Bug Fixes
General
wgpu::ComputePass
now internally takes ownership ofQuerySet
for bothwgpu::ComputePassTimestampWrites
as well as timestamp writes and statistics query, fixing crashes when destroyingQuerySet
before ending the pass. By @wumpf in #5671queue_write_texture
(causing UB). By @teoxoy in #5973GLES / OpenGL
ClearColorF
,ClearColorU
andClearColorI
commands being issued beforeSetDrawColorBuffers
#5666glClear
withglClearBufferF
becauseglDrawBuffers
requires that the ith buffer must beCOLOR_ATTACHMENTi
orNONE
#5666Naga
BindingArray
's type withBlock
if the type is a struct with a runtime array by @Vecvec in #5776packed
as a keyword for GLSL by @kjarosh in #5855Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.