Wgpu

Latest version: v0.21.1

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

Scan your dependencies

Page 15 of 15

0.3.0

With this update we're using a later release of wgpu-native, and follow changes
is the WebGPU spec. Further, we've removed the need for ctypes to communicate
data arrays. Instead, wgpu-py can consume any object that supports the buffer
protocol, and it returns `memoryview` objects.

Added:

* The texture object has more properties to query the parameters that it was created with.
* The texture view object has a `texture` property.
* The render and compute pipeline objects have a property `layout` and a method `get_bind_group_layout()`.
* The shader object got a `compilation_info` method, but this does not do anything yet.
* The `create_shader_module()` has a `source_map` attribute, but this is yet unused.
* Log messages from wgpu-native (Rust) are now injected into Python's logger.
* The `queue` object got two new methods `write_buffer` and `write_texture`.
* The buffer has `read_data()` and `write_data()` methods. Note: the latter may be removed later.
* The device `create_buffer_with_data` is added as a convenience function. This will likely stay.

Changed:

* Targets wgpu-native v.0.5.2. The first release build from the wgpu-native repo itself.
* The `array_layer` in copy operations involving a texture is removed.
* The `utils.compute_with_buffers` function now accepts *any* data dat supports
the buffer protocol (not just ctypes arrays). The outputs are `memoryview` objects,
which shape and format can be specified. When a ctypes array type is specified,
the output will be an instance of that type. This means that these changes are
fully backwards compatible.

Removed:

* The buffer (for now) no longer exposes a data mapping API. Instead use `read_data()` and `write_data()`.
* The device `create_buffer_mapped` method is similarly removed. Use `create_buffer_with_data` instead.

0.2

- Platforms: iOS/Metal, D3D11
- Crates:
- `wgpu-remote`: remoting layer for the cross-process boundary
- `gfx-examples`: selected gfx pre-ll examples ported over
- Features:
- native example for compute
- "gfx-cube" and "gfx-shadow" examples
- copies between buffers and textures
- separate object identity for the remote client
- texture view tracking
- native swapchain resize support
- buffer mapping
- object index epochs
- comprehensive list of vertex and texture formats
- validation of pipeline compatibility with the pass
- Fixes
- fixed resource destruction

0.2.0

Added:

* The canvas now has a `request_draw` method.
* More and better docs.
* The canvas can be passed to `request_adapter` so that the created surface
can be selected on it.
* Support for debug markers.

Changed:

* Targets wgpu-native v0.5.1. This is the last release when wgpu-native was still part of wgpu-core.
* The `bindings` in bind groups and bind group layouts are now called `entries`.
* There is no more generic storage texture, only a readonly and a writeonly one.
* The `set_index_buffer` and `set_vertex_buffer` methods got a `size` argument.
* The `row_pitch` and `image_height` args in copy operations involving a texture
are renamed to `bytes_per_row` and `rows_per_image`.
* Rendering is now done under the swap_chain's context: `with swap_chain as current_texture_view`

0.1.6

This release is the first moderately mature version of wgpu-py.


Change Log

<!--
Please add your PR to the changelog! Choose from a top level and bottom
level category, then write your changes like follows:

