Skip to content

Releases: gfx-rs/wgpu

v0.18.2

06 Dec 19:34
daedf03
Compare
Choose a tag to compare

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.

v0.18.1

15 Nov 21:29
f22009e
Compare
Choose a tag to compare

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

Bug Fixes

General

  • Fix panic in Surface::configure in debug builds. By @cwfitzgerald in #4635
  • Fix crash when all the following are true: By @teoxoy in ##4642
    • Passing a naga module directly to Device::create_shader_module.
    • InstanceFlags::DEBUG is enabled.

DX12

  • Always use HLSL 2018 when using DXC to compile HLSL shaders. By @daxpedda in #4629

Metal

  • In Metal Shading Language output, fix issue where local variables were sometimes using variable names from previous functions. By @DJMcNab in #4594

v0.18.0

25 Oct 18:15
49b7ec9
Compare
Choose a tag to compare

Desktop OpenGL 3.3+ Support on Windows

We now support OpenGL on Windows! This brings support for a vast majority of the hardware that used to be covered by our DX11 backend. As of this writing we support OpenGL 3.3+, though there are efforts to reduce that further.

This allows us to cover the last 12 years of Intel GPUs (starting with Ivy Bridge; aka 3xxx), and the last 16 years of AMD (starting with Terascale; aka HD 2000) / NVidia GPUs (starting with Tesla; aka GeForce 8xxx).

By @Zoxc in #4248

Timestamp Queries Supported on Metal and OpenGL

Timestamp queries are now supported on both Metal and Desktop OpenGL. On Apple chips on Metal, they only support timestamp queries in command buffers or in the renderpass descriptor,
they do not support them inside a pass.

Metal: By @Wumpf in #4008
OpenGL: By @Zoxc in #4267

Render/Compute Pass Query Writes

Addition of the TimestampWrites type to compute and render pass descriptors to allow profiling on tilers which do not support timestamps inside passes.

Added an example to demonstrate the various kinds of timestamps.

Additionally, metal now supports timestamp queries!

By @FL33TW00D & @Wumpf in #3636.

Occlusion Queries

We now support binary occlusion queries! This allows you to determine if any of the draw calls within the query drew any pixels.

Use the new occlusion_query_set field on RenderPassDescriptor to give a query set that occlusion queries will write to.

let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
    // ...
+   occlusion_query_set: Some(&my_occlusion_query_set),
});

Within the renderpass do the following to write the occlusion query results to the query set at the given index:

rpass.begin_occlusion_query(index);
rpass.draw(...);
rpass.draw(...);
rpass.end_occlusion_query();

These are binary occlusion queries, so the result will be either 0 or an unspecified non-zero value.

By @valaphee in #3402

Shader Improvements

// WGSL constant expressions are now supported!
const BLAH: u32 = 1u + 1u;

// `rgb10a2uint` and `bgra8unorm` can now be used as a storage image format.
var image: texture_storage_2d<rgb10a2uint, write>;
var image: texture_storage_2d<bgra8unorm, write>;

// You can now use dual source blending!
struct FragmentOutput{
    @location(0) source1: vec4<f32>,
    @location(0) @second_blend_source source2: vec4<f32>,
}

// `modf`/`frexp` now return structures
let result = modf(1.5);
result.fract == 0.5;
result.whole == 1.0;

let result = frexp(1.5);
result.fract == 0.75;
result.exponent == 2i;

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

Shader Validation Improvements

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

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

By @Wumpf in #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.

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

gles_minor_version: By @PJB3005 in #3998
flags: By @nical in #4230

Many New Examples!

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

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

Added/New Features

Changes

General

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

Vulkan

  • Rename wgpu_hal::vulkan::Instance::required_extensions to desired_extensions. By @jimblandy in #4115
  • Don't bother calling vkFreeCommandBuffers when vkDestroyCommandPool will take care of that for us. By @jimblandy in #4059

DX12

Documentation

  • Use WGSL for VertexFormat example types. By @ScanMountGoat in #4035
  • Fix description of Features::TEXTURE_COMPRESSION_ASTC_HDR in #4157

Bug Fixes

