Repository navigation
Major changes
The parking_lot feature of wgpu is removed
wgpu now always uses parking_lot for its locks when the std feature is enabled, through the new wgpu-sync crate. The parking_lot feature no longer exists. If you name the feature, remove it:
- wgpu = { version = "30", default-features = false, features = ["std", "parking_lot", "vulkan"] }
+ wgpu = { version = "31", default-features = false, features = ["std", "vulkan"] }By @bushrat011899 in #9780.
Metal surfaces advertise CompositeAlphaMode::PreMultiplied instead of PostMultiplied
Metal surfaces now advertise CompositeAlphaMode::PreMultiplied instead of PostMultiplied. This matches the premultiplied alpha compositing that Core Animation performs for a non-opaque CAMetalLayer.
If you hard-coded PostMultiplied to get a transparent macOS window, you now get an UnsupportedAlphaMode validation error. Use PreMultiplied instead.
surface.configure(&device, &wgpu::SurfaceConfiguration {
- alpha_mode: wgpu::CompositeAlphaMode::PostMultiplied,
+ alpha_mode: wgpu::CompositeAlphaMode::PreMultiplied,
// ...
});By @nicoburns in #9922.
DeviceDescriptor has new field default_queue
DeviceDescriptor has new field default_queue of type QueueDescriptor, which allows setting label for default device queue:
wgpu::DeviceDescriptor {
label: None
required_features: adapter.features(),
required_limits: adapter.limits(),
+ default_queue: wgpu::QueueDescriptor { label: None },
// ...
}TEXTURE_COMPONENT_SWIZZLE feature and swizzle field in TextureViewDescriptor
A new swizzle field is in TextureViewDescriptor used for mapping red/green/blue/alpha channels of the texture view when accessed by shaders. This requires TEXTURE_COMPONENT_SWIZZLE feature if swizzle is not identity.
let texture_view_desc = wgpu::TextureViewDescriptor {
label: None,
format: Some(wgpu::TextureFormat::Rgba8Unorm),
dimension: Some(wgpu::TextureViewDimension::D2),
usage: None,
aspect: wgpu::TextureAspect::All,
base_mip_level: 0,
mip_level_count: None,
base_array_layer: 0,
array_layer_count: None,
+ swizzle: wgpu::TextureComponentSwizzle::default(),
}BufferViews block unmapping of Buffer on native
On native, a BufferView could read freed memory if its buffer was destroyed, or unmapped because the device was lost, while the view was alive. BufferView and BufferViewMut now block the unmap of the native buffer until all views are dropped. Keep views alive for as short a time as possible.
Buffer::destroy and Device::destroy now panic if a BufferView or BufferViewMut is alive. Buffer::unmap already did this.
To prevent deadlocks, do not keep views alive across Device::poll, Queue::submit, or Surface::configure. These calls can destroy the buffer, and thus unmap it, if the device is lost.
get_mapped_range and get_mapped_range_mut must match the MapMode
get_mapped_range now returns an error if the buffer is mapped with MapMode::Write. This includes buffers created with mapped_at_creation: true. Use get_mapped_range_mut for these buffers. get_mapped_range_mut now returns an error if the buffer is mapped with MapMode::Read.
Queue::submit returns Option<SubmissionIndex>
Queue::submit now returns Option<SubmissionIndex>. It returns None if the submission failed. A None result means the submission never reached the driver, so fences/events/semaphores attached to HAL queues will never be signalled. On the WebGPU backend it always returns None, because that backend cannot wait for a specific submission.
let index = queue.submit([encoder.finish()]);
- device.poll(wgpu::PollType::Wait { submission_index: Some(index), timeout: None })?;
+ device.poll(wgpu::PollType::Wait { submission_index: index, timeout: None })?;TextureDescriptor has new field texture_binding_view_dimension, new downlevel flag ARBITRARY_BINDING_VIEW_DIMENSIONS
TextureDescriptor has a new field texture_binding_view_dimension, implementing WebGPU's textureBindingViewDimension. On devices without the new DownlevelFlags::ARBITRARY_BINDING_VIEW_DIMENSIONS (GLES/WebGL), texture bindings must use a view of this dimension, None infers it from the texture's dimension and layer count, and CubeArray requires DownlevelFlags::CUBE_ARRAY_TEXTURES and a layer count that is a multiple of 6. Devices with the downlevel flag ignore it. Texture::texture_binding_view_dimension() returns the resolved value. This allows specifying a binding view dimension that was otherwise only inferred from a heuristic for GLSL that could get it wrong.
Example for a cube map:
wgpu::TextureDescriptor {
size: wgpu::Extent3d { width: 256, height: 256, depth_or_array_layers: 6 },
dimension: wgpu::TextureDimension::D2,
// ...
+ texture_binding_view_dimension: Some(wgpu::TextureViewDimension::Cube),
}Breaking for custom backends: Implementations of TextureInterface must implement texture_binding_view_dimension.
By @alextechcc in #8014.
DXGI swapchain for Vulkan on Windows
The Vulkan backend can now present via a DXGI swapchain on Windows. DXGI swapchains generally perform more consistently, give more control over frame pacing, and may use optimizations that are not available to native vulkan swapchains. For now this is a default-off feature, though in the future it may be enabled by default.
Turn it on at instance creation, or if your program is using wgpu environment variables set WGPU_VULKAN_SWAPCHAIN_KIND to native, dxgi-hwnd, or dxgi-visual:
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::VULKAN,
+ backend_options: wgpu::BackendOptions {
+ vulkan: wgpu::VulkanBackendOptions {
+ swapchain_kind: wgpu::VulkanSwapchainKind::DxgiFromHwnd,
+ ..Default::default()
+ },
+ ..Default::default()
+ },
..Default::default()
});Nsight and Radeon GPU Profiler should work normally, and all graphics debuggers should still broadly function, but RenderDoc will only capture the D3D12 work, unless you explicitly use Device::start_graphics_debugger_capture on the wgpu device to capture the vulkan work. RenderDoc does not support DirectComposition, so it does not work with DxgiFromVisual. The interop D3D12 device honors the same Agility SDK configuration as the DX12 backend, via VulkanBackendOptions::agility_sdk.
By @cwfitzgerald in #8388.
Added/New Features
General
-
Support the
wasm64-unknown-unknowntarget for the web backend. Building for wasm64 requires a nightly toolchain with-Z build-std=std,panic_abort. By @nickbabcock in #9836. -
wgpu-corenow exposesvalidate_device_descriptorandvalidate_texture_descriptorfunctions that perform the same descriptor validation the corresponding resource creation APIs would, without actually creating a resource. This may be useful in conjunction with hal raw APIs. By @andyleiserson in #9967 and #9979. -
Many types now offer
pub const fn default()in addition to implementing theDefaulttrait, allowing constants to make use of default values. By @kpreid in #9929. -
wgpu-corebuilds withoutstd, sowgpucan use the core backends inno_stdenvironments. By @bushrat011899 in #9859. -
Added
TextureDescriptor::theoretical_memory_footprintto estimate memory footprint of a texture. By @sagudev in #10032. -
wgpu::WriteOnly<[_]>now implementsSend. By @kpreid in #10163. -
Added
Texture::mark_externally_initialized()to stop a texture from being lazily cleared if it was written to externally (e.g. viaas_hal). By @R-Cramer4 in #10075. -
Added the following members to
Limits:Limits::max_storage_buffers_in_vertex_stageLimits::max_storage_buffers_in_fragment_stageLimits::max_storage_textures_in_vertex_stageLimits::max_storage_textures_in_fragment_stage
These match the limits that were added to WebGPU. Otherwise, they are not meaningfully distinct from
Limits::max_storage_{buffers,textures}_per_shader_stage, because compatibility mode is not yet implemented (see #8124).By @ErichDonGubler in #8764.
-
Zero-size vertex and index buffer bindings are now accepted by
set_vertex_bufferandset_index_buffer. By @andyleiserson in #9848. -
Added the
snorm10-10-10-2vertex format on Metal and Vulkan. Not yet supported on DX12. By @andyleiserson in #10226. -
Add support for shader
debugPrintfin Metal and Vulkan, behind a wgsl extension. By @39ali in #9389. -
Added the following methods to
RenderBundleEncoderfor recording debug markers and groups:insert_debug_marker(&mut self, label: &str)push_debug_group(&mut self, label: &str)pop_debug_group(&mut self)
wgpu-corenow validates debug group balance atfinish()and replays debug annotations when executing render bundles.InstanceFlags::DISCARD_HAL_LABELSsuppresses native debug annotations without disabling validation.Breaking for custom backends: Implementations of
RenderBundleEncoderInterfacemust implement these three new methods. -
Added
Utf16SourceLocationwhich is analogue toSourceLocationbut using UTF-16 code units. AddedUtf16SourceLocation::to_utf8andSourceLocation::to_utf16to convert between them. By @sagudev in #10294. -
Add
as_coreandfrom_coremethods on various wgpu resources. By @sagudev in #10211. -
Add
StagingBelt::discard_free_chunksto release free chunks that were not used since the lastrecall.StagingBeltis now available withoutstd. By @HigherOrderLogic in #10383 and #10699. -
Added
Features::UNRESTRICTED_BYTES_PER_ROW:bytes_per_rowincopy_buffer_to_textureandcopy_texture_to_bufferneed only be a multiple of the texel block copy size, not of 256. Supported on Vulkan, Metal, GL, and DX12 withUnrestrictedBufferTextureCopyPitchSupported. By @michael-dm in #10619. -
Add experimental ray tracing pipelines:
Device::create_ray_tracing_pipeline,CommandEncoder::begin_ray_tracing_pass, andRayTracingPass::trace_rays. RequiresFeatures::EXPERIMENTAL_RAY_TRACING_PIPELINES. By @Vecvec in #10144. -
The format string of
debugPrintfis now checked for correctness. By @evilpie in #9641. -
Added
wgt::Features::CORE_FEATURES_AND_LIMITS, which is reported only when the adapter supports WebGPU default limits and its downlevel capabilities are WebGPU-compliant. By @sagudev in #10293. -
Added
TextureDescriptor::default_view_dimensionto get the view dimension a texture's views default to. By @alextechcc in #8014. -
Add
TlasInstance::from_blas_untransformedandTlasInstance::from_blas_transformedfor easier construction and readability in simple cases. By @Vecvec in #10476. -
Expose
is_surface_supportedonDevice. By @sagudev in #10896. -
Add
Queue::present_with_damage, which takes the regions that changed since the last present as a hint for the compositor. Implemented for Vulkan (VK_KHR_incremental_present) and EGL (EGL_KHR_swap_buffers_with_damage/EGL_EXT_swap_buffers_with_damage); ignored elsewhere. Addswgpu::Rect, moved fromwgpu_core::command::Rect. By @sauliusvl in #10152. -
Add
SurfaceColorSpace::PassThroughon Vulkan and Metal, mapped toVK_COLOR_SPACE_PASS_THROUGH_EXTand anilCAMetalLayer.colorspace, respectively, so applications can manage surface color interpretation themselves. By @yikerman in #10546. -
Add flags for changing behaviour of
TlasInstances. By @Vecvec in #11080. -
Add
RayTracingPass::trace_rays_indirect, which reads the number of rays from a buffer. RequiresFeatures::EXPERIMENTAL_RAY_TRACING_PIPELINES_INDIRECT, which is supported on Vulkan. By @JMS55 in #11077.
naga
immediate_address_spaceWGSL language extension is implemented. By @beicause in #9711.- Add
@builtin(hit_barycentrics), avec2<f32>readable in@any_hitand@closest_hitray tracing pipeline shaders, holding two of the barycentric coordinates of the hit point on the triangle (the third is1.0 - x - y). Currently only supported with the SPIR-V backend. By @JMS55 in #10193. - Implement constant evaluation of the
extractBits,insertBits,faceForward,reflect, andrefractbuilt-in functions. Evaluates expression at compile time to report issues early likeoffsetandcountselecting bits beyond the width of the data. By @MinerSheep in #10258. - Support WGSL
bitcastbetweenvec2<f16>and 32-bit scalars, betweenvec4<f16>andvec2of 32-bit scalars, betweenf16andi16/u16(withwgpu_int16), and the corresponding SPIR-VOpBitcasts. By @DouglasDwyer in #10613. - Add the
wgpu_ray_tracing_invocation_reorderWGSL enable-extension and the matchingCapabilities::RAY_TRACING_INVOCATION_REORDER, exposing hit objects and shader invocation reordering. It provides thehit_objecttype, which records the result of a ray traversal without running any hit or miss shader, varioushitObject*built-in functions, andreorderThread, which reorders invocations of a@ray_generationshader to improve coherence. Currently only supported with the SPIR-V backend. Enable it withFeatures::EXPERIMENTAL_RAY_TRACING_INVOCATION_REORDER, which also requiresFeatures::EXPERIMENTAL_RAY_TRACING_PIPELINESand is supported on Vulkan with VK_EXT_ray_tracing_invocation_reorder.reorderThreadmay be a no-op. Check whetherAdapter::ray_tracing_invocation_reorder_modereportsRayTracingInvocationReorderMode::Reorderto see if invocations will be reordered. By @JMS55 in #10311 and #10871. - Support SPIR-V's
OpGroupNonUniformBallotFindLSB/MSBand GLSL'ssubgroupBallotFindLSB/MSBwith the newStatement::SubgroupBallotFindBit. HLSL, MSL, and WGSL output use a polyfill. The GLSL frontend now also acceptsgl_SubgroupSizeandgl_SubgroupInvocationID. By @nazar-pc in #9966. - Parse
NonSemantic.DebugPrintfinstructions in SPIR-V shaders. By @evilpie in #10561. texture_and_sampler_letWGSL language extension is implemented. By @apollo-2006 in #11108.
DX12
- Support
Features::SHADER_EARLY_DEPTH_TESTon DX12. Naga's HLSL backend now emits[earlydepthstencil]for@early_depth_test(force),SV_DepthGreaterEqual/SV_DepthLessEqualfor@early_depth_test(greater_equal/less_equal)on pipelines that are not multisampled, and discards the depth output for@early_depth_test(unchanged). Callers of Naga's HLSL backend can set the newnaga::back::hlsl::PipelineOptions::multisampled. By @DouglasDwyer in #10624.
Vulkan
- Add OpenHarmony surface support via
VK_OHOS_surface. Previously the Vulkan backend could not create a surface on OpenHarmony, leaving GLES as the only usable backend. By @ozongzi in #9908.
Metal
- Support
Features::SHADER_EARLY_DEPTH_TESTon Metal. Naga's MSL backend now emits[[early_fragment_tests]]for@early_depth_test(force),depth(greater)/depth(less)for@early_depth_test(greater_equal/less_equal), and discards the depth output for@early_depth_test(unchanged)and@early_depth_test(force). By @DouglasDwyer in #10625. - Metal now runs fixed-count multi-draws of 512 or more draws through GPU-generated indirect command buffers, instead of one indirect draw per command on the CPU. This is off with
InstanceFlags::STRICT_WEBGPU_COMPLIANCE. The memory they hold is reported asHalCounters::indirect_command_buffer_memory, and pooled ones unused for two seconds are released. By @matthargett in #9640. - Added support for NV12 and P010 texture formats. Due to no native support, they're implemented using separate textures for each plane. By @jerzywilczek in #9624.
- Add
Features::COMPUTE_PIPELINE_SUBGROUP_SIZEandComputePipeline::get_subgroup_size, which returns the pipeline's subgroup size when the feature is enabled. Supported on Metal, where the value isthreadExecutionWidth. By @Vollkornaffe in #9876.
GLES
- Add ANGLE as an opt-in OpenGL backend on Windows via
cfg(windows_angle), while keeping theanglefeature for ANGLE on macOS/iOS. By @csmoe in #9422.
WebGL
- Add
Device::create_texture_from_webgl_handle,Device::as_webgl_texture, andDevice::as_webgl_contextfor zero-copy interop between wgpu's WebGL (GLES) backend and rawweb_sys::WebGlTexturehandles. By @AdrianEddy in #9834. Queue::copy_external_image_to_texturenow acceptsExternalImageSource::OffscreenCanvaswithoutDownlevelFlags::UNRESTRICTED_EXTERNAL_TEXTURE_COPIES. By @AdrianEddy in #9834.- Uploading an
ExternalImageSource::VideoFrameon the GLES backend no longer requires building with--cfg web_sys_unstable_apis(the correspondingweb-sysAPIs are stable now). By @AdrianEddy in #9834.
WebGPU
- Add
Device::import_external_textureto bind aGPUExternalTexturesampled from anHTMLVideoElementor WebCodecsVideoFrame, without a copy. By @AdrianEddy in #9936. - The
subgroupsfeature (and any other features added in the future) will now be reported by the WebGPU backend, if reported by the underlying WebGPU implementation. By @andyleiserson in #10265.
Hal
- Add
BufferBinding::buffer, a public read accessor for the bound buffer, which was previously inaccessible to out-of-treewgpu_hal::Apiimplementations. By @danlehmann in #9820. - Add
wgpu_hal::vulkan::Surface::set_next_present_chain, which attaches a caller-providedpNextchain to theVkPresentInfoKHRof the surface's next presentation. WithAdapter::open_with_callbackto enable the device extension, this supports presentation extensions wgpu has no dedicated support for, such as VK_NV_present_metering for metering the display timing of frame-generation frames. By @stuartparmenter in #9847. - Allow specifying a queue family ownership transfer when transitioning a texture.
hal::TextureBarriergained an optionalqueue_family_ownership_transferfield (honored only by the Vulkan backend) so that images imported from external memory can be acquired from and released back to the queue family of an external or foreign owner, described by the newhal::QueueFamilyenum. Resolves #2948. By @alexander-bruun in #9668. - Add
wgpu_hal::vulkan::Surface::set_next_swapchain_create_chainandwgpu_hal::vulkan::Queue::set_next_submit_chain. The first attaches a caller-providedpNextchain to theVkSwapchainCreateInfoKHRof the surface's next configuration. The second attaches one to theVkSubmitInfoof the queue's next submission. Together withset_next_present_chainand the existing raw-handle accessors, this makes VK_NV_low_latency2 usable on a wgpu swapchain. That extension is the Vulkan interface for NVIDIA Reflex. By @stuartparmenter in #10095. - Add
wgpu_hal::vulkan::AccelerationStructure::raw_handle, which returns the underlyingVkAccelerationStructureKHR. Use it withAdapter::open_with_callbackto record acceleration structure commands from extensions wgpu doesn't support, such as VK_NV_cluster_acceleration_structure. Mark the result withCommandEncoder::mark_acceleration_structures_built. By @stuartparmenter in #10187. - Add
wgpu_hal::dx12::Adapter::device_from_rawto create a device from an existingID3D12DeviceandID3D12CommandQueue. By @rdeioris in #10662. - Added
CommandEncoder::encode_deferred_multi_draws(default no-op). Backends may defer part of the work for indirect multi-draws recorded in a render pass; after ending such a pass, callers must invoke this method while recording a command buffer that the queue executes before the pass's. wgpu-core does this in its internal pre-pass. By @matthargett in #9640. - Add
wgpu_hal::metal::Buffer::raw_handle, returning the underlyingMTLBuffer, mirroringTexture::raw_handle. By @jf--- in #10924. - Add GLES DMA-BUF texture import with specific errors reported through
gles::ImportTextureError. By @terjdev in #10522.
Changes
General
WGPU_DX12_COMPILERandDx12Compiler::from_strnow treat a value that is notfxc,dxc,dynamicdxc,staticdxc, orautoas a path to the DXC DLL. By @teoxoy in #9619.- Allow
set_immediatesbeforeset_pipelineby deferring actual setting of immediates to draw/dispatch call time. By @beicause in #9597. - Validate pipeline layout
immediate_sizeand fix its calculation when there are multiple immediate variables. Now it must be >= required size of the shader entry point. By @beicause in #9711. TextureFormat::is_srgb()has been renamed toTextureFormat::has_srgb_suffix()to clarify its function. By @kpreid in #9758.- Remove the never-constructed
CreateBlasError::InvalidAabbStridevariant.create_blastakes no stride, so it could never be produced; AABB stride is validated at build time asBuildAccelerationStructureError::InvalidAabbStride. By @mstampfli in #9935. BlendFactor::ref_second_blend_sourceis renamed toBlendFactor::uses_second_blend_source. By @andyleiserson in #9939.- Added
DownlevelFlags::LINEAR_INTERPOLATION, indicating that the adapter supports@interpolate(linear). It is absent on GLES/WebGL2, since GLSL ES has nonoperspectivequalifier. By @emilk in #9972. - Breaking for custom backends: The dispatch traits have new required methods for buffer, texture, and query set properties, for ray tracing pipelines and passes, and for
Device::queue,Device::is_surface_supported,ComputePipeline::get_subgroup_size, andAdapter::ray_tracing_invocation_reorder_mode.QueueInterface::submitreturnsOption<u64>. Vertex and index buffer binding sizes areOption<BufferAddress>.SurfaceInterface::get_current_texturetakes a texture descriptor, andTexture::from_customno longer takes one. By @sagudev in #10100 and #10108, and others. DeviceDescriptor::map_labelnow takes anFninstead of anFnOnce. By @sagudev in #10109.TextureUses::DEPTH_STENCIL_READandTextureUses::DEPTH_STENCIL_WRITEare replaced byDEPTH_READ,DEPTH_WRITE,STENCIL_READ, andSTENCIL_WRITE.TextureUsesis now au32. This affects callers ofCommandEncoder::transition_resourcesandDevice::create_texture_from_hal.DepthStencilState::is_read_onlyis removed; useis_depth_read_onlyandis_stencil_read_only. By @beicause in #9763.Device::create_texture_from_halhas a newclearedargument. Passtrueonly if the contents of the texture are valid. If you passfalse, wgpu clears the texture before its first read. By @R-Cramer4 in #10076.Instance::from_coreis now safe and takes anArc<wgpu_core::instance::Instance>.Instance::generate_reportis removed. By @sagudev in #10176 and #9950.Buffer::unmapwill not raise any validation errors anymore per specification. By @sagudev in #10242.wgpu::Error::Validation::descriptionfromDevice::create_shader_moduleno longer include the shader source text and detailed compiler messages, per the WebGPU specification. These details remain accessible viaShaderModule::get_compilation_info. By @beicause and @sagudev in #10173.BufferUsagesis now composed ofBufferUsagesWebGPUandBufferUsagesWGPU, similarly toFeatures. In most cases this is not expected to be a breaking change, but changes might be required for convertingBufferUsagesto/fromu32. By @sagudev in #10195.Surface::configurenow destroys a previously acquiredSurfaceTexturethat is still alive, instead of failing. Pending buffer map callbacks are now called when configuration fails. By @sagudev in #10296 and #10686.ShaderStagesis now composed ofShaderStagesWebGPUandShaderStagesWGPU, similarly toFeatures. In most cases this is not expected to be a breaking change, but changes might be required for convertingShaderStagesto/fromu32. By @sagudev in #10313.request_adapterwill return error onInstanceFlags::STRICT_WEBGPU_COMPLIANCEif the adapter has already been consumed by a previousrequest_device. By @sagudev in #10444.DownlevelFlags::compliant()no longer includesSURFACE_VIEW_FORMATS. By @shiena in #10425.- The variants of
wgpu_core::validation::StageErrorrelated to entry point selection have been reorganized. By @jimblandy in #10544. clear_texturenow rejects a request to clear only some aspects of a texture. Previously such a request would clear all aspects of the texture. By @andyleiserson in #10684.Device::pollnow always returnsPollError::CantWaitif called withPollType::Waiton the WebGPU backend. By @teoxoy in #10218.TlasInstance::newhas newintersection_indexandflagsarguments. Pass0andAccelerationStructureInstanceFlags::empty()for the previous behavior. By @Vecvec in #10144 and #11080.DownlevelFlags::SHADER_F16_IN_F32has been removed. It previously blocked brokenquantizeToF16,pack2x16float, andunpack2x16floaton older llvmpipe / lavapipe. Using wgpu with an up-to-date Mesa version is always recommended. By @szymros in #10820.- Texture copy extents are now correctly validated for subsampled chroma planes. Copying is now supported between a plane of a multi-planar texture and other textures or buffers, in either direction. By @andyleiserson in #10776.
- Resources passed to
RenderBundleEncoderandutil::RenderEncoderno longer need to outlive the encoder. ExternalRenderEncoderimplementations must update all six resource-taking methods to accept independent argument lifetimes instead of the trait's'alifetime. By @mvanhorn in #10839. - When a device is lost because of a backend error, wgpu-core now logs an error with the location in wgpu-core that reported it, the adapter name, its PCI vendor and device IDs, and the driver name and version. The Vulkan backend also logs the
VkResultof an error it did not expect. The message passed to the device-lost callback is unchanged. By @matthargett in #11172. request_deviceenablesFeatures::CORE_FEATURES_AND_LIMITSif the adapter supports it. WithInstanceFlags::STRICT_WEBGPU_COMPLIANCE, the requested limits are raised to at least the WebGPU defaults. By @sagudev in #11049.
naga
naga::valid::ValidationErroris now always returned boxed, to avoidclippy::large_result_errwarning. By @beicause in #9612.- Added
naga::valid::Capabilities::LINEAR_INTERPOLATION, which is now required in order to use@interpolate(linear). By @emilk in #9972. - The GLSL backend's
MissingFeatureserror now names the GLSL version that lacks the features, e.g.GLSL 300 es doesn't support the required feature(s): NOPERSPECTIVE_QUALIFIER. By @emilk in #9972. - Bit reinterpretation is now represented in the Naga IR by the new
naga::ir::Expression::Bitcast, which names its result type.naga::ir::Expression::Asnow only converts, and itskindandconvertfields are replaced bytarget: Scalar. By @DouglasDwyer in #10613. - The SPIR-V backend replaces NaN components of cube texture sample coordinates with zero, so the selected face is the same on all drivers. By @teoxoy in #10905.
- WGSL shaders must declare
enable wgpu_f64;to use thef64type or thelfliteral suffix. By @stefnotch in #10982.
Vulkan
- Sub-allocate
wgpu_hal::MemoryFlags::TRANSIENTbuffers and acceleration structure build scratch from a separate Vulkan memory pool, so short-lived allocations no longer pin memory blocks shared with long-lived resources. By @stuartparmenter in #10232. wgpu_hal::vulkan::TextureMemory::Allocationnow holds awgpu_hal::vulkan::MemoryAllocationinstead of agpu_allocator::vulkan::Allocation. By @stuartparmenter in #10232.- Allocate acceleration structures created with
AccelerationStructureFlags::ALLOW_COMPACTIONfrom the transient Vulkan memory pool, since they are usually replaced by their compacted copies. By @stuartparmenter in #10233. - Removed the
VULKAN_GOOGLE_DISPLAY_TIMING,VULKAN_EXTERNAL_MEMORY_WIN32,VULKAN_EXTERNAL_MEMORY_FD, andVULKAN_EXTERNAL_MEMORY_DMA_BUFfeatures. wgpu enables the corresponding Vulkan extensions whenever the adapter supports them. To check for support, useAdapter::as_hal::<wgpu::hal::api::Vulkan>()and callphysical_device_capabilities().supports_extension()with the extension name. By @andyleiserson in #10635. - Renamed
wgpu_hal::vulkan::Device::texture_from_d3d11_shared_handletotexture_from_shared_handle. It has a newhandle_typeargument: passvk::ExternalMemoryHandleTypeFlags::D3D11_TEXTUREfor the previous behavior, orD3D12_RESOURCEfor anID3D12Resourceshared handle. By @cwfitzgerald in #8388. wgpu_hal::vulkan::Instance::from_rawhas newswapchain_kindandagility_sdkarguments. PassVulkanSwapchainKind::NativeandNonefor the previous behavior. By @cwfitzgerald in #8388.
Metal
- Removed the
sizeargument towgpu_hal::metal::Device::buffer_from_raw. The passed size value was previously used only to resolve vertex buffer bindings without an explicit size, possibly incorrectly. Binding sizes are now resolved inwgpu-core. By @andyleiserson in #9848. - The value of the
max_binding_array_sampler_elements_per_shader_stageon Apple7, Apple8, and Mac2 hardware is reduced from 1024 to 996, to match the latest Metal documentation. By @andyleiserson in #10649. - When
cfg(debug_assertions)is active and the Metal capture device is detected (e.g. if running the application under Xcode), print a warning that feature detection may be degraded. Withoutcfg(debug_assertions), remove the feature detection workaround in question entirely. By @andyleiserson in #9757. Also see #10028.
Hal
- Removed
wgpu_hal::gles::Instance::egl_config. By @csmoe in #9422. wgpu_hal::dx12::Device::texture_from_rawandbuffer_from_rawhave a newdrop_callbackargument. PassNonefor the previous behavior. By @Aandreba in #10303.TextureDescriptorhas a new fieldtexture_binding_view_dimension. It must beSomeon devices withoutDownlevelFlags::ARBITRARY_BINDING_VIEW_DIMENSIONS(the GLES backend allocates the texture's GL target from it), and is ignored otherwise. By @alextechcc in #8014.hal::Queue::presentgained adamage_rects: &[wgt::Rect<u32>]parameter. The rects must be non-empty and within the surface. Pass an empty slice for the previous behavior. By @sauliusvl in #10152.
Bug Fixes
General
- Zero-initialize padding (if any) at the end of a buffer allocation. This was application-visible in rare cases on Vulkan when a shader read beyond the valid range of a vertex buffer. By @andyleiserson in #9791.
- Fix required immediate slots calculation and remove
naga::valid::FunctionInfo::immediate_slots_used. By @beicause in #9725. - Fix various deadlocks due to inconsistent ordering of lock acquisitions.
wgpuis now tested with lock rank checking (--cfg wgpu_validate_locks) in CI, which should prevent many deadlocks in the future. By @AdrianEddy in #9960, @mstampfli in #10118, and @andyleiserson in #9728 and #9479. - Fix initialization tracking for some cases of array textures, 3d textures, and depth/stencil textures with divergent usage in a render pass. By @andyleiserson in #10002 and #10060.
- Fix a spurious assertion failure in
Device::maintainwhen multiple threads race polling the same device. By @AdrianEddy in #9958. - In
Queue::submit, validate all command buffers before making any updates to the init trackers. This is not expected to affect performance or behavior when handling successful submission. By @andyleiserson in #10003. - Fixed some cases of passing object labels to platform APIs despite
InstanceFlags::DISCARD_HAL_LABELSbeing set. By @andyleiserson in #10121 and #10123. - Fix separate depth/stencil read-only state and
SYNC-HAZARD-WRITE-AFTER-WRITEVulkan validation error. By @beicause in #9763. - Clean up resources properly when
Device::newfails, to avoid a leak or panic. By @andyleiserson in #10160. - Fix
Buffer::unmapfailing withNotMappedwhen it races aBuffer::maprunning on another thread. By @AdrianEddy in #9959. - Fix pending buffer mappings incorrectly succeeding when the device is lost before they are processed. By @jinleili in #10301.
- Fix initialization tracking for
external_texturebinding points, for bothExternalTextures andTextureViews bound to them. By @ErichDonGubler in #10276 and #10366. - Fixed multiplanar textures not being zero initialized. By @inner-daemons in #9700.
- Make
TextureBlitterrespect thesample_typewhen performing downsampling. Previously,FilterMode::Nearestwas always used when copying a larger texture to a smaller one. By @DouglasDwyer in #10657. - Fixed some cases where
Adapter::get_texture_format_featuresandTextureFormat::guaranteed_format_featuresdid not match the validation applied bycreate_texture. By @andyleiserson in #10910. STORAGE_BINDINGusage is no longer allowed for multi-planar textures. It was previously accepted, but was untested, and likely broken. By @andyleiserson in #10910.- Make
wgpu-corebuild with--no-default-featuresby fixing the logic inwgpu_core::lock. By @jimblandy in #10972. - Fix
Surface::configureand dropping aSurfaceorQueueracing with queue operations on other threads, which could crash on Vulkan. By @AdrianEddy in #10675. - Fix the start state of a texture subresource that a pass uses for the first time in a command buffer that already uses other subresources of the same texture. If the pass used the subresource in two ways, the subresource began the submission in the wrong state. By @cwfitzgerald in #10212.
- Fix a panic on Metal and DX12, and a Vulkan validation error, when
set_immediateswrites past the immediate size of the current pipeline layout, including layouts with no immediates. Fix a DX12 panic when a pipeline layout has immediates that are never set. By @cwfitzgerald in #10903. - Fix a panic in indirect draw validation on the noop backend. By @cwfitzgerald in #10959.
- Fix
<pass_or_bundle>.set_bind_group(_, None, _)causing a later draw or dispatch to incorrectly validate shader requirements. By @ErichDonGubler in #11198. - Fix a bug when a pipeline layout was replaced in the same pass with a layout that had a gap. By @andyleiserson in #11203.
- Fix
multi_draw_indirectandmulti_draw_indexed_indirectwith a count of 0 doing one draw, or panicking when the offset was at the end of the buffer. By @zsh20070718 in #11235.
naga
- Fix Naga's Metal backend crashing when a storage texture was used as a function argument. By @ErichDonGubler in #9867.
- Fix panics when shader
var<immediate>size is larger than 256 bytes. By @beicause in #9725. - Replace embedded NUL characters with
?when writing debug strings to SPIR-V. By @andyleiserson in #9904. - Fix dynamic indexing of vectors in
var<immediate>in the SPIR-V backend. Non-uniform indices could read the wrong element, such as always element 0 on RADV. By @jimblandy in #9902. - Fix a panic in the SPIR-V frontend when a subgroup collective operation (e.g.
OpGroupNonUniformUMin) orOpGroupNonUniformBallotused an argument whose value needed to be spilled to a temporary variable, such as when the argument was computed inside a loop. By @nazar-pc in #9957. - Fix invalid HLSL generated for
textureSampleLevelwith non-2D textures. By @mvanhorn in #9951. - Reject WGSL unary operators applied to types that the operator does not support, such as negating a matrix. By @BenjaminBrienen in #10036.
- Reject return types on compute shader entrypoints. By @ErichDonGubler in #10026.
- Reject
@location(…)s in compute shaders. By @ErichDonGubler in #10026. - Correctly emit primitive_index for the SPIR-V backend, handling mesh and raytracing shaders. Before, you could not use primitive_index with these shader types. An enable primitive_index statement is still required in wgsl shaders, in addition to enable wgpu_mesh_shader/enable wgpu_ray_tracing_pipeline. By @JMS55 in #10153.
- Lower
@builtin(instance_index)in@any_hitand@closest_hitentry points to SPIR-V'sInstanceIdrather thanInstanceIndex, which Vulkan only permits in the vertex stage. By @JMS55 in #10154. - Prevent invalid IR from being generated when using a ray query in a loop. By @Vecvec in #9945.
- Report WGSL type mismatches in
returnstatements, function call arguments and composite constructors as WGSL errors naming both types, instead of IR validation errors that could only name the operands by handle index (such as "The `return` expression Some([1]) does not match the declared return type Some([1])"). By @emilk in #9973. - Fix
Module::doc_comments'sstruct_memberskeys being off by the number of undocumented members preceding a documented one, so doc comments on struct members were attached to the wrong member. By @atirna in #10273. - Raise a type error, rather than panic, for some cases of an invalid
selectargument type in WGSL constant evaluation. By @ErichDonGubler in #10350. - Reject unsigned integer arguments to WGSL
sign()during Naga validation instead of allowing them to reach and panic in the SPIR-V backend. By @notferdon in #10451. - Fix
signreturning unexpected values for floating-point arguments in the HLSL backend. By @ErichDonGubler in #10434. - Reject WGSL loads of structs and arrays that contain atomics, which previously caused a panic in the HLSL backend. By @drakeo338 in #10458.
- Panic when a SPIR-V's instruction's word count is greater than
u16::MAX, instead of emitting a malformed instruction. By @ErichDonGubler in #10537. - Accept a
ViewIndexinput declared as a signed integer in the SPIR-V frontend, as glslang and Slang emit it, by reading it as au32. By @VoxelBoy in #10568. - Declare
LocalInvocationIndexonly once in SPIR-V mesh shader entry points that don't takelocal_invocation_indexas an argument. Previously these shaders were invalid SPIR-V. By @apollo-2006 in #10497. - Fix the MSL backend generating wrong code for a loop's
continuingblock when it refers to a value computed by the loop body, such asloop { let cmp = a < 8; ... continuing { break if cmp; } }. The value was re-evaluated in place, reading whatever the body had left behind, and for values produced by statements (such as a function call result) the backend panicked instead. By @teoxoy in #10459. - Fix invalid MSL generated for
textureSampleGradwith 3D and cube textures, which emittedmetal::gradient2dfor every texture dimension. By @ErichDonGubler in #10573. - Fix invalid GLSL for
textureLoadwith au32level or sample index under theRestrictandReadZeroSkipWritebounds check policies. By @ilyas-mallah in #10704. - Fix
var<immediate>members being read from the wrong offsets on DX12 when a nested struct is not 16-byte aligned. By @DouglasDwyer in #10581. - Disallow usage of
ray_queryas a binding. By @szymros in #10832. - Fix
@builtin(position).win fragment shaders on DX12. The HLSL backend now provides 1/w of the clip-space position, as WGSL specifies and the other backends already do, instead of w. By @abdymazhit in #10733. - Generate correct SPIR-V for nested structs containing two-row matrices. By @jimblandy in #10846.
- Fix GLSL output for WGSL vector
selectwith integer or boolean values on WebGL 2 and older OpenGL. By @arcusbuilds in #10457. - Fix
rayQueryGenerateIntersectionin the SPIR-V backend dropping nearer hits once a hit had been committed, which kept the first generated hit instead of the nearest. By @DouglasDwyer in #10698. - Fix ambiguous
metal::selectcalls in the Metal backend's division/remainder zero guards for 64-bit integers: the guards now emitL/uLsuffixed literals (e.g.metal::select(rhs, 1uL, rhs == 0uL)) so MSL generated fori64/u64/and%compiles. By @Statesman-forge in #10278. - In the MSL backend,
subgroupBallotnow keeps lanes 32-63, which were lost on GPUs with 64-wide SIMD groups (AMD GPUs on macOS). By @ErkoRisthein in #10797. - Fix a panic in the HLSL backend when an unsized
binding_array<T>global has nobinding_array_sizein its bind target; it is now written as an unbounded[]array. By @arcusbuilds in #10343. - Report a WGSL error instead of panicking when the condition of a
const_assertis a composite value, such asconst_assert(vec2i());. By @MilosLord in #10897. - Fix WGSL
continuingblocks falsely rejecting declarations that shadow variables from the loop body (e.g.,loop { let x = a; continuing { let x = b; } }) as redefinitions. By @ekarad1um in #10980. - Reject
f64arguments to the trigonometric, exponential and logarithmic built-in functions (sin,atan2,radians,exp,log,powand others) during Naga validation (invalid SPIR-V and GLSL). By @cdeil in #11039. - Reject WGSL array value constructors with more than 2047 elements, as required by the WGSL specification. By @sagudev in #10891.
- Fix the HLSL backend adding the draw's first instance or first vertex twice to
@builtin(instance_index)and@builtin(vertex_index)values copied into alet, and not at all when a struct holding them is passed to a function. By @MikeGrier in #11090. - In the MSL backend, fix generated code for
bitcastof a packedvec3struct field. By @IsseW in #10961. - Fixed invalid HLSL due to duplicate function definitions when performing image queries on multiple storage textures differing only in access mode. By @andyleiserson in #11040.
- Fix
rayQueryGenerateIntersectionin the WGSL frontend not emitting itshit_targument before the statement that uses it, which made modules fail validation ifhit_twas an expression such as a struct member access. By @DouglasDwyer in #10694.
Validation
- Validate that the arguments are within the indirect buffer when encoding an indirect draw to a render bundle. Moves some indirect draw errors from
RenderPassErrorInnertoRenderCommandError. By @andyleiserson in #9871. - Reject texture views with
TextureAspect::Allon multi-planar textures. By @inner-daemons in #9703. - When creating render pipelines, validate that a corresponding shader output is present for each color attachment with non-zero write mask, and that shader output includes alpha when the blend operation uses source alpha. By @andyleiserson in #9939.
- Reject bind group layout entries with
TASKorMESHvisibility unlessFeatures::EXPERIMENTAL_MESH_SHADERis enabled. By @teoxoy in #10042. - Reject bind group layout entries with
RAY_GENERATION,ANY_HIT,CLOSEST_HIT, orMISSvisibility unlessFeatures::EXPERIMENTAL_RAY_TRACING_PIPELINESis enabled. By @teoxoy in #10042. - Numeric types must now match exactly on inter-stage interfaces. Previously, the receiving type was only required to be a subtype of the originating type. By @andyleiserson in #9999.
- Relaxed requirement that the pipeline scalar type for a color output be at least as wide as the shader output type. Now, only the scalar kind must match. By @andyleiserson in #9999.
- Report an accurate validation error when a passthrough shader module has no entry points. By @ksh368-bit in #10079.
- Disallow array types in
var<immediate>. By @beicause in #10081. - Mesh shader draws in a multiview render pass now require the highest view in the multiview mask to be less than
Limits::max_mesh_multiview_view_count. Previously one view past the limit was accepted. By @apollo-2006 in #10496. wgpu_corenow validates pipeline stage interfaces after pipeline constant values have been applied, per spec. For example, workgroup sizes set by overrides are now checked against device limits. By @jimblandy in #10430.- Validate
Limits::max_compute_workgroup_storage_size. By @ErichDonGubler in #9732.
DX12
- Load
CreateDXGIFactory1fromdxgi.dllat runtime for the display HDR query, instead of linking to it. By @teoxoy in #9832. - Make sure padding bytes are 0 in the destination buffer after a
copy_texture_to_bufferwhenUnrestrictedBufferTextureCopyPitchSupportedis not available. By @teoxoy in #10005. - Sanitize shader labels before passing them to DXC as the source name. Fixes compilation when label contains a
:. By @lucasmerlin in #10134. - Add the missing UAV barrier for acceleration structure scratch buffers. By @Vecvec in #10798.
- Fix a use-after-free when several threads create pipelines from the same shader with FXC. The shader cache now holds copies of the bytecode, not FXC's blobs, whose reference count is not thread-safe. By @xorza in #10805.
- Fix a 1 second stall in
Surface::get_current_textureafter a surface texture was dropped without being presented. By @DouglasDwyer in #10511. - Present with
DXGI_PRESENT_RESTARTthe first time after a swapchain is created or resized, discarding queued frames of the old size that DWM would otherwise show stretched while the window is being resized. By @DouglasDwyer in #10548. - Fix 64-bit integer literal truncation and comparisons against zero in DX12 shaders compiled with DXC. By @pbkx in #10585.
- Free the intermediate buffers of unaligned buffer/texture copies through the memory allocator. They were dropped without it, so their heap space stayed in use until the device was destroyed. By @fxOne in #11069.
Vulkan
- Return an error instead of panicking when Vulkan surface creation fails, such as when creating a second surface for the same Android view. By @antonWetzel in #9806.
- Use the imported queue family's supported shader stages when building buffer, texture, and acceleration structure barriers for raw Vulkan devices. By @ruihe774 in #9594.
- Use the queue family index from
queue_create_infosafter the Vulkan device creation callback changes it. By @andyleiserson in #9965. - Fix false out-of-memory errors when creating textures with transient attachment usage on some Vulkan drivers, such as MoltenVK. By @andyleiserson in #9838.
- Fix
HalCounters::texturesdrifting negative:create_texturenever incremented it whiledestroy_texturealways decremented it. By @dustyleary in #10022. - Fix crash on older Vulkan drivers when
poolSizeCount == 0. By @lucasmerlin in #10124. - Request
VK_KHR_spirv_1_4and raise the generated SPIR-V version to 1.4 whenEXPERIMENTAL_RAY_TRACING_PIPELINESorEXPERIMENTAL_MESH_SHADERis enabled on a pre-Vulkan-1.2 device. BothSPV_KHR_ray_tracingandSPV_EXT_mesh_shaderrequire SPIR-V 1.4, but shaders were generated as 1.3 there: ray tracing pipelines requested neither the extension nor the version, and mesh shaders requested the extension without raising the version. Naga now rejects ray tracing pipeline shaders targeting below SPIR-V 1.4, as it already did for mesh shaders. By @JMS55 in #10193. - Fix feature detection for Robust Image Access when
VK_EXT_robustness2is present but reports no support for Robust Image Access 2, fixing a shader compilation crash on some Mali drivers. By @raphlinus in #10291. - Fixed a panic on the Vulkan backend when dropping a surface whose acquired texture was still alive (e.g. after
presentfailed due to a lost device). By @MarcelStruckWO in #10230. - Fix
VUID-VkImageViewCreateInfo-image-04441validation errors when creating a view of a texture whose only usages areCOPY_SRCand/orCOPY_DST. By @MannXo in #10245. - Recover from
VK_ERROR_FRAGMENTED_POOLandVK_ERROR_OUT_OF_POOL_MEMORYwhen allocating descriptor sets by resetting or retiring the offending pool and retrying on the next available (or a freshly created) pool instead of panicking. By @beicause in #10264. - Don't use timeline semaphores on VeriSilicon's proprietary driver, as on NXP's i.MX 8 SoCs, which crashes in
vkQueueSubmitwith them. wgpu falls back to binary fences there. By @tronical in #10535. - Enable the
depthBiasClampdevice feature when it is supported. Pipelines with a non-zeroDepthBiasState::clamppreviously failed Vulkan validation. By @VoxelBoy in #10566. - On Windows, only wait for the swapchain acquire fence in
FifoandFifoRelaxedpresent modes. It added acquire latency inImmediateandMailbox. By @HashimTheArab in #10714. - Polyfill workgroup zero init in mesh and task shaders on AMD's proprietary driver, which fails with
VK_ERROR_INITIALIZATION_FAILEDwhen they useOpVariableinitializers. By @apollo-2006 in #10692. - Fix a crash in
vkQueueSubmiton Imagination's proprietary driver and on the Android 16 emulator by passing a timeline value for every semaphore whenever a submission uses timeline semaphore values. By @laurenz-canva in #10677. - Fix a fence data race between submitting and polling on devices without timeline semaphores. By @JasperDeSutter in #10960.
- Don't use timeline semaphores on Arm's proprietary Mali driver, which keeps memory for every value a timeline semaphore is signaled with until the semaphore is destroyed. Because wgpu signals one timeline semaphore per submission, long-running applications eventually lose the device (after ~4.2 million submissions on a Mali-G610 with driver
g18p0). wgpu falls back to binary fences on Arm drivers older thanr46and Rockchip drivers older thang24. By @tadeohepperle in #10840. - Fix pass timestamp queries on Vulkan sometimes reporting a duration of almost zero for a render or compute pass, when the GPU was busy with other work. By @kikijiki in #10837.
- Don't use timeline semaphores on Imagination's proprietary driver, as on TI's AM62P, where
Device::pollwithPollType::Waitand no timeout sometimes failed withPollError::Timeout. wgpu falls back to binary fences there. By @tronical in #10992.
Metal
- Report
SurfaceColorSpace::ExtendedDisplayP3only on macOS 11.0+ and iOS 14.0+, where it is available. By @stuartparmenter in #9833. - Fix bind group resources for the task, mesh, fragment, and compute shader stages being bound from the wrong offsets whenever a bind group contained resources visible to the task or mesh stages, which could bind the wrong buffer, texture, or sampler to a shader slot. By @teoxoy in #10043.
- Fix
max_task_workgroup_countbeing misreported on pre-Apple7 devices. By @inner-daemons in #10065. - Fix a crash when creating a declared alternate sRGB view of a render-attachment-only surface with Metal API Validation enabled. By @jinleili in #10280.
- Report an error instead of panicking when Metal declines to create a texture view, which can occur for some views of textures with
TRANSIENT_ATTACHMENTusage. By @matthargett in #10145. - Fix a crash in
Surface::configureon iOS below 16.wantsExtendedDynamicRangeContentis iOS 16+ and is now only called there. By @VladasZ in #10257. - Cap
max_storage_buffer_binding_sizetou32::MAX - 4again. By @nuri-yoo in #10306. - Report
DownlevelFlags::INDIRECT_EXECUTIONand a 256-bytemin_uniform_buffer_offset_alignmenton the iOS Simulator (target_abi = "sim"). The Simulator advertises only the Apple2 GPU family but executes indirect draw/dispatch on the host GPU, so compute renderers such as vello previously failed with "Downlevel flags DownlevelFlags(INDIRECT_EXECUTION) are required but not supported". Note that Metal API Validation still rejects indirect commands there. By @edTheGuy00 in #10189. - Compile Metal passthrough shaders with the detected Metal Shading Language version. Before, they used the system default version and could fail to compile. By @acshi in #10574.
- To avoid rendering failures in new windows (see #9430), do not return
SurfaceStatus::OccludedfromSurface::get_current_texturewhen it is called for a window that hasn't been visible yet. By @tronical in #10302. - Advertise
TEXTURE_INT64_ATOMICand R64Uint storage atomics on Apple8+Mac2 devices with MSL 3.1, restoring support for 64-bit texture atomic min/max on M2 Macs. By @urothis in #10604. - Fix the Metal fence value sometimes going backwards and
waitsometimes reporting a lost device. By @uael in #10570. - Skip the render ICB probe on Macs with Tier 1 argument buffers, such as Haswell and Broadwell Intel GPUs. Compiling its kernel crashed the Metal shader compiler, which stalled device creation for about 10 seconds. By @ErkoRisthein in #10927.
- Fix
AccelerationStructureGeometryFlags::NO_DUPLICATE_ANY_HIT_INVOCATIONbeing ignored when building BLASes on Metal. By @JMS55 in #11168.
GLES
- Fixed signed integer
%(and%=) returning the wrong result for negative operands in the GLSL (OpenGL/GLES) backend, e.g.-1 % 768yielding255instead of-1. GLSL's%is undefined when either operand is negative, so signed remainder is now lowered asa - b * (a / b), matching the SPIR-V, HLSL, and Metal backends. By @mstampfli in #9687. - Fix negative argument for
atomicSubyielding incorrect GLSL. By @ErichDonGubler in #9924. - Avoid duplicate
EGL_SURFACE_TYPEattributes when selecting an EGL framebuffer configuration, which caused Mesa to return no matching configurations. By @BlueJayLouche and @scroix in #10048. @interpolate(linear)is now rejected byDevice::create_shader_moduleon adapters that lackDownlevelFlags::LINEAR_INTERPOLATION(GLES/WebGL2), with a shader label and a source span. Previously such a shader validated fine and then failed at pipeline creation withThe selected version doesn't support Features(NOPERSPECTIVE_QUALIFIER). By @emilk in #9972.- Fixed
copy_texture_to_texture()copying only the first depth slice when the copy extent had a depth greater than 1, so copies between 3D textures silently lost every slice after the first. Copies with a nonzero source z also read the wrong slice. By @AlexEgger2Build in #10004. - Fix black EGL surfaces on some platforms by selecting the default framebuffer's color buffer before presentation. By @valadaptive in #10268.
- Enable
TEXTURE_CUBE_MAP_SEAMLESSon desktop OpenGL so cube maps sample seamlessly across face edges, matching OpenGL ES 3.0+, WebGL 2, Vulkan, Metal, and Direct3D 12. By @kuntal-devrat in #10628. - Set a sampler's maximum anisotropy with
glSamplerParameterfinstead ofglSamplerParameteri. Chromium's validating command decoder, which Android WebView still uses, rejects the integer call withGL_INVALID_ENUM, so anisotropic filtering was silently disabled under WebGL2 there. By @Jaltaire in #10874. - Fix invalid GLSL ES output for fragment shaders that use
@invariant @builtin(position)on native OpenGL ES. By @jonatino in #10229. - Fix OpenGL initialization failures on Windows under Parallels by explicitly requesting the highest supported core version (4.6 down to 3.3) and retrying initial context creation once on failure. By @jimm98y in #10554.
- Prevent WGL applications on Windows from becoming unresponsive during input language changes. By @acarl005 in #10505.
- Fix incomplete framebuffer errors on the Android Emulator after a multisampled render pass. By @shtse8 in #10866.
WebGPU
- Recognize
GPUInternalErrorwhen converting a WebGPU error, mapping it toError::Internalinstead of panicking with "Unexpected error". By @evilpies in #9919. - Fix
pop_error_scopepanics when it returnsnull. By @beicause in #10039. - Fix
Device::on_uncaptured_errornever firing in browsers that do not implementGPUDevice.onuncapturederror, such as Safari, by listening for theuncapturederrorevent instead of assigning to that attribute. By @zemse in #10270. - Pass
RenderPassColorAttachment::depth_sliceto the browser, so a render pass into a 3D texture no longer fails validation with "depthSlice is required for a 3D attachment". By @jheising in #10693.
Performance
General
Queue::submitvalidation and tracking of built TLASes now scale with the number of unique BLASes instead of the number of instances. By @AntonWagnerCau in #9835.- Added explicit
SendandSyncimplementations to keywgputypes so that the compiler can do less work checking those bounds. If you previously added a#![recursion_limit = ...]attribute to your crate due to overflow errors involvingwgputypes, you may now be able to remove it. By @kpreid in #10177. Queue::write_buffer,Queue::write_textureand buffer unmaps no longer record a separate barrier before each copy. The transitions for a whole batch of queue writes are now coalesced into a single barrier recorded ahead of the batch's copies, so a frame that updates N buffers costs one barrier instead of N. By @JMS55 in #10319.
naga
- Reduce HLSL compute shader compilation time for large workgroup arrays by initializing their elements with loops distributed across workgroup invocations. By @DonutShinobu in #10314.
Metal
- A render pipeline switch no longer allocates once per vertex buffer. By @samoylenkodmitry in #10630.
GLES
Queue::submitno longer resets GL state for command buffers that record no commands (e.g. the internal transit and pre-pass encoders), removing two full reset sequences (about 20 GL calls) per frame for a typical single-pass WebGL2 renderer. By @chinqan in #10913.
WebGPU
- Cache adapter and device limits, features, and adapter info on the browser WebGPU backend, so repeated calls no longer re-read those JavaScript objects. By @apetrock in #10513.
Documentation
General
- Fix the
BlasAabbGeometrydocs to refer to thestridefield instead of a nonexistentsize.stride, and document the packed AABB buffer layout (each primitive a minimum then a maximum corner, two consecutivevec3<f32>). By @mstampfli in #9934. - The wiki and API specification pages are now documentation modules under
wgpu::documentation. By @cwfitzgerald in #9779. - Fix stale
poll()docs that described a boolean return value instead ofPollStatus/PollError. By @helgev-in-arcana in #10151.
Dependency Updates
General
- Raise the minimum version of the
wasm-bindgenfamily to the earliest releases that support wasm64. By @nickbabcock in #9836.
GLES
- Update
glowto 0.18 for wasm64 support. By @nickbabcock in #9836.
deno_webgpu
GPUTextureDescriptoracceptstextureBindingViewDimension. By @alextechcc in #8014.