- Describe your change in a user friendly format. By yourslug in [99999](https://github.com/gfx-rs/wgpu/pull/99999)

You can add additional user facing information if it's a major breaking change. You can use the following to help:

diff
- Old code
+ New code


Top level categories:
- Major changes
- Added/New Features
- Changes
- Bug Fixes (that don't change API)
- Performance
- Documentation
- Dependency Updates
- deno-webgpu
- Examples
- Testing/Internal

Bottom level categories:

- Naga
- General
- DX12
- Vulkan
- Metal
- GLES / OpenGL
- WebGPU
- Emscripten
- Hal
-->

Unreleased

Major Features

Hashmaps Removed from APIs

Both `PipelineCompilationOptions::constants` and `ShaderSource::Glsl::defines` now take
slices of key-value pairs instead of `hashmap`s. This is to prepare for `no_std`
support and allow us to keep which `hashmap` hasher and such as implementation details. It
also allows more easily creating these structures inline.

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

All Backends Now Have Features

Previously, the `vulkan` and `gles` backends were non-optional on windows, linux, and android and there was no way to disable them. We have now figured out how to properly make them disablable! Additionally, if you turn on the `webgl` feature, you will only get the GLES backend on WebAssembly, it won't leak into native builds, like previously it might have.

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

`device.poll` Api Reworked

This release reworked the poll api significantly to allow polling to return errors when polling hits internal timeout limits.

`Maintain` was renamed `PollType`. Additionally, `poll` now returns a result containing information about what happened during the poll.

diff
-pub fn wgpu::Device::poll(&self, maintain: wgpu::Maintain) -> wgpu::MaintainResult
+pub fn wgpu::Device::poll(&self, poll_type: wgpu::PollType) -> Result<wgpu::PollStatus, wgpu::PollError>

-device.poll(wgpu::Maintain::Poll);
+device.poll(wgpu::PollType::Poll).unwrap();


rust
pub enum PollType<T> {
/// On wgpu-core based backends, block until the given submission has
/// completed execution, and any callbacks have been invoked.
///
/// On WebGPU, this has no effect. Callbacks are invoked from the
/// window event loop.
WaitForSubmissionIndex(T),
/// Same as WaitForSubmissionIndex but waits for the most recent submission.
Wait,
/// Check the device for a single time without blocking.
Poll,
}

pub enum PollStatus {
/// There are no active submissions in flight as of the beginning of the poll call.
/// Other submissions may have been queued on other threads during the call.
///
/// This implies that the given Wait was satisfied before the timeout.
QueueEmpty,

/// The requested Wait was satisfied before the timeout.
WaitSucceeded,

/// This was a poll.
Poll,
}

pub enum PollError {
/// The requested Wait timed out before the submission was completed.
Timeout,
}


> [!WARNING]
> As part of this change, WebGL's default behavior has changed. Previously `device.poll(Wait)` appeared as though it functioned correctly. This was a quirk caused by the bug that these PRs fixed. Now it will always return `Timeout` if the submission has not already completed. As many people rely on this behavior on WebGL, there is a new options in `BackendOptions`. If you want the old behavior, set the following on instance creation:
>
> rust
> instance_desc.backend_options.gl.fence_behavior = wgpu::GlFenceBehavior::AutoFinish;
>
>
> You will lose the ability to know exactly when a submission has completed, but `device.poll(Wait)` will behave the same as it does on native.

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

Naga

Ensure loops generated by SPIR-V and HLSL Naga backends are bounded

Make sure that all loops in shaders generated by these naga backends are bounded
to avoid undefined behaviour due to infinite loops. Note that this may have a
performance cost. As with the existing implementation for the MSL backend this
can be disabled by using `Device::create_shader_module_trusted()`.

By jamienicol in [6929](https://github.com/gfx-rs/wgpu/pull/6929) and [#7080](https://github.com/gfx-rs/wgpu/pull/7080).

Split up `Features` internally

Internally split up the `Features` struct and recombine them internally using a macro. There should be no breaking
changes from this. This means there are also namespaces (as well as the old `Features::*`) for all wgpu specific
features and webgpu feature (`FeaturesWGPU` and `FeaturesWebGPU` respectively) and `Features::from_internal_flags` which
allow you to be explicit about whether features you need are available on the web too.

By Vecvec in [6905](https://github.com/gfx-rs/wgpu/pull/6905), [#7086](https://github.com/gfx-rs/wgpu/pull/7086)

WebGPU compliant dual source blending feature

Previously, dual source blending was implemented with a `wgpu` native only feature flag and used a custom syntax in wgpu.
By now, dual source blending was added to the [WebGPU spec as an extension](https://www.w3.org/TR/webgpu/#dom-gpufeaturename-dual-source-blending).
We're now following suite and implement the official syntax.

Existing shaders using dual source blending need to be updated:

diff
struct FragmentOutput{
- location(0) source0: vec4<f32>,
- location(0) second_blend_source source1: vec4<f32>,
+ location(0) blend_src(0) source0: vec4<f32>,
+ location(0) blend_src(1) source1: vec4<f32>,
}


With that `wgpu::Features::DUAL_SOURCE_BLENDING` is now available on WebGPU.

Furthermore, GLSL shaders now support dual source blending as well via the `index` layout qualifier:
c
layout(location = 0, index = 0) out vec4 output0;
layout(location = 0, index = 1) out vec4 output1;


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

New Features

- Added mesh shader support to `wgpu_hal`. By SupaMaggie70Incorporated in [7089](https://github.com/gfx-rs/wgpu/pull/7089)

General

- It is now possible to create a dummy `wgpu` device even when no GPU is available. This may be useful for testing of code which manages graphics resources. Currently, it supports reading and writing buffers, and other resource types can be created but do nothing.

To use it, enable the `noop` feature of `wgpu`, and either call `Device::noop()`, or add `NoopBackendOptions { enable: true }` to the backend options of your `Instance` (this is an additional safeguard beyond the `Backends` bits).

By kpreid in [7063](https://github.com/gfx-rs/wgpu/pull/7063) and [#7342](https://github.com/gfx-rs/wgpu/pull/7342).

- Add `Buffer` methods corresponding to `BufferSlice` methods, so you can skip creating a `BufferSlice` when it offers no benefit, and `BufferSlice::slice()` for sub-slicing a slice. By kpreid in [7123](https://github.com/gfx-rs/wgpu/pull/7123).
- Add `BufferSlice::buffer()`, `BufferSlice::offset()` and `BufferSlice::size()`. By kpreid in [7148](https://github.com/gfx-rs/wgpu/pull/7148).
- Add `impl From<BufferSlice> for BufferBinding` and `impl From<BufferSlice> for BindingResource`, allowing `BufferSlice`s to be easily used in creating bind groups. By kpreid in [7148](https://github.com/gfx-rs/wgpu/pull/7148).

- Add `util::StagingBelt::allocate()` so the staging belt can be used to write textures. By kpreid in [6900](https://github.com/gfx-rs/wgpu/pull/6900).
- Added `CommandEncoder::transition_resources()` for native API interop, and allowing users to slightly optimize barriers. By JMS55 in [6678](https://github.com/gfx-rs/wgpu/pull/6678).
- Add `wgpu_hal::vulkan::Adapter::texture_format_as_raw` for native API interop. By JMS55 in [7228](https://github.com/gfx-rs/wgpu/pull/7228).

- Support getting vertices of the hit triangle when raytracing. By Vecvec in [7183](https://github.com/gfx-rs/wgpu/pull/7183) .

Naga

- Add support for unsigned types when calling textureLoad with the level parameter. By ygdrasil-io in [7058](https://github.com/gfx-rs/wgpu/pull/7058).
- Support must_use attribute on function declarations. By turbocrime in [6801](https://github.com/gfx-rs/wgpu/pull/6801).
- Support for generating the candidate intersections from AABB geometry, and confirming the hits. By kvark in [7047](https://github.com/gfx-rs/wgpu/pull/7047).
- Make naga::back::spv::Function::to_words write the OpFunctionEnd instruction in itself, instead of making another call after it. By junjunjd in [7156](https://github.com/gfx-rs/wgpu/pull/7156).
- Add support for texture memory barriers. By Devon7925 in [7173](https://github.com/gfx-rs/wgpu/pull/7173).

Changes

General

- `wgpu::Instance::request_adapter()` now returns `Result` instead of `Option`; the error provides information about why no suitable adapter was returned. By kpreid in [7330](https://github.com/gfx-rs/wgpu/pull/7330).
- Support BLAS compaction in wgpu-hal. By Vecvec in [7101](https://github.com/gfx-rs/wgpu/pull/7101).
- Avoid using default features in many dependencies, etc. By Brody in [7031](https://github.com/gfx-rs/wgpu/pull/7031)
- Use `hashbrown` to simplify no-std support. By Brody in [6938](https://github.com/gfx-rs/wgpu/pull/6938) & [#6925](https://github.com/gfx-rs/wgpu/pull/6925).
- If you use Binding Arrays in a bind group, you may not use Dynamic Offset Buffers or Uniform Buffers in that bind group. By cwfitzgerald in [6811](https://github.com/gfx-rs/wgpu/pull/6811)
- Rename `instance_id` and `instance_custom_index` to `instance_index` and `instance_custom_data` by Vecvec in
[6780](https://github.com/gfx-rs/wgpu/pull/6780)


Naga

- Naga IR types are now available in the module `naga::ir` (e.g. `naga::ir::Module`).
The original names (e.g. `naga::Module`) remain present for compatibility.
By kpreid in [7365](https://github.com/gfx-rs/wgpu/pull/7365).
- Refactored `use` statements to simplify future `no_std` support. By bushrat011899 in [7256](https://github.com/gfx-rs/wgpu/pull/7256)

Vulkan

HAL queue callback support

- Add a way to notify with `Queue::submit()` to Vulkan's `vk::Semaphore` allocated outside of wgpu. By sotaroikeda in [6813](https://github.com/gfx-rs/wgpu/pull/6813).

Bug Fixes

Naga

- Fix some instances of functions which have a return type but don't return a value being incorrectly validated. By jamienicol in [7013](https://github.com/gfx-rs/wgpu/pull/7013).
- Allow abstract expressions to be used in WGSL function return statements. By jamienicol in [7035](https://github.com/gfx-rs/wgpu/pull/7035).
- Error if structs have two fields with the same name. By SparkyPotato in [7088](https://github.com/gfx-rs/wgpu/pull/7088).
- Forward '--keep-coordinate-space' flag to GLSL backend in naga-cli. By cloone8 in [7206](https://github.com/gfx-rs/wgpu/pull/7206).
- Allow template lists to have a trailing comma. By KentSlaney in [7142](https://github.com/gfx-rs/wgpu/pull/7142).
- Allow WGSL const declarations to have abstract types. By jamienicol in [7055](https://github.com/gfx-rs/wgpu/pull/7055) and [#7222](https://github.com/gfx-rs/wgpu/pull/7222).
- Allows override-sized arrays to resolve to the same size without causing the type arena to panic. By KentSlaney in [7082](https://github.com/gfx-rs/wgpu/pull/7082).
- Allow abstract types to be used for WGSL switch statement selector and case selector expressions. By jamienicol in [7250](https://github.com/gfx-rs/wgpu/pull/7250).

General

- Avoid overflow in query set bounds check validation. By ErichDonGubler in [6933](https://github.com/gfx-rs/wgpu/pull/6933).
- Add Flush to GL Queue::submit. By cwfitzgerald in [6941](https://github.com/gfx-rs/wgpu/pull/6941).
- Fix `wgpu` not building with `--no-default-features` on when targeting `wasm32-unknown-unknown`. By wumpf in [6946](https://github.com/gfx-rs/wgpu/pull/6946).
- Fix `CopyExternalImageDestInfo` not exported on `wgpu`. By wumpf in [6962](https://github.com/gfx-rs/wgpu/pull/6962).
- Reduce downlevel `max_color_attachments` limit from 8 to 4 for better GLES compatibility. By adrian17 in [6994](https://github.com/gfx-rs/wgpu/pull/6994).
- Fix drop order in `Surface`. By ed-2100 in [6997](https://github.com/gfx-rs/wgpu/pull/6997)
- Fix a possible deadlock within `Queue::write_texture`. By metamuffin in [7004](https://github.com/gfx-rs/wgpu/pull/7004)
- Fix building a BLAS with a transform buffer by adding a flag to indicate usage of the transform buffer. By Vecvec in
[7062](https://github.com/gfx-rs/wgpu/pull/7062).

Vulkan

- Stop naga causing undefined behavior when a ray query misses. By Vecvec in [6752](https://github.com/gfx-rs/wgpu/pull/6752).

Metal

- Use resize observers for smoother resizing. By madsmtm in [7026](https://github.com/gfx-rs/wgpu/pull/7026).

Gles

- Support OpenHarmony render with `gles`. By richerfu in [7085](https://github.com/gfx-rs/wgpu/pull/7085)

Dx12

- Fix HLSL storage format generation. By Vecvec in [6993](https://github.com/gfx-rs/wgpu/pull/6993) and [#7104](https://github.com/gfx-rs/wgpu/pull/7104)
- Fix 3D storage texture bindings. By SparkyPotato in [7071](https://github.com/gfx-rs/wgpu/pull/7071)
- Fix DX12 composite alpha modes. By amrbashir in [7117](https://github.com/gfx-rs/wgpu/pull/7117)

WebGPU

- Improve efficiency of dropping read-only buffer mappings. By kpreid in [7007](https://github.com/gfx-rs/wgpu/pull/7007).

Performance

Naga

- Replace `unicode-xid` with `unicode-ident`. By CrazyboyQCD in [7135](https://github.com/gfx-rs/wgpu/pull/7135)

Documentation

- Improved documentation around pipeline caches and `TextureBlitter`. By DJMcNab in [6978](https://github.com/gfx-rs/wgpu/pull/6978) and [#7003](https://github.com/gfx-rs/wgpu/pull/7003).
- Improved documentation of `PresentMode`, buffer mapping functions, memory alignment requirements, texture formats’ automatic conversions, and various types and constants. By kpreid in [7211](https://github.com/gfx-rs/wgpu/pull/7211) and [#7283](https://github.com/gfx-rs/wgpu/pull/7283).

- Added a hello window example. By laycookie in [6992](https://github.com/gfx-rs/wgpu/pull/6992).

Examples

- Call `pre_present_notify()` before presenting. By kjarosh in [7074](https://github.com/gfx-rs/wgpu/pull/7074).

0.1

- Platforms: Linux/Vulkan, Windows/Vulkan, D3D12, macOS/Metal
- Crates:
- `wgpu-native`: C API implementation of WebGPU, based on gfx-hal
- `wgpu-bindings`: auto-generated C headers
- `wgpu`: idiomatic Rust wrapper
- `examples`: native C examples
- Features:
- native examples for triangle rendering
- basic native swapchain integration
- concept of the storage hub
- basic recording of passes and command buffers
- submission-based lifetime tracking and command buffer recycling
- automatic resource transitions

Page 15 of 15

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.