General

  • Derive storage bindings via naga::StorageAccess instead of naga::GlobalUse. By @teoxoy in #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.
  • Fix clear texture views being leaked when wgpu::SurfaceTexture is dropped before it is presented. By @rajveermalviy...
Read more

v0.17.2

03 Oct 23:34
75b41fe
Compare
Choose a tag to compare

This release includes the crate wgpu and wgpu-hal only. The crates wgpu-core, and wgpu-types are still at 0.17.1.

Bug Fixes

Vulkan

v0.17.1

27 Sep 18:18
d2b8863
Compare
Choose a tag to compare

This release includes the crate wgpu, wgpu-core, and wgpu-hal. The crate wgpu-types is still at 0.17.0.

Added/New Features

  • Add get_mapped_range_as_array_buffer for faster buffer read-backs in wasm builds. By @ryankaplan in #4042.

Bug Fixes

DX12

Vulkan

  • Suppress validation error caused by OBS layer. This was also fixed upstream. By @cwfitzgerald in #4002
  • Work around bug in nvidia's vkCmdFillBuffer implementation. By @cwfitzgerald in #4132.

v0.17.0

21 Jul 03:18
21098cd
Compare
Choose a tag to compare

This is the first release that featured wgpu-info as a binary crate for getting information about what devices wgpu sees in your system. It can dump the information in both human readable format and json.

Major Changes

This release was fairly minor as breaking changes go.

wgpu types now !Send !Sync on wasm

Up until this point, wgpu has made the assumption that threads do not exist on wasm. With the rise of libraries like wasm_thread making it easier and easier to do wasm multithreading this assumption is no longer sound. As all wgpu objects contain references into the JS heap, they cannot leave the thread they started on.

As we understand that this change might be very inconvenient for users who don't care about wasm threading, there is a crate feature which re-enables the old behavior: fragile-send-sync-non-atomic-wasm. So long as you don't compile your code with -Ctarget-feature=+atomics, Send and Sync will be implemented again on wgpu types on wasm. As the name implies, especially for libraries, this is very fragile, as you don't know if a user will want to compile with atomics (and therefore threads) or not.

By @daxpedda in #3691

Power Preference is now optional

The power_preference field of RequestAdapterOptions is now optional. If it is PowerPreference::None, we will choose the first available adapter, preferring GPU adapters over CPU adapters.

By @Aaron1011 in #3903

initialize_adapter_from_env argument changes

Removed the backend_bits parameter from initialize_adapter_from_env and initialize_adapter_from_env_or_default. If you want to limit the backends used by this function, only enable the watned backends in the instance.

Added a compatible surface parameter, to ensure the given device is able to be presented onto the given surface.

- wgpu::util::initialize_adapter_from_env(instance, backend_bits);
+ wgpu::util::initialize_adapter_from_env(instance, Some(&compatible_surface));

By @fornwall in #3904 and #3905

Misc Breaking Changes

  • Change AdapterInfo::{device,vendor} to be u32 instead of usize. By @ameknite in #3760

Changes

  • Added support for importing external buffers using buffer_from_raw (Dx12, Metal, Vulkan) and create_buffer_from_hal. By @AdrianEddy in #3355

Vulkan

Added/New Features

  • Empty scissor rects are allowed now, matching the specification. by @PJB3005 in #3863.
  • Add back components info to TextureFormats. By @teoxoy in #3843.

Documentation

Bug Fixes

General

  • Fix order of arguments to glPolygonOffset by @komadori in #3783.
  • Fix OpenGL/EGL backend not respecting non-sRGB texture formats in SurfaceConfiguration. by @liquidev in #3817
  • Make write- and read-only marked buffers match non-readonly layouts. by @fornwall in #3893
  • Fix leaking X11 connections. by @wez in #3924
  • Fix ASTC feature selection in the webgl backend. by @expenses in #3934
  • Fix Multiview to disable validation of TextureViewDimension and ArrayLayerCount. By @MalekiRe in #3779.

Vulkan

Metal

DX12

WebGPU

  • Use get_preferred_canvas_format() to fill formats of SurfaceCapabilities. By @jinleili in #3744

Examples

  • Publish examples to wgpu.rs on updates to trunk branch instead of gecko. By @paul-hansen in #3750
  • Ignore the exception values generated by the winit resize event. By @jinleili in #3916

