1327 Commits

Author SHA1 Message Date
Andy Leiserson
dc924bc715 Remove unsafe from hal::BufferBinding::new_unchecked 2025-07-10 09:52:20 -07:00
Andy Leiserson
468632f207 Restore plumbing of implicit remainder-of-buffer size to backends 2025-07-10 09:52:20 -07:00
Andy Leiserson
27e7408f16 Restore the buffer size changes 2025-07-10 09:52:20 -07:00
Andy Leiserson
9834d9a446 Revert "Validate binding ranges against buffer size"
This reverts commit ef428fcab8059e898b42542b6445bd94a9683e69.
2025-07-09 16:29:41 -04:00
Andy Leiserson
b0527800a1 Revert "Restore unintentional support for zero-size buffers"
This reverts commit c0a580d6f0343a725b3defa8be4fdf0a9691eaad.
2025-07-09 16:29:41 -04:00
SupaMaggie70Incorporated
18691f5730
Rework of wgpu_hal vulkan buffer importing (#7824)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-07-09 15:19:37 -04:00
Andy Leiserson
c0a580d6f0 Restore unintentional support for zero-size buffers 2025-07-08 14:45:12 -07:00
Andy Leiserson
ef428fcab8 Validate binding ranges against buffer size 2025-07-08 14:45:12 -07:00
teoxoy
e10e17907f remove DeviceError::ResourceCreationFailed 2025-07-02 11:11:37 +02:00
Andy Leiserson
768d5f4879
[metal] Increase MAX_COMMAND_BUFFERS (#7858) 2025-06-27 14:18:40 -04:00
Zachary Harrold
4c39227510
Allow Naga spv-in and spv-out in no_std (#7760)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-26 16:45:47 -04:00
Vecvec
0d61648eeb
Allow enabling additional vulkan extensions in Adapter::open and Instance::init (#7829)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-26 20:39:41 +00:00
Simon Hausmann
208fe4c23d
Expose the DxgiAdapter in the Hal adapter (#7852) 2025-06-26 16:34:59 -04:00
Andreas Reich
12808193fe
Fix warnings for unrecognized Vulkan present mode (#7850) 2025-06-26 09:33:20 -04:00
Zachary Harrold
995efddc62
Fix portable-atomic on wgpu-hal (#7735) 2025-06-26 08:48:41 +02:00
SupaMaggie70Incorporated
e40e66d205
DXIL & HLSL passthrough (#7831)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-25 18:12:58 -04:00
Mendy Berger
4c08c37a46
Expose raw_factory (#7827)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-25 19:43:23 +00:00
Vecvec
dc0d457a9a
Add limits for acceleration structures (#7845) 2025-06-25 14:49:55 -04:00
Erich Gubler
9d14871f01
Fix OpenBSD compilation of wgpu_hal::vulkan::drm (#7810) 2025-06-25 18:02:35 +00:00
Andy Leiserson
402a479027
[metal] Retain references with command buffers (#7842) 2025-06-25 11:40:25 -04:00
Jamie Nicol
8cdbcc1755 Add ExternalTexture BindingType behind new Feature flag
Adds a new feature flag, `EXTERNAL_TEXTURE`, indicating device support
for our implementation of WebGPU's `GPUExternalTexture` [1] which will
land in upcoming patches. Conceptually this would make more sense as a
downlevel flag, as it is a core part of the WebGPU spec which we do not
yet support. We do not want, however, to cause applications to reject
adapters because we have not finished implementing this, so for now we
are making it an opt-in feature.

As an initial step towards supporting this feature, this patch adds a
new `BindingType` corresponding to WebGPU's
`GPUExternalTextureBindingLayout` [2]. This binding type dictates that
when creating a bind group the corresponding entry must be either an
external texture or a texture view with certain additional requirements
[3].

As of yet wgpu has no concept of an external texture (that will follow
in later patches) but for now this patch ensures that texture views
corresponding to an external texture binding type are validated
correctly. Note that as the feature flag is not yet supported on any
real backends, bind group layout creation will fail before getting the
chance to attempt to create a bind group. But in the added tests using
the noop backend we can see this validation taking place.

[1] https://www.w3.org/TR/webgpu/#gpuexternaltexture
[1] https://www.w3.org/TR/webgpu/#dictdef-gpuexternaltexturebindinglayout
[2] https://gpuweb.github.io/gpuweb/#bind-group-creation
2025-06-17 15:00:29 -07:00
Jamie Nicol
ad4286102a [dx12] Return OOM error when GetResourceAllocationInfo() returns SizeInBytes == 0
Some versions of WARP return an allocation info with SizeInBytes == 0
for very large allocations. Proceeding to attempt to allocate a zero-
sized resource results in a device lost error. It's preferable to
instead return an out of memory error.
2025-06-17 09:14:44 -04:00
Dmitry Zamkov
bbb7cc79ef
Implement clip-distances extension for GL and Vulkan backends (#7730)
* Basic implementation of `clip_distances` for Vulkan and GL backends

* Added GPU test for `clip-distances`

* Update feature array size

* Add changelog entry

* Validate `clip_distances` array size

* Check for `clip_distances` enable directive

* Consolidate code for generating `enable` directives in WGSL backend and add `clip_distances`.
2025-06-16 10:33:31 +02:00
Xiaopeng Li
65337894f6
Fix texture_from_d3d11_shared_handle compatibility on AMD/Nvidia GPUs (#7782)
* wrapper dedicated allocate info

* comment on why p_next is set manually
2025-06-13 14:48:56 -04:00
Andy Leiserson
82fa8e2a94 [naga] Remove non-essential override references via compaction
Adds a mode to compaction that removes unused functions, global
variables, and named types and overrides. This mode is used
everywhere except the compaction at the end of lowering, where
it is important to preserve unused items for type checking and
other validation of the module.

Pruning all but the active entry point and then compacting makes
`process_overrides` tolerant of missing values for overrides that are
not used by the active entry point.

Fixes #5885
2025-06-12 14:22:18 +09:00
Vecvec
efbac5dfba
Add extra acceleration structure vertex formats. (#7580) 2025-06-11 18:17:14 -04:00
Jim Blandy
41616d9ddf
wgpu_hal::vulkan: Introduce SemaphoreList helper type. (#7749) 2025-06-11 21:01:57 +00:00
Teodor Tanasoaia
e10bceb1dc
[d3d12] increase max_compute_workgroup_storage_size (#7777) 2025-06-09 22:37:07 +02:00
Teodor Tanasoaia
dcada3d858
[d3d12] add a shader cache to avoid calling into DXC/FXC (#7729) 2025-06-05 15:20:51 +02:00
Connor Fitzgerald
24752af93a Suppress VUID-StandaloneSpirv-None-10684 2025-06-04 08:26:11 -07:00
James Ordner
921c6ab597
[metal] remove extraneous main thread check (#7692) 2025-06-02 11:19:49 +02:00
Doublonmousse
1da7cd4811
External gles framebuffer (#7671) 2025-05-30 19:16:47 +00:00
Hubert Głuchowski
a9e04f88af
wgpu-hal: Expose vulkan::PhysicalDeviceFeatures (#7682) 2025-05-30 12:32:24 -04:00
Zachary Harrold
6151330e3a
[wgpu-hal]: MVP no_std support (#7599)
* MVP `no_std` support in `wgpu-hal`

* Update CHANGELOG.md

* Fix visibility

* Fix unused imports

* Response to feedback

Co-Authored-By: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* Update other `validation_canary` usages

Co-Authored-By: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-05-30 12:31:44 -04:00
RedMindZ
d190106c3f
Load FXC dynamically to remove the dependency on d3dcompiler_47.dll (#7588) 2025-05-29 18:41:03 -04:00
Zachary Harrold
97794f12a9
[wgpu-hal]: Reduce std usage in wgpu-hal/gles (#7597) 2025-05-29 18:30:14 -04:00
Raphael Hetzel
0d569d5550
Optional web-specific deps for wasm32 (#7565) 2025-05-29 22:26:01 +00:00
Dmitry Zamkov
9c023e5e29
Implement subgroup quad ops (#7683)
* Rudimentary impl of quad ops, impl quad ops for spirv

* Impl quad swap for hlsl, msl and wgsl, finish spv front

* Cargo clippy & cargo fmt, impl valid for quad ops

* Enable quad feature

* Add missing feature to glsl

* Simplifying code by making `SubgroupQuadSwap` an instance of `SubgroupGather`

* Add `GroupNonUniformQuad` spv capability to Vulkan

* Adding GPU tests for quad operations

* Validate that broadcast operations use const invocation ids

* Added changelog entry

---------

Co-authored-by: valaphee <32491319+valaphee@users.noreply.github.com>
2025-05-26 09:32:01 +02:00
Andy Leiserson
24d0eae36c
Remove another type of error that could be raised by destroy (#7720) 2025-05-24 17:02:00 +02:00
Dmitry Zamkov
44957709ff
Vulkan support for SHADER_EARLY_DEPTH_TEST and fix to conservative depth optimizations (#7676)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-05-24 09:52:39 +00:00
Robert Bamler
ff291654b3 [wgpu-hal] Add PrivateCapabilities::shader_int8 on Vulkan
This allows declaring the SPIR-V capability "Int8", which allows us to
generate faster code for `[un]pack4x{I, U}8[Clamp]`.
2025-05-23 16:08:26 +02:00
Robert Bamler
e636696e16 [wgpu-hal] separate 2 float16-related vk features
Separates the Vulkan feature sets
`VkPhysicalDeviceShaderFloat16Int8Features` and
`VkPhysicalDevice16BitStorageFeatures`, which previously were used
"together, or not at all".

This commit should not change any behavior yet, but I'd like to run full
CI tests on it for now. If the CI tests pass, I'll use this separation
to enable the `shader_int8` feature separately from the rest of the
features to enable optimizations of `[un]pack4x{I,U}8[Clamp]` on SPIR-V.
2025-05-23 16:08:26 +02:00
Mehmet Oguz Derin
2a62299a84
Support Sliced 3D for ASTC (#7577)
Enables "texture-compression-astc-sliced-3d" for backends that support ASTC (such as excluding D3D12).
2025-05-04 12:48:16 +02:00
Robert Bamler
0d06284d96
Allow wgpu-core to use new naga optimizations for dot4{I, U}8Packed (#7595)
* [wgpu-hal] Use highest available SPIR-V version

* [wgpu-hal] Expose capabilities `DotProductInput*`

* Introduce `{PhysicalDeviceFeatures, PrivateCapabilities}::shader_integer_dot_product`
2025-04-30 11:07:20 +00:00
Andy Leiserson
850c3d4310
[naga] Write only the current entrypoint (#7626)
Changes the MSL and HLSL backends to support writing only a single entry
point, and uses them that way in wgpu-hal.

This is working towards a fix for #5885.

* Increase the limit in test_stack_size
2025-04-30 09:59:41 +02:00
Connor Fitzgerald
fa702f9141 Move everything to workspace dependencies 2025-04-27 18:34:52 +02:00
Kevin Reid
9727e75ad7 Update Cargo.toml to direct-minimal-versions consistency. 2025-04-25 14:40:12 -04:00
Mads Marquart
949c5af934 [metal] Do not glob-import enum variants
The `metal` crate is currently unsound regarding unknown/future enum
variants, see https://github.com/gfx-rs/metal-rs/issues/209 and
https://github.com/rust-lang/rfcs/pull/3803.

`objc2-metal` fixes this by emitting C enums as a newtype + constants
for each variant, but that prevents us from importing the
variants/constants. So this commit converts to a pattern that works with
that in preparation for the migration.
2025-04-25 10:26:42 -04:00
Mads Marquart
78a5b22458 [metal] Import prefixed metal items
A lot of Metal types are prefixed with MTL, which makes it quite clear
where they're coming from. This means that we don't loose any clarity if
we import them instead of having them prefixed with `metal::`.

This will make it easier to migrate to `objc2-metal` since that crate is
named differently from the `metal` crate.
2025-04-25 10:26:42 -04:00
teoxoy
cc406f919e [vk] use destructuring for cache keys
If fields are unused, they shouldn't be part of the cache key.
2025-04-25 12:39:45 +02:00