Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
README.md | 2025-07-10 | 14.2 kB | |
v26.0.0 source code.tar.gz | 2025-07-10 | 13.3 MB | |
v26.0.0 source code.zip | 2025-07-10 | 14.2 MB | |
Totals: 3 Items | 27.6 MB | 0 |
Major Features
New method TextureView::texture
You can now call texture_view.texture()
to get access to the texture that a given texture view points to.
By @cwfitzgerald and @Wumpf in #7907.
as_hal
calls now return guards instead of using callbacks.
Previously, if you wanted to get access to the wgpu-hal or underlying api types, you would call as_hal
and get the hal type as a callback. Now the function returns a guard which dereferences to the hal type.
:::diff
- device.as_hal::<hal::api::Vulkan>(|hal_device| {...});
+ let hal_device: impl Deref<Item = hal::vulkan::Device> = device.as_hal::<hal::api::Vulkan>();
By @cwfitzgerald in #7863.
Enabling Vulkan Features/Extensions
For those who are doing vulkan/wgpu interop or passthrough and need to enable features/extensions that wgpu does not expose, there is a new wgpu_hal::vulkan::Adapter::open_with_callback
that allows the user to modify the pnext chains and extension lists populated by wgpu before we create a vulkan device. This should vastly simplify the experience, as previously you needed to create a device yourself.
Underlying api interop is a quickly evolving space, so we welcome all feedback!
:::rust
type VkApi = wgpu::hal::api::Vulkan;
let adapter: wgpu::Adapter = ...;
let mut buffer_device_address_create_info = ash::vk::PhysicalDeviceBufferDeviceAddressFeatures { .. };
let hal_device: wgpu::hal::OpenDevice<VkApi> = adapter
.as_hal::<VkApi>()
.unwrap()
.open_with_callback(
wgpu::Features::empty(),
&wgpu::MemoryHints::Performance,
Some(Box::new(|args| {
// Add the buffer device address extension.
args.extensions.push(ash::khr::buffer_device_address::NAME);
// Extend the create info with the buffer device address create info.
*args.create_info = args
.create_info
.push_next(&mut buffer_device_address_create_info);
// We also have access to the queue create infos if we need them.
let _ = args.queue_create_infos;
})),
)
.unwrap();
let (device, queue) = adapter
.create_device_from_hal(hal_device, &wgpu::DeviceDescriptor { .. })
.unwrap();
More examples of this kind of interop will come soon.
By @Vecvec in #7829.
Naga
- Added
no_std
support with default features disabled. By @Bushrat011899 in #7585. - [wgsl-in,ir] Add support for parsing rust-style doc comments via
naga::front::glsl::Frontend::new_with_options
. By @Vrixyz in #6364. - When emitting GLSL, Uniform and Storage Buffer memory layouts are now emitted even if no explicit binding is given. By @cloone8 in #7579.
- Diagnostic rendering methods (i.e.,
naga::{front::wgsl::ParseError,WithSpan}::emit_error_to_string_with_path
) now accept more types for theirpath
argument via a new sealedAsDiagnosticFilePath
trait. By @atlv24, @bushrat011899, and @ErichDonGubler in #7643. - Add support for quad operations (requires
SUBGROUP
feature to be enabled). By @dzamkov and @valaphee in #7683. - Add support for
atomicCompareExchangeWeak
in HLSL and GLSL backends. By @cryvosh in #7658
General
- Add support for astc-sliced-3d feature. By @mehmetoguzderin in #7577
- Added
wgpu_hal::dx12::Adapter::as_raw()
. By @tronical in ##7852 - Add support for rendering to slices of 3D texture views and single layered 2D-Array texture views (this requires
VK_KHR_maintenance1
which should be widely available on newer drivers). By @teoxoy in #7596 - Add extra acceleration structure vertex formats. By @Vecvec in #7580.
- Add acceleration structure limits. By @Vecvec in #7845.
- Add support for clip-distances feature for Vulkan and GL backends. By @dzamkov in #7730
- Added
wgpu_types::error::{ErrorType, WebGpuError}
for classification of errors according to WebGPU's [GPUError
]'s classification scheme, and implementWebGpuError
for existing errors. This allows users ofwgpu-core
to offload error classification onto the WGPU ecosystem, rather than having to do it themselves without sufficient information. By @ErichDonGubler in #6547.
Bug Fixes
General
- Fix error message for sampler array limit. By @LPGhatguy in #7704.
- Fix bug where using
BufferSlice::get_mapped_range_as_array_buffer()
on a buffer would prevent you from ever unmapping it. Note that this API has changed and is nowBufferView::as_uint8array()
.
Naga
- Naga now infers the correct binding layout when a resource appears only in an assignment to
_
. By @andyleiserson in #7540. - Implement
dot4U8Packed
anddot4I8Packed
for all backends, using specialized intrinsics on SPIR-V, HSLS, and Metal if available, and polyfills everywhere else. By @robamler in #7494, #7574, and #7653. - Add polyfilled
pack4x{I,U}8Clamped
built-ins to all backends and WGSL frontend. By @ErichDonGubler in #7546. - Allow textureLoad's sample index arg to be unsigned. By @jimblandy in #7625.
- Properly convert arguments to atomic operations. By @jimblandy in #7573.
- Apply necessary automatic conversions to the
value
argument oftextureStore
. By @jimblandy in #7567. - Properly apply WGSL's automatic conversions to the arguments to texture sampling functions. By @jimblandy in #7548.
- Properly evaluate
abs(most negative abstract int)
. By @jimblandy in #7507. - Generate vectorized code for
[un]pack4x{I,U}8[Clamp]
on SPIR-V and MSL 2.1+. By @robamler in #7664. - Fix typing for
select
, which had issues particularly with a lack of automatic type conversion. By @ErichDonGubler in #7572. - Allow scalars as the first argument of the
distance
built-in function. By @bernhl in #7530. - Don't panic when handling
f16
for pipeline constants, i.e.,override
s in WGSL. By @ErichDonGubler in #7801. - Prevent aliased ray queries crashing naga when writing SPIR-V out. By @Vecvec in #7759.
DX12
- Get
vertex_index
&instance_index
builtins working for indirect draws. By @teoxoy in #7535
Vulkan
- Fix OpenBSD compilation of
wgpu_hal::vulkan::drm
. By @ErichDonGubler in #7810. - Fix warnings for unrecognized present mode. By @Wumpf in #7850.
Metal
- Remove extraneous main thread warning in
fn surface_capabilities()
. By @jamesordner in #7692
WebGPU
- Fix setting unclipped_depth. By @atlv24 in #7841
- Implement
on_submitted_work_done
for WebGPU backend. By @drewcrawford in #7864
Changes
- Loosen Viewport validation requirements to match the new specs. By @ebbdrop in #7564
wgpu
anddeno_webgpu
now usewgpu-types::error::WebGpuError
to classify errors. Any changes here are likely to be regressions; please report them if you find them! By @ErichDonGubler in #6547.
General
- Support BLAS compaction in wgpu. By @Vecvec in #7285.
- Removed
MaintainBase
in favor of usingPollType
. By @waywardmonkeys in #7508. - The
destroy
functions for buffers and textures in wgpu-core are now infallible. Previously, they returned an error if called multiple times for the same object. This only affects the wgpu-core API; the wgpu API already allowed multipledestroy
calls. By @andyleiserson in #7686 and #7720. - Remove
CommandEncoder::build_acceleration_structures_unsafe_tlas
in favour ofas_hal
and apply simplifications allowed by this. By @Vecvec in #7513 - The type of the
size
parameter tocopy_buffer_to_buffer
has changed fromBufferAddress
toimpl Into<Option<BufferAddress>>
. This achieves the spec-defined behavior of the value being optional, while still accepting existing calls without changes. By @andyleiserson in #7659. - To bring wgpu's error reporting into compliance with the WebGPU specification, the error type returned from some functions has changed, and some errors may be raised at a different time than they were previously.
- The error type returned by many methods on
CommandEncoder
,RenderPassEncoder
,ComputePassEncoder
, andRenderBundleEncoder
has changed toEncoderStateError
orPassStateError
. These functions will return theEnded
variant of these errors if called on an encoder that is no longer active. Reporting of all other errors is deferred until a call tofinish()
. - Variants holding a
CommandEncoderError
in the error enumsClearError
,ComputePassErrorInner
,QueryError
, andRenderPassErrorInner
have been replaced with variants holding anEncoderStateError
. - The definition of
enum CommandEncoderError
has changed significantly, to reflect which errors can be raised byCommandEncoder.finish()
. There are also some errors that no longer appear directly inCommandEncoderError
, and instead appear nested within theRenderPass
orComputePass
variants. CopyError
has been removed. Errors that were previously aCopyError
are now aCommandEncoderError
returned byfinish()
. (The detailed reasons for copies to fail were and still are described byTransferError
, which was previously a variant ofCopyError
, and is now a variant ofCommandEncoderError
).
Naga
- Mark
readonly_and_readwrite_storage_textures
&packed_4x8_integer_dot_product
language extensions as implemented. By @teoxoy in #7543 naga::back::hlsl::Writer::new
has a newpipeline_options
argument.hlsl::PipelineOptions::default()
can be passed as a default. Theshader_stage
andentry_point
members ofpipeline_options
can be used to write only a single entry point when using the HLSL and MSL backends (GLSL and SPIR-V already had this functionality). The Metal and DX12 HALs now write only a single entry point when loading shaders. By @andyleiserson in #7626.- Implemented
early_depth_test
for SPIR-V backend, enablingSHADER_EARLY_DEPTH_TEST
for Vulkan. Additionally, fixed conservative depth optimizations when usingearly_depth_test
. The syntax for forcing early depth tests is now@early_depth_test(force)
instead of@early_depth_test
. By @dzamkov in #7676. ImplementedLanguageExtension::VARIANTS
is now implemented manually rather than derived usingstrum
(allowingstrum
to become a dev-only dependency) so it is no longer a member of thestrum::VARIANTS
trait. Unless you are using this trait as a bound this should have no effect.- Compaction changes, by @andyleiserson in #7703:
process_overrides
now compacts the module to remove unused items. It is no longer necessary to supply values for overrides that are not used by the active entry point.- The
compact
Cargo feature has been removed. It is no longer possible to exclude compaction support from the build. compact
now has an additional argument that specifies whether to remove unused functions, globals, and named types and overrides. For the previous behavior, passKeepUnused::Yes
.
D3D12
- Remove the need for dxil.dll. By @teoxoy in #7566
- Ability to get the raw
IDXGIFactory4
fromInstance
. By @MendyBerger in #7827
Vulkan
- Use highest SPIR-V version supported by Vulkan API version. By @robamler in #7595
HAL
- Added initial
no_std
support towgpu-hal
. By @bushrat011899 in #7599
Documentation
General
- Remove outdated information about
Adapter::request_device
. By @tesselode in #7768