Wgpu

Latest version: v0.21.1

Safety actively analyzes 723152 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 15

0.20.1

This release included v0.21.0 of `wgpu-core` and `wgpu-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](https://github.com/gfx-rs/wgpu/pull/5681).

General

- Clean up weak references to texture views and bind groups to prevent memory leaks. By xiaopengli89 in [5595](https://github.com/gfx-rs/wgpu/pull/5595).
- Fix segfault on exit is queue & device are dropped before surface. By sagudev in [5640](https://github.com/gfx-rs/wgpu/pull/5640).

Metal

- Fix unrecognized selector crash on iOS 12. By vladasz in [5744](https://github.com/gfx-rs/wgpu/pull/5744).

Vulkan

- Fix enablement of subgroup ops extension on Vulkan devices that don't support Vulkan 1.3. By cwfitzgerald in [5624](https://github.com/gfx-rs/wgpu/pull/5624).


GLES / OpenGL

- Fix regression on OpenGL (EGL) where non-sRGB still used sRGB [5642](https://github.com/gfx-rs/wgpu/pull/5642)

Naga

- Work around shader consumers that have bugs handling `switch` statements with a single body for all cases. These are now written as `do {} while(false);` loops in hlsl-out and glsl-out. By Imberflur in [5654](https://github.com/gfx-rs/wgpu/pull/5654)
- In hlsl-out, defer `continue` statements in switches by setting a flag and breaking from the switch. This allows such constructs to work with FXC which does not support `continue` within a switch. By Imberflur in [5654](https://github.com/gfx-rs/wgpu/pull/5654)

0.20.0

Major Changes

Pipeline overridable constants

Wgpu supports now [pipeline-overridable constants](https://www.w3.org/TR/webgpu/#dom-gpuprogrammablestage-constants)

This allows you to define constants in wgsl like this:
rust
override some_factor: f32 = 42.1337; // Specifies a default of 42.1337 if it's not set.

And then set them at runtime like so on your pipeline consuming this shader:
rust
// ...
fragment: Some(wgpu::FragmentState {
compilation_options: wgpu::PipelineCompilationOptions {
constants: &[("some_factor".to_owned(), 0.1234)].into(), // Sets `some_factor` to 0.1234.
..Default::default()
},
// ...
}),
// ...


By teoxoy & jimblandy in [5500](https://github.com/gfx-rs/wgpu/pull/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 new `wgpu::Features::TIMESTAMP_QUERY_INSIDE_ENCODERS` feature which is available on all native backends but not on WebGPU.

By wumpf in [5188](https://github.com/gfx-rs/wgpu/pull/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](https://github.com/gfx-rs/wgpu/pull/4879), [#5098](https://github.com/gfx-rs/wgpu/pull/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 except `subgroupBarrier` in fragment & compute, supported on Vulkan, DX12 and Metal.
* `wgpu::Features::SUBGROUP_VERTEX`, for all operations except `subgroupBarrier` general operations in vertex shaders, supported on Vulkan
* `wgpu::Features::SUBGROUP_BARRIER`, for support of the `subgroupBarrier` operation, supported on Vulkan & Metal

Note that there currently [some differences](https://github.com/gfx-rs/wgpu/issues/5555) between wgpu's native-only implementation and the [open WebGPU proposal](https://github.com/gpuweb/gpuweb/blob/main/proposals/subgroups.md).

By exrook and lichtso in [5301](https://github.com/gfx-rs/wgpu/pull/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` and `u64` respectively).
Supported on Vulkan, DX12 (requires DXC) and Metal (with MSL 2.3+ support).