v0.16.3

19 Jul 20:33
c596bac
Compare
Choose a tag to compare

This release includes the crate wgpu. The crate wgpu-core is still at 0.16.1, wgpu-types and wgpu-hal are still at 0.16.2.

Changes

General

  • Make the Id type that is exposed when using the expose-ids feature implement Send and Sync again. This was unintentionally changed by the v0.16.0 release and is now fixed.

v0.16.2

09 Jul 04:57
6c84d43
Compare
Choose a tag to compare

This release includes wgpu, wgpu-hal, and wgpu-types. The crate wgpu-core are still at 0.16.1.

Changes

DX12

  • Increase the max_storage_buffers_per_shader_stage and max_storage_textures_per_shader_stage limits based on what the hardware supports. by @Elabajaba in [#3798]#3798

v0.16.1

25 May 02:06
2dba493
Compare
Choose a tag to compare

This release includes wgpu, wgpu-core, and wgpu-hal. The crate wgpu-types are still at 0.16.0.

General

GLES

  • Fix missing 4X MSAA support on some OpenGL backends. By @emilk in #3780

WebGPU

  • Fix crash when calling create_surface_from_canvas. By @grovesNL in #3718

v0.16.0

20 Apr 01:01
011a4e2
Compare
Choose a tag to compare

Major changes

Shader Changes

type has been replaced with alias to match with upstream WebGPU.

- type MyType = vec4<u32>;
+ alias MyType = vec4<u32>;

TextureFormat info API

The TextureFormat::describe function was removed in favor of separate functions: block_dimensions, is_compressed, is_srgb, required_features, guaranteed_format_features, sample_type and block_size.

- let block_dimensions = format.describe().block_dimensions;
+ let block_dimensions = format.block_dimensions();
- let is_compressed = format.describe().is_compressed();
+ let is_compressed = format.is_compressed();
- let is_srgb = format.describe().srgb;
+ let is_srgb = format.is_srgb();
- let required_features = format.describe().required_features;
+ let required_features = format.required_features();

Additionally guaranteed_format_features now takes a set of features to assume are enabled.

- let guaranteed_format_features = format.describe().guaranteed_format_features;
+ let guaranteed_format_features = format.guaranteed_format_features(device.features());

Additionally sample_type and block_size now take an optional TextureAspect and return Options.

- let sample_type = format.describe().sample_type;
+ let sample_type = format.sample_type(None).expect("combined depth-stencil format requires specifying a TextureAspect");
- let block_size = format.describe().block_size;
+ let block_size = format.block_size(None).expect("combined depth-stencil format requires specifying a TextureAspect");

By @teoxoy in #3436

BufferUsages::QUERY_RESOLVE

Buffers used as the destination argument of CommandEncoder::resolve_query_set now have to contain the QUERY_RESOLVE usage instead of the COPY_DST usage.

  let destination = device.create_buffer(&wgpu::BufferDescriptor {
      // ...
-     usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ,
+     usage: wgpu::BufferUsages::QUERY_RESOLVE | wgpu::BufferUsages::MAP_READ,
      mapped_at_creation: false,
  });
  command_encoder.resolve_query_set(&query_set, query_range, &destination, destination_offset);

By @JolifantoBambla in #3489

Renamed features

The following Features have been renamed.

  • SHADER_FLOAT16 -> SHADER_F16
  • SHADER_FLOAT64 -> SHADER_F64
  • SHADER_INT16 -> SHADER_I16
  • TEXTURE_COMPRESSION_ASTC_LDR -> TEXTURE_COMPRESSION_ASTC
  • WRITE_TIMESTAMP_INSIDE_PASSES -> TIMESTAMP_QUERY_INSIDE_PASSES

By @teoxoy in #3534

Anisotropic Filtering

Anisotropic filtering has been brought in line with the spec. The anisotropic clamp is now a u16 (was a Option<u8>) which must be at least 1.

If the anisotropy clamp is not 1, all the filters in a sampler must be Linear.

SamplerDescriptor {
-    anisotropic_clamp: None,
+    anisotropic_clamp: 1,
}

By @cwfitzgerald in #3610.

TextureFormat Names

Some texture format names have changed to get back in line with the spec.

- TextureFormat::Bc6hRgbSfloat
+ TextureFormat::Bc6hRgbFloat

By @cwfitzgerald in #3671.

Misc Breaking Changes

  • Change type of mip_level_count and array_layer_count (members of TextureViewDescriptor and ImageSubresourceRange) from Option<NonZeroU32> to Option<u32>. By @teoxoy in #3445
  • Change type of bytes_per_row and rows_per_image (members of ImageDataLayout) from Option<NonZeroU32> to Option<u32>. By @teoxoy in #3529
  • On Web, Instance::create_surface_from_canvas() and create_surface_from_offscreen_canvas() now take the canvas by value. By @daxpedda in #3690

Changes

General

  • Added TextureFormatFeatureFlags::MULTISAMPLE_X16. By @Dinnerbone in #3454
  • Added BufferUsages::QUERY_RESOLVE. By @JolifantoBambla in #3489
  • Support stencil-only views and copying to/from combined depth-stencil textures. By @teoxoy in #3436
  • Added Features::SHADER_EARLY_DEPTH_TEST. By @teoxoy in #3494
  • All fxhash dependencies have been replaced with rustc-hash. By @james7132 in #3502
  • Allow copying of textures with copy-compatible formats. By @teoxoy in #3528
  • Improve attachment related errors. By @cwfitzgerald in #3549
  • Make error descriptions all upper case. By @cwfitzgerald in #3549
  • Don't include ANSI terminal color escape sequences in shader module validation error messages. By @jimblandy in #3591
  • Report error messages from DXC compile. By @Davidster in #3632
  • Error in native when using a filterable TextureSampleType::Float on a multisample BindingType::Texture. By @mockersf in #3686
  • On Web, the size of the canvas is adjusted when using Surface::configure(). If the canvas was given an explicit size (via CSS), this will not affect the visual size of the canvas. By @daxpedda in #3690

WebGPU

Vulkan

  • Set max_memory_allocation_size via PhysicalDeviceMaintenance3Properties. By @jinleili in #3567
  • Silence false-positive validation error about surface resizing. By @seabassjh in #3627

Bug Fixes

General

  • copyTextureToTexture src/dst aspects must both refer to all aspects of src/dst format. By @teoxoy in #3431
  • Validate before extracting texture selectors. By @teoxoy in #3487
  • Fix fatal errors (those which panic even if an error handler is set) not including all of the details. By @kpreid in #3563
  • Validate shader location clashes. By @emilk in #3613
  • Fix surfaces not being dropped until exit. By @BenjaminSchaaf in #3647

WebGPU

  • Fix handling of None values for depth_ops and stencil_ops in RenderPassDescriptor::depth_stencil_attachment. By @niklaskorz in #3660
  • Avoid using WasmAbi functions for WebGPU backend. By @grovesNL in #3657

DX12

  • Use typeless formats for textures that might be viewed as srgb or non-srgb. By @teoxoy in #3555

GLES

  • Set FORCE_POINT_SIZE if it is vertex shader with mesh consist of point list. By @REASY in 3440
  • Remove unwraps inside surface.configure. By @cwfitzgerald in #3585
  • Fix copy_external_image_to_texture, copy_texture_to_texture and copy_buffer_to_texture not taking the specified index into account if the target texture is a cube map, 2D texture array or cube map array. By @daxpedda #3641
  • Fix disabling of vertex attributes with non-consecutive locations. By @Azorlogh in #3706

Metal

  • Fix metal erroring on an array_stride of 0. By @teoxoy in #3538
  • create_texture returns an error if new_texture returns NULL. By @jinleili in #3554
  • Fix shader bounds checking being ignored. By @FL33TW00D in #3603

Vulkan

  • Treat VK_SUBOPTIMAL_KHR as VK_SUCCESS on Android due to rotation issues. By @James2022-rgb in #3525

Examples

  • Use BufferUsages::QUERY_RESOLVE instead of BufferUsages::COPY_DST for buffers used in CommandEncoder::resolve_query_set calls in mipmap example. By @JolifantoBambla in #3489