Wgpu

Latest version: v0.15.2

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

Scan your dependencies

Page 2 of 13

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)

0.19.1

This release includes `wgpu` and `wgpu-hal`. The rest of the crates are unchanged since 0.19.0.

Bug Fixes

DX12

- Properly register all swapchain buffers to prevent error on surface present. By dtzxporter in [5091](https://github.com/gfx-rs/wgpu/pull/5091)
- Check for extra null states when creating resources. By nical in [5096](https://github.com/gfx-rs/wgpu/pull/5096)
- Fix depth-only and stencil-only views causing crashes. By teoxoy in [5100](https://github.com/gfx-rs/wgpu/pull/5100)

OpenGL

- In Surface::configure and Surface::present on Windows, fix the current GL context not being unset when releasing the lock that guards access to making the context current. This was causing other threads to panic when trying to make the context current. By Imberflur in [5087](https://github.com/gfx-rs/wgpu/pull/5087).

WebGPU

- Improve error message when compiling WebGPU backend on wasm without the `web_sys_unstable_apis` set. By rukai in [5104](https://github.com/gfx-rs/wgpu/pull/5104)

Documentation

- Document Wayland specific behavior related to `SurfaceTexture::present`. By i509VCB in [5093](https://github.com/gfx-rs/wgpu/pull/5093).

0.19.0

This release includes:
- `wgpu`
- `wgpu-core`
- `wgpu-hal`
- `wgpu-types`
- `wgpu-info`
- `naga` (skipped from 0.14 to 0.19)
- `naga-cli` (skipped from 0.14 to 0.19)
- `d3d12` (skipped from 0.7 to 0.19)

Improved Multithreading through internal use of Reference Counting

Large refactoring of wgpu’s internals aiming at reducing lock contention, and providing better performance when using wgpu on multiple threads.

[Check the blog post!](https://gfx-rs.github.io/2023/11/24/arcanization.html)

By gents83 in [3626](https://github.com/gfx-rs/wgpu/pull/3626) and thanks also to jimblandy, nical, Wumpf, Elabajaba & cwfitzgerald

All Public Dependencies are Re-Exported

All of wgpu's public dependencies are now re-exported at the top level so that users don't need to take their own dependencies.
This includes:
- wgpu-core
- wgpu-hal
- naga
- raw_window_handle
- web_sys

Feature Flag Changes

WebGPU & WebGL in the same Binary

Enabling `webgl` no longer removes the `webgpu` backend.

Instead, there's a new (default enabled) `webgpu` feature that allows to explicitly opt-out of `webgpu` if so desired.
If both `webgl` & `webgpu` are enabled, `wgpu::Instance` decides upon creation whether to target wgpu-core/WebGL or WebGPU.
This means that adapter selection is not handled as with regular adapters, but still allows to decide at runtime whether
`webgpu` or the `webgl` backend should be used using a single wasm binary.
By wumpf in [5044](https://github.com/gfx-rs/wgpu/pull/5044)

`naga-ir` Dedicated Feature

The `naga-ir` feature has been added to allow you to add naga module shaders without guessing about what other features needed to be enabled to get access to it.
By cwfitzgerald in [5063](https://github.com/gfx-rs/wgpu/pull/5063).

`expose-ids` Feature available unconditionally

This feature allowed you to call `global_id` on any wgpu opaque handle to get a unique hashable identity for the given resource. This is now available without the feature flag.
By cwfitzgerald in [4841](https://github.com/gfx-rs/wgpu/pull/4841).

`dx12` and `metal` Backend Crate Features

wgpu now exposes backend feature for the Direct3D 12 (`dx12`) and Metal (`metal`) backend. These are enabled by default, but don't do anything when not targeting the corresponding OS.
By daxpedda in [4815](https://github.com/gfx-rs/wgpu/pull/4815).

Direct3D 11 Backend Removal

This backend had no functionality, and with the recent support for GL on Desktop, which allows wgpu to run on older devices, there was no need to keep this backend.
By valaphee in [4828](https://github.com/gfx-rs/wgpu/pull/4828).

`WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER` Environment Variable

This adds a way to allow a Vulkan driver which is non-compliant per `VK_KHR_driver_properties` to be enumerated. This is intended for testing new Vulkan drivers which are not Vulkan compliant yet.
By i509VCB in [4754](https://github.com/gfx-rs/wgpu/pull/4754).

`DeviceExt::create_texture_with_data` allows Mip-Major Data

Previously, `DeviceExt::create_texture_with_data` only allowed data to be provided in layer major order. There is now a `order` parameter which allows you to specify if the data is in layer major or mip major order.
diff
let tex = ctx.device.create_texture_with_data(
&queue,
&descriptor,
+ wgpu::util::TextureDataOrder::LayerMajor,
src_data,
);


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

Safe & unified Surface Creation

It is now possible to safely create a `wgpu::Surface` with `wgpu::Instance::create_surface()` by letting `wgpu::Surface` hold a lifetime to `window`.
Passing an owned value `window` to `Surface` will return a `wgpu::Surface<'static>`.

All possible safe variants (owned windows and web canvases) are grouped using `wgpu::SurfaceTarget`.
Conversion to `wgpu::SurfaceTarget` is automatic for any type implementing `raw-window-handle`'s `HasWindowHandle` & `HasDisplayHandle` traits, i.e. most window types.
For web canvas types this has to be done explicitly:
rust
let surface: wgpu::Surface<'static> = instance.create_surface(wgpu::SurfaceTarget::Canvas(my_canvas))?;


All unsafe variants are now grouped under `wgpu::Instance::create_surface_unsafe` which takes the
`wgpu::SurfaceTargetUnsafe` enum and always returns `wgpu::Surface<'static>`.

In order to create a `wgpu::Surface<'static>` without passing ownership of the window use
`wgpu::SurfaceTargetUnsafe::from_window`:
rust
let surface = unsafe {
instance.create_surface_unsafe(wgpu::SurfaceTargetUnsafe::from_window(&my_window))?
};

The easiest way to make this code safe is to use shared ownership:
rust
let window: Arc<winit::Window>;
// ...
let surface = instance.create_surface(my_window.clone())?;


All platform specific surface creation using points have moved into `SurfaceTargetUnsafe` as well.
For example:

Safety by daxpedda in [4597](https://github.com/gfx-rs/wgpu/pull/4597)
Unification by wumpf in [4984](https://github.com/gfx-rs/wgpu/pull/4984)

Add partial Support for WGSL Abstract Types

Abstract types make numeric literals easier to use, by
automatically converting literals and other constant expressions
from abstract numeric types to concrete types when safe and
necessary. For example, to build a vector of floating-point
numbers, Naga previously made you write:
rust

0.18.2

This release includes `naga` version 0.14.2. The crates `wgpu-core`, `wgpu-hal` are still at `0.18.1` and the crates `wgpu` and `wgpu-types` are still at `0.18.0`.

Bug Fixes

Naga
- When evaluating const-expressions and generating SPIR-V, properly handle `Compose` expressions whose operands are `Splat` expressions. Such expressions are created and marked as constant by the constant evaluator. By jimblandy in [4695](https://github.com/gfx-rs/wgpu/pull/4695).

0.18.1

Page 2 of 13

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.