By atlv24 and cwfitzgerald in [5154](https://github.com/gfx-rs/wgpu/pull/5154)

New features

General

- Implemented the `Unorm10_10_10_2` VertexFormat by McMackety in [5477](https://github.com/gfx-rs/wgpu/pull/5477)
- `wgpu-types`'s `trace` and `replay` features have been replaced by the `serde` feature. By KirmesBude in [5149](https://github.com/gfx-rs/wgpu/pull/5149)
- `wgpu-core`'s `serial-pass` feature has been removed. Use `serde` instead. By KirmesBude in [5149](https://github.com/gfx-rs/wgpu/pull/5149)
- Added `InstanceFlags::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](https://github.com/gfx-rs/wgpu/pull/5146), [#5046](https://github.com/gfx-rs/wgpu/pull/5046).
- When set, this flag implies `InstanceFlags::VALIDATION`.
- This has been added to the set of flags set by `InstanceFlags::advanced_debugging`. Since the overhead is potentially very large, the flag is not enabled by default in debug builds when using `InstanceFlags::from_build_config`.
- As with other instance flags, this flag can be changed in calls to `InstanceFlags::with_env` with the new `WGPU_GPU_BASED_VALIDATION` environment variable.
- `wgpu::Instance` can now report which `wgpu::Backends` are available based on the build configuration. By wumpf [5167](https://github.com/gfx-rs/wgpu/pull/5167)
diff
-wgpu::Instance::any_backend_feature_enabled()
+!wgpu::Instance::enabled_backend_features().is_empty()

- Breaking change: [`wgpu_core::pipeline::ProgrammableStageDescriptor`](https://docs.rs/wgpu-core/latest/wgpu_core/pipeline/struct.ProgrammableStageDescriptor.html#structfield.entry_point) is now optional. By ErichDonGubler in [5305](https://github.com/gfx-rs/wgpu/pull/5305).
- `Features::downlevel{_webgl2,}_features` was made const by MultisampledNight in [5343](https://github.com/gfx-rs/wgpu/pull/5343)
- Breaking change: [`wgpu_core::pipeline::ShaderError`](https://docs.rs/wgpu-core/latest/wgpu_core/pipeline/struct.ShaderError.html) has been moved to `naga`. By stefnotch in [#5410](https://github.com/gfx-rs/wgpu/pull/5410)
- More as_hal methods and improvements by JMS55 in [5452](https://github.com/gfx-rs/wgpu/pull/5452)
- Added `wgpu::CommandEncoder::as_hal_mut`
- Added `wgpu::TextureView::as_hal`
- `wgpu::Texture::as_hal` now returns a user-defined type to match the other as_hal functions

Naga

- Allow user to select which MSL version to use via `--metal-version` with Naga CLI. By pcleavelin in [5392](https://github.com/gfx-rs/wgpu/pull/5392)
- Support `arrayLength` for runtime-sized arrays inside binding arrays (for WGSL input and SPIR-V output). By kvark in [5428](https://github.com/gfx-rs/wgpu/pull/5428)
- Added `--shader-stage` and `--input-kind` options to naga-cli for specifying vertex/fragment/compute shaders, and frontend. by ratmice in [5411](https://github.com/gfx-rs/wgpu/pull/5411)
- Added a `create_validator` function to wgpu_core `Device` to create naga `Validator`s. By atlv24 [5606](https://github.com/gfx-rs/wgpu/pull/5606)

WebGPU

- Implement the `device_set_device_lost_callback` method for `ContextWebGpu`. By suti in [5438](https://github.com/gfx-rs/wgpu/pull/5438)
- Add support for storage texture access modes `ReadOnly` and `ReadWrite`. By JolifantoBambla in [5434](https://github.com/gfx-rs/wgpu/pull/5434)

GLES / OpenGL

- Log an error when GLES texture format heuristics fail. By PolyMeilex in [5266](https://github.com/gfx-rs/wgpu/issues/5266)
- Cache the sample count to keep `get_texture_format_features` cheap. By Dinnerbone in [5346](https://github.com/gfx-rs/wgpu/pull/5346)
- Mark `DEPTH32FLOAT_STENCIL8` as supported in GLES. By Dinnerbone in [5370](https://github.com/gfx-rs/wgpu/pull/5370)
- Desktop GL now also supports `TEXTURE_COMPRESSION_ETC2`. By Valaphee in [5568](https://github.com/gfx-rs/wgpu/pull/5568)
- Don't create a program for shader-clearing if that workaround isn't required. By Dinnerbone in [5348](https://github.com/gfx-rs/wgpu/pull/5348).
- OpenGL will now be preferred over OpenGL ES on EGL, making it consistent with WGL. By valaphee in [5482](https://github.com/gfx-rs/wgpu/pull/5482)
- Fill out `driver` and `driver_info`, with the OpenGL flavor and version, similar to Vulkan. By valaphee in [5482](https://github.com/gfx-rs/wgpu/pull/5482)

Metal

- Metal 3.0 and 3.1 detection. By atlv24 in [5497](https://github.com/gfx-rs/wgpu/pull/5497)

DX12

- Shader Model 6.1-6.7 detection. By atlv24 in [5498](https://github.com/gfx-rs/wgpu/pull/5498)

Other performance improvements

- Simplify and speed up the allocation of internal IDs. By nical in [5229](https://github.com/gfx-rs/wgpu/pull/5229)
- Use memory pooling for UsageScopes to avoid frequent large allocations. by robtfm in [5414](https://github.com/gfx-rs/wgpu/pull/5414)
- Eager release of GPU resources comes from device.trackers. By bradwerth in [5075](https://github.com/gfx-rs/wgpu/pull/5075)
- Support disabling zero-initialization of workgroup local memory in compute shaders. By DJMcNab in [5508](https://github.com/gfx-rs/wgpu/pull/5508)

Documentation

- Improved `wgpu_hal` documentation. By jimblandy in [5516](https://github.com/gfx-rs/wgpu/pull/5516), [#5524](https://github.com/gfx-rs/wgpu/pull/5524), [#5562](https://github.com/gfx-rs/wgpu/pull/5562), [#5563](https://github.com/gfx-rs/wgpu/pull/5563), [#5566](https://github.com/gfx-rs/wgpu/pull/5566), [#5617](https://github.com/gfx-rs/wgpu/pull/5617), [#5618](https://github.com/gfx-rs/wgpu/pull/5618)
- Add mention of primitive restart in the description of `PrimitiveState::strip_index_format`. By cpsdqs in [5350](https://github.com/gfx-rs/wgpu/pull/5350)
- Document and tweak precise behaviour of `SourceLocation`. By stefnotch in [5386](https://github.com/gfx-rs/wgpu/pull/5386) and [#5410](https://github.com/gfx-rs/wgpu/pull/5410)
- Give short example of WGSL `push_constant` syntax. By waywardmonkeys in [5393](https://github.com/gfx-rs/wgpu/pull/5393)
- Fix incorrect documentation of `Limits::max_compute_workgroup_storage_size` default value. By atlv24 in [5601](https://github.com/gfx-rs/wgpu/pull/5601)

Bug Fixes

General
- Fix `serde` feature not compiling for `wgpu-types`. By KirmesBude in [5149](https://github.com/gfx-rs/wgpu/pull/5149)
- Fix the validation of vertex and index ranges. By nical in [5144](https://github.com/gfx-rs/wgpu/pull/5144) and [#5156](https://github.com/gfx-rs/wgpu/pull/5156)
- Fix panic when creating a surface while no backend is available. By wumpf [5166](https://github.com/gfx-rs/wgpu/pull/5166)
- Correctly compute minimum buffer size for array-typed `storage` and `uniform` vars. By jimblandy [5222](https://github.com/gfx-rs/wgpu/pull/5222)
- Fix timeout when presenting a surface where no work has been done. By waywardmonkeys in [5200](https://github.com/gfx-rs/wgpu/pull/5200)
- Fix registry leaks with de-duplicated resources. By nical in [5244](https://github.com/gfx-rs/wgpu/pull/5244)
- Fix linking when targeting android. By ashdnazg in [5326](https://github.com/gfx-rs/wgpu/pull/5326).
- Failing to set the device lost closure will call the closure before returning. By bradwerth in [5358](https://github.com/gfx-rs/wgpu/pull/5358).
- Fix deadlocks caused by recursive read-write lock acquisitions [5426](https://github.com/gfx-rs/wgpu/pull/5426).
- Remove exposed C symbols (`extern "C"` + [no_mangle]) from RenderPass & ComputePass recording. By wumpf in [5409](https://github.com/gfx-rs/wgpu/pull/5409).
- Fix surfaces being only compatible with first backend enabled on an instance, causing failures when manually specifying an adapter. By Wumpf in [5535](https://github.com/gfx-rs/wgpu/pull/5535).

Naga

- In spv-in, remove unnecessary "gl_PerVertex" name check so unused builtins will always be skipped. Prevents validation errors caused by capability requirements of these builtins [4915](https://github.com/gfx-rs/wgpu/issues/4915). By Imberflur in [#5227](https://github.com/gfx-rs/wgpu/pull/5227).
- In spv-out, check for acceleration and ray-query types when enabling ray-query extension to prevent validation error. By Vecvec in [5463](https://github.com/gfx-rs/wgpu/pull/5463)
- Add a limit for curly brace nesting in WGSL parsing, plus a note about stack size requirements. By ErichDonGubler in [5447](https://github.com/gfx-rs/wgpu/pull/5447).
- In hlsl-out, fix accesses on zero value expressions by generating helper functions for `Expression::ZeroValue`. By Imberflur in [5587](https://github.com/gfx-rs/wgpu/pull/5587).
- Fix behavior of `extractBits` and `insertBits` when `offset + count` overflows the bit width. By cwfitzgerald in [5305](https://github.com/gfx-rs/wgpu/pull/5305)
- Fix behavior of integer `clamp` when `min` argument > `max` argument. By cwfitzgerald in [5300](https://github.com/gfx-rs/wgpu/pull/5300).
- Fix `TypeInner::scalar_width` to be consistent with the rest of the codebase and return values in bytes not bits. By atlv24 in [5532](https://github.com/gfx-rs/wgpu/pull/5532).

GLES / OpenGL

- GLSL 410 does not support layout(binding = ...), enable only for GLSL 420. By bes in [5357](https://github.com/gfx-rs/wgpu/pull/5357)
- Fixes for being able to use an OpenGL 4.1 core context provided by macOS with wgpu. By bes in [5331](https://github.com/gfx-rs/wgpu/pull/5331).
- Fix crash when holding multiple devices on wayland/surfaceless. By ashdnazg in [5351](https://github.com/gfx-rs/wgpu/pull/5351).
- Fix `first_instance` getting ignored in draw indexed when `ARB_shader_draw_parameters` feature is present and `base_vertex` is 0. By valaphee in [5482](https://github.com/gfx-rs/wgpu/pull/5482)

Vulkan

- Set object labels when the DEBUG flag is set, even if the VALIDATION flag is disabled. By DJMcNab in [5345](https://github.com/gfx-rs/wgpu/pull/5345).
- Add safety check to `wgpu_hal::vulkan::CommandEncoder` to make sure `discard_encoding` is not called in the closed state. By villuna in [5557](https://github.com/gfx-rs/wgpu/pull/5557)
- Fix SPIR-V type capability requests to not depend on `LocalType` caching. By atlv24 in [5590](https://github.com/gfx-rs/wgpu/pull/5590)
- Upgrade `ash` to `0.38`. By MarijnS95 in [5504](https://github.com/gfx-rs/wgpu/pull/5504).

Tests

- Fix intermittent crashes on Linux in the `multithreaded_compute` test. By jimblandy in [5129](https://github.com/gfx-rs/wgpu/pull/5129).
- Refactor tests to read feature flags by name instead of a hardcoded hexadecimal u64. By atlv24 in [5155](https://github.com/gfx-rs/wgpu/pull/5155).
- Add test that verifies that we can drop the queue before using the device to create a command encoder. By Davidster in [5211](https://github.com/gfx-rs/wgpu/pull/5211)

0.19.5

This release only releases `wgpu-hal` 0.19.5, which contains an important fix
for DX12.

Bug Fixes

DX12

- Do not feed `&""` to `D3DCompile`, by workingjubilee in [5812](https://github.com/gfx-rs/wgpu/issues/5812), backported by Elabajaba in [#5833](https://github.com/gfx-rs/wgpu/pull/5833).

0.19.4

Bug Fixes

General

- Don't depend on bind group and bind group layout entry order in backends. This caused incorrect severely incorrect command execution and, in some cases, crashes. By ErichDonGubler in [5421](https://github.com/gfx-rs/wgpu/pull/5421).
- Properly clean up all write_buffer/texture temporary resources. By robtfm in [5413](https://github.com/gfx-rs/wgpu/pull/5413).
- Fix deadlock in certain situations when mapping buffers using `wgpu-profiler`. By cwfitzgerald in [5517](https://github.com/gfx-rs/wgpu/pull/5517)

WebGPU
- Correctly pass through timestamp queries to WebGPU. By cwfitzgerald in [5527](https://github.com/gfx-rs/wgpu/pull/5527).

0.19.3

This release includes `wgpu`, `wgpu-core`, and `wgpu-hal`. All other crates are unchanged.

Major Changes

Vendored WebGPU Bindings from `web_sys`

**`--cfg=web_sys_unstable_apis` is no longer needed in your `RUSTFLAGS` to compile for WebGPU!!!**

While WebGPU's javascript api is stable in the browsers, the `web_sys` bindings for WebGPU are still improving. As such they are hidden behind the special cfg `--cfg=web_sys_unstable_apis` and are not available by default. Everyone who wanted to use our WebGPU backend needed to enable this cfg in their `RUSTFLAGS`. This was very inconvenient and made it hard to use WebGPU, especially when WebGPU is enabled by default. Additionally, the unstable APIs don't adhere to semver, so there were repeated breakages.

To combat this problem we have decided to vendor the `web_sys` bindings for WebGPU within the crate. Notably we are not forking the bindings, merely vendoring, so any improvements we make to the bindings will be contributed directly to upstream `web_sys`.

By cwfitzgerald in [5325](https://github.com/gfx-rs/wgpu/pull/5325).

Bug Fixes

General

- Fix an issue where command encoders weren't properly freed if an error occurred during command encoding. By ErichDonGubler in [5251](https://github.com/gfx-rs/wgpu/pull/5251).
- Fix incorrect validation causing all indexed draws on render bundles to fail. By wumpf in [5430](https://github.com/gfx-rs/wgpu/pull/5340).

Android
- Fix linking error when targeting android without `winit`. By ashdnazg in [5326](https://github.com/gfx-rs/wgpu/pull/5326).

0.19.2

This release includes `wgpu`, `wgpu-core`, `wgpu-hal`, `wgpu-types`, and `naga`. All other crates are unchanged.

Added/New Features

General
- `wgpu::Id` now implements `PartialOrd`/`Ord` allowing it to be put in `BTreeMap`s. By cwfitzgerald and 9291Sam in [5176](https://github.com/gfx-rs/wgpu/pull/5176)

OpenGL
- Log an error when OpenGL texture format heuristics fail. By PolyMeilex in [5266](https://github.com/gfx-rs/wgpu/issues/5266)

`wgsl-out`
- Learned to generate acceleration structure types. By JMS55 in [5261](https://github.com/gfx-rs/wgpu/pull/5261)

Documentation
- Fix link in `wgpu::Instance::create_surface` documentation. By HexoKnight in [5280](https://github.com/gfx-rs/wgpu/pull/5280).
- Fix typo in `wgpu::CommandEncoder::clear_buffer` documentation. By PWhiddy in [5281](https://github.com/gfx-rs/wgpu/pull/5281).
- `Surface` configuration incorrectly claimed that `wgpu::Instance::create_surface` was unsafe. By hackaugusto in [5265](https://github.com/gfx-rs/wgpu/pull/5265).

Bug Fixes

General
- Device lost callbacks are invoked when replaced and when global is dropped. By bradwerth in [5168](https://github.com/gfx-rs/wgpu/pull/5168)
- Fix performance regression when allocating a large amount of resources of the same type. By nical in [5229](https://github.com/gfx-rs/wgpu/pull/5229)
- Fix docs.rs wasm32 builds. By cwfitzgerald in [5310](https://github.com/gfx-rs/wgpu/pull/5310)
- Improve error message when binding count limit hit. By hackaugusto in [5298](https://github.com/gfx-rs/wgpu/pull/5298)
- Remove an unnecessary `clone` during GLSL shader ingestion. By a1phyr in [5118](https://github.com/gfx-rs/wgpu/pull/5118).
- Fix missing validation for `Device::clear_buffer` where `offset + size > buffer.size` was not checked when `size` was omitted. By ErichDonGubler in [5282](https://github.com/gfx-rs/wgpu/pull/5282).

DX12
- Fix `panic!` when dropping `Instance` without `InstanceFlags::VALIDATION`. By hakolao in [5134](https://github.com/gfx-rs/wgpu/pull/5134)

OpenGL
- Fix internal format for the `Etc2Rgba8Unorm` format. By andristarr in [5178](https://github.com/gfx-rs/wgpu/pull/5178)
- Try to load `libX11.so.6` in addition to `libX11.so` on linux. [5307](https://github.com/gfx-rs/wgpu/pull/5307)
- Make use of `GL_EXT_texture_shadow_lod` to support sampling a cube depth texture with an explicit LOD. By cmrschwarz in [5171](https://github.com/gfx-rs/wgpu/pull/5171).

`glsl-in`

- Fix code generation from nested loops. By cwfitzgerald and teoxoy in [5311](https://github.com/gfx-rs/wgpu/pull/5311)

Page 3 of 15

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.