chore(deps): update rust crate wgpu to v22 - autoclosed #1320
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.19
->22.0
Release Notes
gfx-rs/wgpu (wgpu)
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 #5855v0.20.1
Compare Source
This release included v0.21.0 of
wgpu-core
andwgpu-hal
, due to breaking changes needed to solve vulkan validation issues.Bug Fixes
This release fixes the validation errors whenever a surface is used with the vulkan backend. By @cwfitzgerald in #5681.
General
Metal
Vulkan
GLES / OpenGL
Naga
switch
statements with a single body for all cases. These are now written asdo {} while(false);
loops in hlsl-out and glsl-out. By @Imberflur in #5654continue
statements in switches by setting a flag and breaking from the switch. This allows such constructs to work with FXC which does not supportcontinue
within a switch. By @Imberflur in #5654v0.20.0
Compare Source
Major Changes
Pipeline overridable constants
Wgpu supports now pipeline-overridable constants
This allows you to define constants in wgsl like this:
And then set them at runtime like so on your pipeline consuming this shader:
By @teoxoy & @jimblandy in #5500
Changed feature requirements for timestamps
Due to a specification change
write_timestamp
is no longer supported on WebGPU.wgpu::CommandEncoder::write_timestamp
requires now the newwgpu::Features::TIMESTAMP_QUERY_INSIDE_ENCODERS
feature which is available on all native backends but not on WebGPU.By @wumpf in #5188
Wgsl const evaluation for many more built-ins
Many numeric built-ins have had a constant evaluation implementation added for them, which allows them to be used in a
const
context:abs
,acos
,acosh
,asin
,asinh
,atan
,atanh
,cos
,cosh
,round
,saturate
,sin
,sinh
,sqrt
,step
,tan
,tanh
,ceil
,countLeadingZeros
,countOneBits
,countTrailingZeros
,degrees
,exp
,exp2
,floor
,fract
,fma
,inverseSqrt
,log
,log2
,max
,min
,radians
,reverseBits
,sign
,trunc
By @ErichDonGubler in #4879, #5098
New native-only wgsl features
Subgroup operations
The following subgroup operations are available in wgsl now:
subgroupBallot
,subgroupAll
,subgroupAny
,subgroupAdd
,subgroupMul
,subgroupMin
,subgroupMax
,subgroupAnd
,subgroupOr
,subgroupXor
,subgroupExclusiveAdd
,subgroupExclusiveMul
,subgroupInclusiveAdd
,subgroupInclusiveMul
,subgroupBroadcastFirst
,subgroupBroadcast
,subgroupShuffle
,subgroupShuffleDown
,subgroupShuffleUp
,subgroupShuffleXor
Availability is governed by the following feature flags:
wgpu::Features::SUBGROUP
for all operations exceptsubgroupBarrier
in fragment & compute, supported on Vulkan, DX12 and Metal.wgpu::Features::SUBGROUP_VERTEX
, for all operations exceptsubgroupBarrier
general operations in vertex shaders, supported on Vulkanwgpu::Features::SUBGROUP_BARRIER
, for support of thesubgroupBarrier
operation, supported on Vulkan & MetalNote that there currently some differences between wgpu's native-only implementation and the open WebGPU proposal.
By @exrook and @lichtso in #5301
Signed and unsigned 64 bit integer support in shaders.
wgpu::Features::SHADER_INT64
enables 64 bit integer signed and unsigned integer variables in wgsl (i64
andu64
respectively).Supported on Vulkan, DX12 (requires DXC) and Metal (with MSL 2.3+ support).
By @atlv24 and @cwfitzgerald in #5154
New features
General
Unorm10_10_10_2
VertexFormat by @McMackety in #5477wgpu-types
'strace
andreplay
features have been replaced by theserde
feature. By @KirmesBude in #5149wgpu-core
'sserial-pass
feature has been removed. Useserde
instead. By @KirmesBude in #5149InstanceFlags::GPU_BASED_VALIDATION
, which enables GPU-based validation for shaders. This is currently only supported on the DX12 and Vulkan backends; other platforms ignore this flag, for now. By @ErichDonGubler in #5146, #5046.InstanceFlags::VALIDATION
.InstanceFlags::advanced_debugging
. Since the overhead is potentially very large, the flag is not enabled by default in debug builds when usingInstanceFlags::from_build_config
.InstanceFlags::with_env
with the newWGPU_GPU_BASED_VALIDATION
environment variable.wgpu::Instance
can now report whichwgpu::Backends
are available based on the build configuration. By @wumpf #5167wgpu_core::pipeline::ProgrammableStageDescriptor
is now optional. By @ErichDonGubler in #5305.Features::downlevel{_webgl2,}_features
was made const by @MultisampledNight in #5343wgpu_core::pipeline::ShaderError
has been moved tonaga
. By @stefnotch in #5410wgpu::CommandEncoder::as_hal_mut
wgpu::TextureView::as_hal
wgpu::Texture::as_hal
now returns a user-defined type to match the other as_hal functionsNaga
--metal-version
with Naga CLI. By @pcleavelin in #5392arrayLength
for runtime-sized arrays inside binding arrays (for WGSL input and SPIR-V output). By @kvark in #5428--shader-stage
and--input-kind
options to naga-cli for specifying vertex/fragment/compute shaders, and frontend. by @ratmice in #5411create_validator
function to wgpu_coreDevice
to create nagaValidator
s. By @atlv24 #5606WebGPU
device_set_device_lost_callback
method forContextWebGpu
. By @suti in #5438ReadOnly
andReadWrite
. By @JolifantoBambla in #5434GLES / OpenGL
get_texture_format_features
cheap. By @Dinnerbone in #5346DEPTH32FLOAT_STENCIL8
as supported in GLES. By @Dinnerbone in #5370TEXTURE_COMPRESSION_ETC2
. By @Valaphee in #5568driver
anddriver_info
, with the OpenGL flavor and version, similar to Vulkan. By @valaphee in #5482Metal
DX12
Other performance improvements
Documentation
wgpu_hal
documentation. By @jimblandy in #5516, #5524, #5562, #5563, #5566, #5617, #5618PrimitiveState::strip_index_format
. By @cpsdqs in #5350SourceLocation
. By @stefnotch in #5386 and #5410push_constant
syntax. By @waywardmonkeys in #5393Limits::max_compute_workgroup_storage_size
default value. By @atlv24 in #5601Bug Fixes
General
serde
feature not compiling forwgpu-types
. By @KirmesBude in #5149storage
anduniform
vars. By @jimblandy #5222extern "C"
+ [no_mangle]) from RenderPass & ComputePass recording. By @wumpf in #5409.Naga
Expression::ZeroValue
. By @Imberflur in #5587.extractBits
andinsertBits
whenoffset + count
overflows the bit width. By @cwfitzgerald in #5305clamp
whenmin
argument >max
argument. By @cwfitzgerald in #5300.TypeInner::scalar_width
to be consistent with the rest of the codebase and return values in bytes not bits. By @atlv24 in #5532.GLES / OpenGL
first_instance
getting ignored in draw indexed whenARB_shader_draw_parameters
feature is present andbase_vertex
is 0. By @valaphee in #5482Vulkan
wgpu_hal::vulkan::CommandEncoder
to make surediscard_encoding
is not called in the closed state. By @villuna in #5557LocalType
caching. By @atlv24 in #5590ash
to0.38
. By @MarijnS95 in #5504.Tests
multithreaded_compute
test. By @jimblandy in #5129.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ 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.