Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update rust crate wgpu to 0.15 #54

Merged
merged 1 commit into from
Feb 24, 2023
Merged

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jan 26, 2023

Mend Renovate

This PR contains the following updates:

Package Type Update Change
wgpu (source) dependencies minor 0.14 -> 0.15

Release Notes

gfx-rs/wgpu

v0.15.1

Compare Source

Changes
General
Vulkan
DX12
WebGPU
Bug Fixes
General
Vulkan
DX12
GLES
WebGPU
Documentation
General

v0.15.0

Compare Source

Major Changes
WGSL Top-Level let is now const

All top level constants are now declared with const, catching up with the wgsl spec.

let is no longer allowed at the global scope, only within functions.

-let SOME_CONSTANT = 12.0;
+const SOME_CONSTANT = 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.

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

- 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

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

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.

- 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

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

By @​Elabajaba in #​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).

let texture = device.create_texture(&wgpu::TextureDescriptor {
  // ...
  format: TextureFormat::Rgba8UnormSrgb,
+ view_formats: &[TextureFormat::Rgba8Unorm],
});
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

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

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

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 to manage GPU memory (and calls CreatePlacedResource with a suballocated heap). By @​Elabajaba in #​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.

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
  • Add missing DEPTH_BIAS_CLAMP and FULL_DRAW_INDEX_UINT32 downlevel flags. By @​teoxoy in #​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
  • Make Surface::get_default_config return an Option to prevent panics. By @​cwfitzgerald in #​3157
  • Lower the max_buffer_size limit value for compatibility with Apple2 and WebGPU compliance. By @​jinleili in #​3255
  • Limits min_uniform_buffer_offset_alignment and min_storage_buffer_offset_alignment is now always at least 32. By @​wumpf #​3262
  • Dereferencing a buffer view is now marked inline. By @​Wumpf in #​3307
  • The strict_assert family of macros was moved to wgpu-types. By @​i509VCB in #​3051
  • Make ObjectId structure and invariants idiomatic. By @​teoxoy in #​3347
  • Add validation in accordance with WebGPU GPUSamplerDescriptor valid usage for lodMinClamp and lodMaxClamp. By @​James2022-rgb in #​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
  • Show more information in error message for non-aligned buffer bindings in WebGL #​3414
  • Update TextureView validation according to the WebGPU spec. By @​teoxoy in #​3410
  • Implement view_formats in the SurfaceConfiguration to match the WebGPU spec. By @​jinleili in #​3409
Vulkan
  • Set WEBGPU_TEXTURE_FORMAT_SUPPORT downlevel flag depending on the proper format support by @​teoxoy in #​3367.
  • Set COPY_SRC/COPY_DST only based on Vulkan's TRANSFER_SRC/TRANSFER_DST by @​teoxoy in #​3366.
GLES
WebGPU
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.
  • Implement Clone for ShaderSource and ShaderModuleDescriptor in wgpu. By @​daxpedda in #​3086.
  • Add get_default_config for Surface to simplify user creation of SurfaceConfiguration. By @​jinleili in #​3034
  • Improve compute shader validation error message. By @​haraldreingruber in #​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
  • Implemented correleation between user timestamps and platform specific presentation timestamps via [Adapter::get_presentation_timestamp]. By @​cwfitzgerald in #​3240
  • Added support for Features::SHADER_PRIMITIVE_INDEX on all backends. By @​cwfitzgerald in #​3272
  • Implemented TextureFormat::Stencil8, allowing for stencil testing without depth components. By @​Dinnerbone in #​3343
  • Implemented add_srgb_suffix() for TextureFormat for converting linear formats to sRGB. By @​Elabajaba in #​3419
  • Zero-initialize workgroup memory. By @​teoxoy in #​3174
GLES
Vulkan
  • Add SHADER_INT16 feature to enable the shaderInt16 VkPhysicalDeviceFeature. By @​Elabajaba in #​3401
WebGPU
  • Add MULTISAMPLE_X2, MULTISAMPLE_X4 and MULTISAMPLE_X8 to TextureFormatFeatureFlags. By @​39ali in 3140
  • Sync TextureFormat.describe with the spec. By @​teoxoy in 3312
Metal
Bug Fixes
General
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
  • Document and improve extension detection. By @​teoxoy in #​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 CStrs from C character arrays, and remove some unsafe blocks. By @​jimblandy in #​3076.
DX12
Metal
  • Fix texture view creation with full-resource views when using an explicit mip_level_count or array_layer_count. By @​cwfitzgerald in #​3323
GLES
  • Fixed WebGL not displaying srgb targets correctly if a non-screen filling viewport was previously set. By @​Wumpf in #​3093
  • Fix disallowing multisampling for float textures if otherwise supported. By @​Wumpf in #​3183
  • Fix a panic when creating a pipeline with opaque types other than samplers (images and atomic counters). By @​James2022-rgb in #​3361
  • Fix uniform buffers being empty on some vendors. By @​Dinnerbone in #​3391
  • Fix a panic allocating a new buffer on webgl. By @​Dinnerbone in #​3396
WebGPU
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
Emscripten
Examples
Testing/Internal

v0.14.2

Compare Source

Bug Fixes

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@Zageron
Copy link
Owner

Zageron commented Jan 28, 2023

@Zageron will need to wait to upgrade this until I finish rewriting this in pure wgpu. Almost done that so maybe wait to upgrade until work is complete and submitted.

@renovate renovate bot merged commit 98fb7e6 into main Feb 24, 2023
@renovate renovate bot deleted the renovate/wgpu-0.x branch February 24, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant