Wgpu

Latest version: v0.15.1

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

Scan your dependencies

Page 1 of 12

12.0

See https://github.com/gfx-rs/naga/blob/master/CHANGELOG.md#v011-2023-01-25 for smaller shader improvements.

Surface Capabilities API

The various surface capability functions were combined into a single call that gives you all the capabilities.

diff
- let formats = surface.get_supported_formats(&adapter);
- let present_modes = surface.get_supported_present_modes(&adapter);
- let alpha_modes = surface.get_supported_alpha_modes(&adapter);
+ let caps = surface.get_capabilities(&adapter);
+ let formats = caps.formats;
+ let present_modes = caps.present_modes;
+ let alpha_modes = caps.alpha_modes;


Additionally `Surface::get_default_config` now returns an Option and returns None if the surface isn't supported by the adapter.

diff
- let config = surface.get_default_config(&adapter);
+ let config = surface.get_default_config(&adapter).expect("Surface unsupported by adapter");


Fallible surface creation

`Instance::create_surface()` now returns `Result<Surface, CreateSurfaceError>` instead of `Surface`. This allows an error to be returned if the given window is a HTML canvas and obtaining a WebGPU or WebGL 2 context fails. (No other platforms currently report any errors through this path.) By kpreid in [3052](https://github.com/gfx-rs/wgpu/pull/3052/)

`Queue::copy_external_image_to_texture` on WebAssembly

A new api, `Queue::copy_external_image_to_texture`, allows you to create wgpu textures from various web image primitives. Specificically from `HtmlVideoElement`, `HtmlCanvasElement`, `OffscreenCanvas`, and `ImageBitmap`. This provides multiple low-copy ways of interacting with the browser. WebGL is also supported, though WebGL has some additional restrictions, represented by the `UNRESTRICTED_EXTERNAL_IMAGE_COPIES` downlevel flag. By cwfitzgerald in [3288](https://github.com/gfx-rs/wgpu/pull/3288)

Instance creation now takes `InstanceDescriptor` instead of `Backends`

`Instance::new()` and `hub::Global::new()` now take an `InstanceDescriptor` struct which cointains both the existing `Backends` selection as well as a new `Dx12Compiler` field for selecting which Dx12 shader compiler to use.

diff
- let instance = Instance::new(wgpu::Backends::all());
+ let instance = Instance::new(wgpu::InstanceDescriptor {
+ backends: wgpu::Backends::all(),
+ dx12_shader_compiler: wgpu::Dx12Compiler::Fxc,
+ });


`Instance` now also also implements `Default`, which uses `wgpu::Backends::all()` and `wgpu::Dx12Compiler::Fxc` for `InstanceDescriptor`

diff
- let instance = Instance::new(wgpu::InstanceDescriptor {
- backends: wgpu::Backends::all(),
- dx12_shader_compiler: wgpu::Dx12Compiler::Fxc,
- });
+ let instance = Instance::default();


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

Texture Format Reinterpretation

The new `view_formats` field in the `TextureDescriptor` is used to specify a list of formats the texture can be re-interpreted to in a texture view. Currently only changing srgb-ness is allowed (ex. `Rgba8Unorm` <=> `Rgba8UnormSrgb`).

diff
let texture = device.create_texture(&wgpu::TextureDescriptor {
// ...
format: TextureFormat::Rgba8UnormSrgb,
+ view_formats: &[TextureFormat::Rgba8Unorm],
});


diff
let config = wgpu::SurfaceConfiguration {
// ...
format: TextureFormat::Rgba8Unorm,
+ view_formats: vec![wgpu::TextureFormat::Rgba8UnormSrgb],
};
surface.configure(&device, &config);


MSAA x2 and x8 Support

Via the `TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` feature, MSAA x2 and x8 are now supported on textures. To query for x2 or x8 support, enable the feature and look at the texture format flags for the texture format of your choice.

By 39ali in [3140](https://github.com/gfx-rs/wgpu/pull/3140)

DXC Shader Compiler Support for DX12

You can now choose to use the DXC compiler for DX12 instead of FXC. The DXC compiler is faster, less buggy, and allows for new features compared to the old, unmaintained FXC compiler.

You can choose which compiler to use at `Instance` creation using the `dx12_shader_compiler` field in the `InstanceDescriptor` struct. Note that DXC requires both `dxcompiler.dll` and `dxil.dll`, which can be downloaded from https://github.com/microsoft/DirectXShaderCompiler/releases. Both .dlls need to be shipped with your application when targeting DX12 and using the `DXC` compiler. If the .dlls can't be loaded, then it will fall back to the FXC compiler. By 39ali and Elabajaba in [#3356](https://github.com/gfx-rs/wgpu/pull/3356)

Suballocate DX12 buffers and textures

The DX12 backend can now suballocate buffers and textures from larger chunks of memory, which can give a significant increase in performance (in testing a 100x improvement has been seen in a simple scene with 200 `write_buffer` calls per frame, and a 1.4x improvement in [Bistro using Bevy](https://github.com/vleue/bevy_bistro_playground)).

Previously `wgpu-hal`'s DX12 backend created a new heap on the GPU every time you called `write_buffer` (by calling `CreateCommittedResource`), whereas now it uses [`gpu_allocator`](https://crates.io/crates/gpu-allocator) to manage GPU memory (and calls `CreatePlacedResource` with a suballocated heap). By Elabajaba in [#3163](https://github.com/gfx-rs/wgpu/pull/3163)

Backend selection by features in wgpu-core

Whereas `wgpu-core` used to automatically select backends to enable
based on the target OS and architecture, it now has separate features
to enable each backend:

- "metal", for the Metal API on macOS and iOS
- "vulkan", for the Vulkan API (Linux, some Android, and occasionally Windows)
- "dx12", for Microsoft's Direct3D 12 API
- "gles", OpenGL ES, available on many systems
- "dx11", for Microsoft's Direct3D 11 API

None are enabled by default, but the `wgpu` crate automatically
selects these features based on the target operating system and
architecture, using the same rules that `wgpu-core` used to, so users
of `wgpu` should be unaffected by this change. However, other crates
using `wgpu-core` directly will need to copy `wgpu`'s logic or write
their own. See the `[target]` section of `wgpu/Cargo.toml` for
details.

Similarly, `wgpu-core` now has `emscripten` and `renderdoc` features
that `wgpu` enables on appropriate platforms.

In previous releases, the `wgpu-core` crate decided which backends to
support. However, this left `wgpu-core`'s users with no way to
override those choices. (Firefox doesn't want the GLES back end, for
example.) There doesn't seem to be any way to have a crate select
backends based on target OS and architecture that users of that crate
can still override. Default features can't be selected based on the
target, for example. That implies that we should do the selection as
late in the dependency DAG as feasible. Having `wgpu` (and
`wgpu-core`'s other dependents) choose backends seems like the best
option.

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

Changes

General

- Convert all `Default` Implementations on Enums to `derive(Default)`
- Implement `Default` for `CompositeAlphaMode`
- New downlevel feature `UNRESTRICTED_INDEX_BUFFER` to indicate support for using `INDEX` together with other non-copy/map usages (unsupported on WebGL). By Wumpf in [3157](https://github.com/gfx-rs/wgpu/pull/3157)
- Add missing `DEPTH_BIAS_CLAMP` and `FULL_DRAW_INDEX_UINT32` downlevel flags. By teoxoy in [3316](https://github.com/gfx-rs/wgpu/pull/3316)
- Combine `Surface::get_supported_formats`, `Surface::get_supported_present_modes`, and `Surface::get_supported_alpha_modes` into `Surface::get_capabilities` and `SurfaceCapabilities`. By cwfitzgerald in [3157](https://github.com/gfx-rs/wgpu/pull/3157)
- Make `Surface::get_default_config` return an Option to prevent panics. By cwfitzgerald in [3157](https://github.com/gfx-rs/wgpu/pull/3157)
- Lower the `max_buffer_size` limit value for compatibility with Apple2 and WebGPU compliance. By jinleili in [3255](https://github.com/gfx-rs/wgpu/pull/3255)
- Limits `min_uniform_buffer_offset_alignment` and `min_storage_buffer_offset_alignment` is now always at least 32. By wumpf [3262](https://github.com/gfx-rs/wgpu/pull/3262)
- Dereferencing a buffer view is now marked inline. By Wumpf in [3307](https://github.com/gfx-rs/wgpu/pull/3307)
- The `strict_assert` family of macros was moved to `wgpu-types`. By i509VCB in [3051](https://github.com/gfx-rs/wgpu/pull/3051)
- Make `ObjectId` structure and invariants idiomatic. By teoxoy in [3347](https://github.com/gfx-rs/wgpu/pull/3347)
- Add validation in accordance with WebGPU `GPUSamplerDescriptor` valid usage for `lodMinClamp` and `lodMaxClamp`. By James2022-rgb in [3353](https://github.com/gfx-rs/wgpu/pull/3353)
- Remove panics in `Deref` implementations for `QueueWriteBufferView` and `BufferViewMut`. Instead, warnings are logged, since reading from these types is not recommended. By botahamec in [3336]
- Implement `view_formats` in the TextureDescriptor to match the WebGPU spec. By jinleili in [3237](https://github.com/gfx-rs/wgpu/pull/3237)
- Show more information in error message for non-aligned buffer bindings in WebGL [3414](https://github.com/gfx-rs/wgpu/pull/3414)
- Update `TextureView` validation according to the WebGPU spec. By teoxoy in [3410](https://github.com/gfx-rs/wgpu/pull/3410)
- Implement `view_formats` in the SurfaceConfiguration to match the WebGPU spec. By jinleili in [3409](https://github.com/gfx-rs/wgpu/pull/3409)

Vulkan

- Set `WEBGPU_TEXTURE_FORMAT_SUPPORT` downlevel flag depending on the proper format support by teoxoy in [3367](https://github.com/gfx-rs/wgpu/pull/3367).
- Set `COPY_SRC`/`COPY_DST` only based on Vulkan's `TRANSFER_SRC`/`TRANSFER_DST` by teoxoy in [3366](https://github.com/gfx-rs/wgpu/pull/3366).

GLES

- Browsers that support `OVR_multiview2` now report the `MULTIVIEW` feature by expenses in [3121](https://github.com/gfx-rs/wgpu/pull/3121).
- `Limits::max_push_constant_size` on GLES is now 256 by Dinnerbone in [3374](https://github.com/gfx-rs/wgpu/pull/3374).
- Creating multiple pipelines with the same shaders will now be faster, by Dinnerbone in [3380](https://github.com/gfx-rs/wgpu/pull/3380).

WebGPU

- Implement `queue_validate_write_buffer` by jinleili in [3098](https://github.com/gfx-rs/wgpu/pull/3098)
- Sync depth/stencil copy restrictions with the spec by teoxoy in [3314](https://github.com/gfx-rs/wgpu/pull/3314)


Added/New Features

General

- Implement `Hash` for `DepthStencilState` and `DepthBiasState`
- Add the `"wgsl"` feature, to enable WGSL shaders in `wgpu-core` and `wgpu`. Enabled by default in `wgpu`. By daxpedda in [2890](https://github.com/gfx-rs/wgpu/pull/2890).
- Implement `Clone` for `ShaderSource` and `ShaderModuleDescriptor` in `wgpu`. By daxpedda in [3086](https://github.com/gfx-rs/wgpu/pull/3086).
- Add `get_default_config` for `Surface` to simplify user creation of `SurfaceConfiguration`. By jinleili in [3034](https://github.com/gfx-rs/wgpu/pull/3034)
- Improve compute shader validation error message. By haraldreingruber in [3139](https://github.com/gfx-rs/wgpu/pull/3139)
- Native adapters can now use MSAA x2 and x8 if it's supported , previously only x1 and x4 were supported . By 39ali in [3140](https://github.com/gfx-rs/wgpu/pull/3140)
- Implemented correleation between user timestamps and platform specific presentation timestamps via [`Adapter::get_presentation_timestamp`]. By cwfitzgerald in [3240](https://github.com/gfx-rs/wgpu/pull/3240)
- Added support for `Features::SHADER_PRIMITIVE_INDEX` on all backends. By cwfitzgerald in [3272](https://github.com/gfx-rs/wgpu/pull/3272)
- Implemented `TextureFormat::Stencil8`, allowing for stencil testing without depth components. By Dinnerbone in [3343](https://github.com/gfx-rs/wgpu/pull/3343)
- Implemented `add_srgb_suffix()` for `TextureFormat` for converting linear formats to sRGB. By Elabajaba in [3419](https://github.com/gfx-rs/wgpu/pull/3419)
- Zero-initialize workgroup memory. By teoxoy in [3174](https://github.com/gfx-rs/wgpu/pull/3174)

GLES

- Surfaces support now `TextureFormat::Rgba8Unorm` and (non-web only) `TextureFormat::Bgra8Unorm`. By Wumpf in [3070](https://github.com/gfx-rs/wgpu/pull/3070)
- Support alpha to coverage. By Wumpf in [3156](https://github.com/gfx-rs/wgpu/pull/3156)
- Support filtering f32 textures. By expenses in [3261](https://github.com/gfx-rs/wgpu/pull/3261)

WebGPU

- Add `MULTISAMPLE_X2`, `MULTISAMPLE_X4` and `MULTISAMPLE_X8` to `TextureFormatFeatureFlags`. By 39ali in [3140](https://github.com/gfx-rs/wgpu/pull/3140)
- Sync `TextureFormat.describe` with the spec. By teoxoy in [3312](https://github.com/gfx-rs/wgpu/pull/3312)

Bug Fixes

General

- Update ndk-sys to v0.4.1+23.1.7779620, to fix checksum failures. By jimblandy in [3232](https://github.com/gfx-rs/wgpu/pull/3232).
- Bother to free the `hal::Api::CommandBuffer` when a `wgpu_core::command::CommandEncoder` is dropped. By jimblandy in [3069](https://github.com/gfx-rs/wgpu/pull/3069).
- Fixed the mipmap example by adding the missing WRITE_TIMESTAMP_INSIDE_PASSES feature. By Olaroll in [3081](https://github.com/gfx-rs/wgpu/pull/3081).
- Avoid panicking in some interactions with invalid resources by nical in (3094)[https://github.com/gfx-rs/wgpu/pull/3094]
- Fixed an integer overflow in `copy_texture_to_texture` by nical [3090](https://github.com/gfx-rs/wgpu/pull/3090)
- Remove `wgpu_types::Features::DEPTH24PLUS_STENCIL8`, making `wgpu::TextureFormat::Depth24PlusStencil8` available on all backends. By Healthire in (3151)[https://github.com/gfx-rs/wgpu/pull/3151]
- Fix an integer overflow in `queue_write_texture` by nical in (3146)[https://github.com/gfx-rs/wgpu/pull/3146]
- Make `RenderPassCompatibilityError` and `CreateShaderModuleError` not so huge. By jimblandy in (3226)[https://github.com/gfx-rs/wgpu/pull/3226]
- Check for invalid bitflag bits in wgpu-core and allow them to be captured/replayed by nical in (3229)[https://github.com/gfx-rs/wgpu/pull/3229]
- Evaluate `gfx_select!`'s `[cfg]` conditions at the right time. By jimblandy in [3253](https://github.com/gfx-rs/wgpu/pull/3253)
- Improve error messages when binding bind group with dynamic offsets. By cwfitzgerald in [3294](https://github.com/gfx-rs/wgpu/pull/3294)
- Allow non-filtering sampling of integer textures. By JMS55 in [3362](https://github.com/gfx-rs/wgpu/pull/3362).
- Validate texture ids in `Global::queue_texture_write`. By jimblandy in [3378](https://github.com/gfx-rs/wgpu/pull/3378).
- Don't panic on mapped buffer in queue_submit. By crowlKats in [3364](https://github.com/gfx-rs/wgpu/pull/3364).
- Fix being able to sample a depth texture with a filtering sampler. By teoxoy in [3394](https://github.com/gfx-rs/wgpu/pull/3394).
- Make `make_spirv_raw` and `make_spirv` handle big-endian binaries. By 1e1001 in [3411](https://github.com/gfx-rs/wgpu/pull/3411).

Vulkan
- Update ash to 0.37.1+1.3.235 to fix CI breaking by changing a call to the deprecated `debug_utils_set_object_name()` function to `set_debug_utils_object_name()` by elabajaba in [3273](https://github.com/gfx-rs/wgpu/pull/3273)
- Document and improve extension detection. By teoxoy in [3327](https://github.com/gfx-rs/wgpu/pull/3327)
- Don't use a pointer to a local copy of a `PhysicalDeviceDriverProperties` struct after it has gone out of scope. In fact, don't make a local copy at all. Introduce a helper function for building `CStr`s from C character arrays, and remove some `unsafe` blocks. By jimblandy in [3076](https://github.com/gfx-rs/wgpu/pull/3076).

DX12

- Fix `depth16Unorm` formats by teoxoy in [3313](https://github.com/gfx-rs/wgpu/pull/3313)
- Don't re-use `GraphicsCommandList` when `close` or `reset` fails. By xiaopengli89 in [3204](https://github.com/gfx-rs/wgpu/pull/3204)

Metal
- Fix texture view creation with full-resource views when using an explicit `mip_level_count` or `array_layer_count`. By cwfitzgerald in [3323](https://github.com/gfx-rs/wgpu/pull/3323)

GLES

- Fixed WebGL not displaying srgb targets correctly if a non-screen filling viewport was previously set. By Wumpf in [3093](https://github.com/gfx-rs/wgpu/pull/3093)
- Fix disallowing multisampling for float textures if otherwise supported. By Wumpf in [3183](https://github.com/gfx-rs/wgpu/pull/3183)
- Fix a panic when creating a pipeline with opaque types other than samplers (images and atomic counters). By James2022-rgb in [3361](https://github.com/gfx-rs/wgpu/pull/3361)
- Fix uniform buffers being empty on some vendors. By Dinnerbone in [3391](https://github.com/gfx-rs/wgpu/pull/3391)
- Fix a panic allocating a new buffer on webgl. By Dinnerbone in [3396](https://github.com/gfx-rs/wgpu/pull/3396)

WebGPU

- Use `log` instead of `println` in hello example by JolifantoBambla in [2858](https://github.com/gfx-rs/wgpu/pull/2858)

deno-webgpu

- Let `setVertexBuffer` and `setIndexBuffer` calls on
`GPURenderBundleEncoder` throw an error if the `size` argument is
zero, rather than treating that as "until the end of the buffer".
By jimblandy in [3171](https://github.com/gfx-rs/wgpu/pull/3171)

Emscripten

- Let the wgpu examples `framework.rs` compile again under Emscripten. By jimblandy in [3246](https://github.com/gfx-rs/wgpu/pull/3246)

Examples

- Log adapter info in hello example on wasm target by JolifantoBambla in [2858](https://github.com/gfx-rs/wgpu/pull/2858)
- Added new example `stencil-triangles` to show basic use of stencil testing. By Dinnerbone in [3343](https://github.com/gfx-rs/wgpu/pull/3343)

Testing/Internal

- Update the `minimum supported rust version` to 1.64
- Move `ResourceMetadata` into its own module. By jimblandy in [3213](https://github.com/gfx-rs/wgpu/pull/3213)
- Add WebAssembly testing infrastructure. By haraldreingruber in [3238](https://github.com/gfx-rs/wgpu/pull/3238)
- Error message when you forget to use cargo-nextest. By cwfitzgerald in [3293](https://github.com/gfx-rs/wgpu/pull/3293)

3.0

With this change, you can now simply write:
rust
vec3<f32>(1, 2, 3)

Even though the literals are abstract integers, Naga recognizes
that it is safe and necessary to convert them to `f32` values in
order to build the vector. You can also use abstract values as
initializers for global constants and global and local variables,
like this:
rust
var unit_x: vec2<f32> = vec2(1, 0);

The literals `1` and `0` are abstract integers, and the expression
`vec2(1, 0)` is an abstract vector. However, Naga recognizes that
it can convert that to the concrete type `vec2<f32>` to satisfy
the given type of `unit_x`.
The WGSL specification permits abstract integers and
floating-point values in almost all contexts, but Naga's support
for this is still incomplete. Many WGSL operators and builtin
functions are specified to produce abstract results when applied
to abstract inputs, but for now Naga simply concretizes them all
before applying the operation. We will expand Naga's abstract type
support in subsequent pull requests.
As part of this work, the public types `naga::ScalarKind` and
`naga::Literal` now have new variants, `AbstractInt` and `AbstractFloat`.

By jimblandy in [4743](https://github.com/gfx-rs/wgpu/pull/4743), [#4755](https://github.com/gfx-rs/wgpu/pull/4755).

`Instance::enumerate_adapters` now returns `Vec<Adapter>` instead of an `ExactSizeIterator`

This allows us to support WebGPU and WebGL in the same binary.

diff
- let adapters: Vec<Adapter> = instance.enumerate_adapters(wgpu::Backends::all()).collect();
+ let adapters: Vec<Adapter> = instance.enumerate_adapters(wgpu::Backends::all());


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

`device.poll()` now returns a `MaintainResult` instead of a `bool`

This is a forward looking change, as we plan to add more information to the `MaintainResult` in the future.
This enum has the same data as the boolean, but with some useful helper functions.

diff
- let queue_finished: bool = device.poll(wgpu::Maintain::Wait);
+ let queue_finished: bool = device.poll(wgpu::Maintain::Wait).is_queue_empty();


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

New Features

General
- Added `DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW` to know if `builtin(vertex_index)` and `builtin(instance_index)` will respect the `first_vertex` / `first_instance` in indirect calls. If this is not present, both will always start counting from 0. Currently enabled on all backends except DX12. By cwfitzgerald in [4722](https://github.com/gfx-rs/wgpu/pull/4722).
- Added support for the `FLOAT32_FILTERABLE` feature (web and native, corresponds to WebGPU's `float32-filterable`). By almarklein in [4759](https://github.com/gfx-rs/wgpu/pull/4759).
- GPU buffer memory is released during "lose the device". By bradwerth in [4851](https://github.com/gfx-rs/wgpu/pull/4851).
- wgpu and wgpu-core cargo feature flags are now documented on docs.rs. By wumpf in [4886](https://github.com/gfx-rs/wgpu/pull/4886).
- DeviceLostClosure is guaranteed to be invoked exactly once. By bradwerth in [4862](https://github.com/gfx-rs/wgpu/pull/4862).
- Log vulkan validation layer messages during instance creation and destruction: By exrook in [4586](https://github.com/gfx-rs/wgpu/pull/4586).
- `TextureFormat::block_size` is deprecated, use `TextureFormat::block_copy_size` instead: By wumpf in [4647](https://github.com/gfx-rs/wgpu/pull/4647).
- Rename of `DispatchIndirect`, `DrawIndexedIndirect`, and `DrawIndirect` types in the `wgpu::util` module to `DispatchIndirectArgs`, `DrawIndexedIndirectArgs`, and `DrawIndirectArgs`. By cwfitzgerald in [4723](https://github.com/gfx-rs/wgpu/pull/4723).
- Make the size parameter of `encoder.clear_buffer` an `Option<u64>` instead of `Option<NonZero<u64>>`. By nical in [4737](https://github.com/gfx-rs/wgpu/pull/4737).
- Reduce the `info` log level noise. By nical in [4769](https://github.com/gfx-rs/wgpu/pull/4769), [#4711](https://github.com/gfx-rs/wgpu/pull/4711) and [#4772](https://github.com/gfx-rs/wgpu/pull/4772)
- Rename `features` & `limits` fields of `DeviceDescriptor` to `required_features` & `required_limits`. By teoxoy in [4803](https://github.com/gfx-rs/wgpu/pull/4803).
- `SurfaceConfiguration` now exposes `desired_maximum_frame_latency` which was previously hard-coded to 2. By setting it to 1 you can reduce latency under the risk of making GPU & CPU work sequential. Currently, on DX12 this affects the `MaximumFrameLatency`, on all other backends except OpenGL the size of the swapchain (on OpenGL this has no effect). By emilk & wumpf in [4899](https://github.com/gfx-rs/wgpu/pull/4899)

OpenGL
- `builtin(instance_index)` now properly reflects the range provided in the draw call instead of always counting from 0. By cwfitzgerald in [4722](https://github.com/gfx-rs/wgpu/pull/4722).
- Desktop GL now supports `POLYGON_MODE_LINE` and `POLYGON_MODE_POINT`. By valaphee in [4836](https://github.com/gfx-rs/wgpu/pull/4836).

Naga

- Naga's WGSL front end now allows operators to produce values with abstract types, rather than concretizing thir operands. By jimblandy in [4850](https://github.com/gfx-rs/wgpu/pull/4850) and [#4870](https://github.com/gfx-rs/wgpu/pull/4870).
- Naga's WGSL front and back ends now have experimental support for 64-bit floating-point literals: `1.0lf` denotes an `f64` value. There has been experimental support for an `f64` type for a while, but until now there was no syntax for writing literals with that type. As before, Naga module validation rejects `f64` values unless `naga::valid::Capabilities::FLOAT64` is requested. By jimblandy in [4747](https://github.com/gfx-rs/wgpu/pull/4747).
- Naga constant evaluation can now process binary operators whose operands are both vectors. By jimblandy in [4861](https://github.com/gfx-rs/wgpu/pull/4861).
- Add `--bulk-validate` option to Naga CLI. By jimblandy in [4871](https://github.com/gfx-rs/wgpu/pull/4871).
- Naga's `cargo xtask validate` now runs validation jobs in parallel, using the [jobserver](https://crates.io/crates/jobserver) protocol to limit concurrency, and offers a `validate all` subcommand, which runs all available validation types. By jimblandy in [#4902](https://github.com/gfx-rs/wgpu/pull/4902).
- Remove `span` and `validate` features. Always fully validate shader modules, and always track source positions for use in error messages. By teoxoy in [4706](https://github.com/gfx-rs/wgpu/pull/4706).
- Introduce a new `Scalar` struct type for use in Naga's IR, and update all frontend, middle, and backend code appropriately. By jimblandy in [4673](https://github.com/gfx-rs/wgpu/pull/4673).
- Add more metal keywords. By fornwall in [4707](https://github.com/gfx-rs/wgpu/pull/4707).
- Add a new `naga::Literal` variant, `I64`, for signed 64-bit literals. [4711](https://github.com/gfx-rs/wgpu/pull/4711).
- Emit and init `struct` member padding always. By ErichDonGubler in [4701](https://github.com/gfx-rs/wgpu/pull/4701).
- In WGSL output, always include the `i` suffix on `i32` literals. By jimblandy in [4863](https://github.com/gfx-rs/wgpu/pull/4863).
- In WGSL output, always include the `f` suffix on `f32` literals. By jimblandy in [4869](https://github.com/gfx-rs/wgpu/pull/4869).

Bug Fixes

General

- `BufferMappedRange` trait is now `WasmNotSendSync`, i.e. it is `Send`/`Sync` if not on wasm or `fragile-send-sync-non-atomic-wasm` is enabled. By wumpf in [4818](https://github.com/gfx-rs/wgpu/pull/4818).
- Align `wgpu_types::CompositeAlphaMode` serde serialization to spec. By littledivy in [4940](https://github.com/gfx-rs/wgpu/pull/4940).
- Fix error message of `ConfigureSurfaceError::TooLarge`. By Dinnerbone in [4960](https://github.com/gfx-rs/wgpu/pull/4960).
- Fix dropping of `DeviceLostCallbackC` params. By bradwerth in [5032](https://github.com/gfx-rs/wgpu/pull/5032).
- Fixed a number of panics. By nical in [4999](https://github.com/gfx-rs/wgpu/pull/4999), [#5014](https://github.com/gfx-rs/wgpu/pull/5014), [#5024](https://github.com/gfx-rs/wgpu/pull/5024), [#5025](https://github.com/gfx-rs/wgpu/pull/5025), [#5026](https://github.com/gfx-rs/wgpu/pull/5026), [#5027](https://github.com/gfx-rs/wgpu/pull/5027), [#5028](https://github.com/gfx-rs/wgpu/pull/5028) and [#5042](https://github.com/gfx-rs/wgpu/pull/5042).
- No longer validate surfaces against their allowed extent range on configure. This caused warnings that were almost impossible to avoid. As before, the resulting behavior depends on the compositor. By wumpf in [4796](https://github.com/gfx-rs/wgpu/pull/4796).

DX12

- Fixed D3D12_SUBRESOURCE_FOOTPRINT calculation for block compressed textures which caused a crash with `Queue::write_texture` on DX12. By DTZxPorter in [4990](https://github.com/gfx-rs/wgpu/pull/4990).

Vulkan

- Use `VK_EXT_robustness2` only when not using an outdated intel iGPU driver. By TheoDulka in [4602](https://github.com/gfx-rs/wgpu/pull/4602).

WebGPU

- Allow calling `BufferSlice::get_mapped_range` multiple times on the same buffer slice (instead of throwing a Javascript exception). By DouglasDwyer in [4726](https://github.com/gfx-rs/wgpu/pull/4726).

WGL

- Create a hidden window per `wgpu::Instance` instead of sharing a global one. By Zoxc in [4603](https://github.com/gfx-rs/wgpu/issues/4603)

Naga

- Make module compaction preserve the module's named types, even if they are unused. By jimblandy in [4734](https://github.com/gfx-rs/wgpu/pull/4734).
- Improve algorithm used by module compaction. By jimblandy in [4662](https://github.com/gfx-rs/wgpu/pull/4662).
- When reading GLSL, fix the argument types of the double-precision floating-point overloads of the `dot`, `reflect`, `distance`, and `ldexp` builtin functions. Correct the WGSL generated for constructing 64-bit floating-point matrices. Add tests for all the above. By jimblandy in [4684](https://github.com/gfx-rs/wgpu/pull/4684).
- Allow Naga's IR types to represent matrices with elements elements of any scalar kind. This makes it possible for Naga IR types to represent WGSL abstract matrices. By jimblandy in [4735](https://github.com/gfx-rs/wgpu/pull/4735).
- Preserve the source spans for constants and expressions correctly across module compaction. By jimblandy in [4696](https://github.com/gfx-rs/wgpu/pull/4696).
- Record the names of WGSL `alias` declarations in Naga IR `Type`s. By jimblandy in [4733](https://github.com/gfx-rs/wgpu/pull/4733).

Metal

- Allow the `COPY_SRC` usage flag in surface configuration. By Toqozz in [4852](https://github.com/gfx-rs/wgpu/pull/4852).

Examples

- remove winit dependency from hello-compute example. By psvri in [4699](https://github.com/gfx-rs/wgpu/pull/4699)
- hello-compute example fix failure with `wgpu error: Validation Error` if arguments are missing. By vilcans in [4939](https://github.com/gfx-rs/wgpu/pull/4939).
- Made the examples page not crash on Chrome on Android, and responsive to screen sizes. By Dinnerbone in [4958](https://github.com/gfx-rs/wgpu/pull/4958).

1.0

let result = frexp(1.5);

0.75

result.exponent == 2i;

// `modf`/`frexp` are currently disabled on GLSL and SPIR-V input.


Shader Validation Improvements

rust
// Cannot get pointer to a workgroup variable
fn func(p: ptr<workgroup, u32>); // ERROR

// Cannot create Inf/NaN through constant expressions
const INF: f32 = 3.40282347e+38 + 1.0; // ERROR
const NAN: f32 = 0.0 / 0.0; // ERROR

// `outerProduct` function removed

// Error on repeated or missing `workgroup_size()`
workgroup_size(1) workgroup_size(2) // ERROR
fn compute_main() {}

// Error on repeated attributes.
fn fragment_main(location(0) location(0) location_0: f32) // ERROR


RenderPass `StoreOp` is now Enumeration

`wgpu::Operations::store` used to be an underdocumented boolean value,
causing misunderstandings of the effect of setting it to `false`.

The API now more closely resembles WebGPU which distinguishes between `store` and `discard`,
see [WebGPU spec on GPUStoreOp](https://gpuweb.github.io/gpuweb/#enumdef-gpustoreop).

diff
// ...
depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0),
- store: false,
+ store: wgpu::StoreOp::Discard,
}),
// ...


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

Instance Descriptor Settings

The instance descriptor grew two more fields: `flags` and `gles_minor_version`.

`flags` allow you to toggle the underlying api validation layers, debug information about shaders and objects in capture programs, and the ability to discard lables

`gles_minor_version` is a rather niche feature that allows you to force the GLES backend to use a specific minor version, this is useful to get ANGLE to enable more than GLES 3.0.

diff
let instance = wgpu::Instance::new(InstanceDescriptor {
...
+ flags: wgpu::InstanceFlags::default()
+ gles_minor_version: wgpu::Gles3MinorVersion::Automatic,
});


`gles_minor_version`: By PJB3005 in [3998](https://github.com/gfx-rs/wgpu/pull/3998)
`flags`: By nical in [4230](https://github.com/gfx-rs/wgpu/pull/4230)

Many New Examples!

- Added the following examples: By JustAnotherCodemonkey in [3885](https://github.com/gfx-rs/wgpu/pull/3885).
- [repeated-compute](https://github.com/gfx-rs/wgpu/tree/trunk/examples/repeated-compute)
- [storage-texture](https://github.com/gfx-rs/wgpu/tree/trunk/examples/storage-texture)
- [render-to-texture](https://github.com/gfx-rs/wgpu/tree/trunk/examples/render-to-texture)
- [uniform-values](https://github.com/gfx-rs/wgpu/tree/trunk/examples/uniform-values)
- [hello-workgroups](https://github.com/gfx-rs/wgpu/tree/trunk/examples/hello-workgroups)
- [hello-synchronization](https://github.com/gfx-rs/wgpu/tree/trunk/examples/hello-synchronization)

Revamped Testing Suite

Our testing harness was completely revamped and now automatically runs against all gpus in the system, shows the expected status of every test, and is tolerant to flakes.

Additionally, we have filled out our CI to now run the latest versions of WARP and Mesa. This means we can test even more features on CI than before.

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

The GLES backend is now optional on macOS

The `angle` feature flag has to be set for the GLES backend to be enabled on Windows & macOS.

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

Added/New Features

- Re-export Naga. By exrook in [4172](https://github.com/gfx-rs/wgpu/pull/4172)
- Add WinUI 3 SwapChainPanel support. By ddrboxman in [4191](https://github.com/gfx-rs/wgpu/pull/4191)

Changes

General

- Omit texture store bound checks since they are no-ops if out of bounds on all APIs. By teoxoy in [3975](https://github.com/gfx-rs/wgpu/pull/3975)
- Validate `DownlevelFlags::READ_ONLY_DEPTH_STENCIL`. By teoxoy in [4031](https://github.com/gfx-rs/wgpu/pull/4031)
- Add validation in accordance with WebGPU `setViewport` valid usage for `x`, `y` and `this.[[attachment_size]]`. By James2022-rgb in [4058](https://github.com/gfx-rs/wgpu/pull/4058)
- `wgpu::CreateSurfaceError` and `wgpu::RequestDeviceError` now give details of the failure, but no longer implement `PartialEq` and cannot be constructed. By kpreid in [4066](https://github.com/gfx-rs/wgpu/pull/4066) and [#4145](https://github.com/gfx-rs/wgpu/pull/4145)
- Make `WGPU_POWER_PREF=none` a valid value. By fornwall in [4076](https://github.com/gfx-rs/wgpu/pull/4076)
- Support dual source blending in OpenGL ES, Metal, Vulkan & DX12. By freqmod in [4022](https://github.com/gfx-rs/wgpu/pull/4022)
- Add stub support for device destroy and device validity. By bradwerth in [4163](https://github.com/gfx-rs/wgpu/pull/4163) and in [4212](https://github.com/gfx-rs/wgpu/pull/4212)
- Add trace-level logging for most entry points in wgpu-core By nical in [4183](https://github.com/gfx-rs/wgpu/pull/4183)
- Add `Rgb10a2Uint` format. By teoxoy in [4199](https://github.com/gfx-rs/wgpu/pull/4199)
- Validate that resources are used on the right device. By nical in [4207](https://github.com/gfx-rs/wgpu/pull/4207)
- Expose instance flags.
- Add support for the bgra8unorm-storage feature. By jinleili and nical in [4228](https://github.com/gfx-rs/wgpu/pull/4228)
- Calls to lost devices now return `DeviceError::Lost` instead of `DeviceError::Invalid`. By bradwerth in [4238]([https://github.com/gfx-rs/wgpu/pull/4238])
- Let the `"strict_asserts"` feature enable check that wgpu-core's lock-ordering tokens are unique per thread. By jimblandy in [4258]([https://github.com/gfx-rs/wgpu/pull/4258])
- Allow filtering labels out before they are passed to GPU drivers by nical in [https://github.com/gfx-rs/wgpu/pull/4246](4246)

Vulkan

- Rename `wgpu_hal::vulkan::Instance::required_extensions` to `desired_extensions`. By jimblandy in [4115](https://github.com/gfx-rs/wgpu/pull/4115)
- Don't bother calling `vkFreeCommandBuffers` when `vkDestroyCommandPool` will take care of that for us. By jimblandy in [4059](https://github.com/gfx-rs/wgpu/pull/4059)

DX12

- Bump `gpu-allocator` to 0.23. By Elabajaba in [4198](https://github.com/gfx-rs/wgpu/pull/4198)

Documentation

- Use WGSL for VertexFormat example types. By ScanMountGoat in [4035](https://github.com/gfx-rs/wgpu/pull/4035)
- Fix description of `Features::TEXTURE_COMPRESSION_ASTC_HDR` in [4157](https://github.com/gfx-rs/wgpu/pull/4157)

Bug Fixes

General

- Derive storage bindings via `naga::StorageAccess` instead of `naga::GlobalUse`. By teoxoy in [3985](https://github.com/gfx-rs/wgpu/pull/3985).
- `Queue::on_submitted_work_done` callbacks will now always be called after all previous `BufferSlice::map_async` callbacks, even when there are no active submissions. By cwfitzgerald in [4036](https://github.com/gfx-rs/wgpu/pull/4036).
- Fix `clear` texture views being leaked when `wgpu::SurfaceTexture` is dropped before it is presented. By rajveermalviya in [4057](https://github.com/gfx-rs/wgpu/pull/4057).
- Add `Feature::SHADER_UNUSED_VERTEX_OUTPUT` to allow unused vertex shader outputs. By Aaron1011 in [4116](https://github.com/gfx-rs/wgpu/pull/4116).
- Fix a panic in `surface_configure`. By nical in [4220](https://github.com/gfx-rs/wgpu/pull/4220) and [#4227](https://github.com/gfx-rs/wgpu/pull/4227)

Vulkan

- Fix enabling `wgpu::Features::PARTIALLY_BOUND_BINDING_ARRAY` not being actually enabled in vulkan backend. By 39ali in[3772](https://github.com/gfx-rs/wgpu/pull/3772).
- Don't pass `vk::InstanceCreateFlags::ENUMERATE_PORTABILITY_KHR` unless the `VK_KHR_portability_enumeration` extension is available. By jimblandy in[4038](https://github.com/gfx-rs/wgpu/pull/4038).
- Enhancement of [4038], using ash's definition instead of hard-coded c_str. By hybcloud in[4044](https://github.com/gfx-rs/wgpu/pull/4044).
- Enable vulkan presentation on (Linux) Intel Mesa >= v21.2. By flukejones in[4110](https://github.com/gfx-rs/wgpu/pull/4110)

DX12

- DX12 doesn't support `Features::POLYGON_MODE_POINT``. By teoxoy in [4032](https://github.com/gfx-rs/wgpu/pull/4032).
- Set `Features::VERTEX_WRITABLE_STORAGE` based on the right feature level. By teoxoy in [4033](https://github.com/gfx-rs/wgpu/pull/4033).

Metal

- Ensure that MTLCommandEncoder calls endEncoding before it is deallocated. By bradwerth in [4023](https://github.com/gfx-rs/wgpu/pull/4023)

WebGPU

- Ensure that limit requests and reporting is done correctly. By OptimisticPeach in [4107](https://github.com/gfx-rs/wgpu/pull/4107)
- Validate usage of polygon mode. By teoxoy in [4196](https://github.com/gfx-rs/wgpu/pull/4196)

GLES

- enable/disable blending per attachment only when available (on ES 3.2 or higher). By teoxoy in [4234](https://github.com/gfx-rs/wgpu/pull/4234)

Documentation

- Add an overview of `RenderPass` and how render state works. By kpreid in [4055](https://github.com/gfx-rs/wgpu/pull/4055)

Examples

- Created `wgpu-example::utils` module to contain misc functions and such that are common code but aren't part of the example framework. Add to it the functions `output_image_wasm` and `output_image_native`, both for outputting `Vec<u8>` RGBA images either to the disc or the web page. By JustAnotherCodemonkey in [3885](https://github.com/gfx-rs/wgpu/pull/3885).
- Removed `capture` example as it had issues (did not run on wasm) and has been replaced by `render-to-texture` (see above). By JustAnotherCodemonkey in [3885](https://github.com/gfx-rs/wgpu/pull/3885).

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).

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 injestion. 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 1 of 12

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.