Commit Graph

1082 Commits

Author SHA1 Message Date
Sylvain Benner
14690470bb [metal] Metal compute shader passthrough (#7326)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-04-09 14:25:41 +00:00
Connor Fitzgerald
a6d7e0d56b [d3d12] Move naming inside suballocation functions 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
a1e96cc179 [d3d12] Simplify set_name calls with a helper 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
6262462979 [d3d12] Make placed/committed resource paths the same 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
1831267551 [d3d12] Separate placed resource construction into separate functions 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
460eff4866 [d3d12] Always associate a size with an allocation 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
014b5b52f2 [d3d12] Internalize raw buffer desc mapping 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
4fce269b1d [d3d12] Isolate buffer descriptor mapping 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
b57ec2c9e0 [d3d12] Remove unused visibility and arguments 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
004961874f [d3d12] Turn suballocation free functions into member functions 2025-04-07 21:03:43 -04:00
Connor Fitzgerald
46ef1fc061 [d3d12] Use DeviceAllocationContext for deallocation 2025-04-07 16:01:19 +02:00
Connor Fitzgerald
cccb0864cd [d3d12] Import suballocation module instead of subtypes 2025-04-07 16:01:19 +02:00
Connor Fitzgerald
b2160813c5 [d3d12] Pass resource into free_allocation 2025-04-07 16:01:19 +02:00
Connor Fitzgerald
840dbd5385 [d3d12] Improve naming of allocation functions 2025-04-07 16:01:19 +02:00
Connor Fitzgerald
0f4d1f2284 [d3d12] Internalize Allocation option 2025-04-07 16:01:19 +02:00
Connor Fitzgerald
f895290550 [d3d12] Rename AllocationWrapper to Allocation 2025-04-07 16:01:19 +02:00
Connor Fitzgerald
c946ab2052 [d3d12] Remove GpuAllocatorWrapper 2025-04-07 16:01:19 +02:00
Connor Fitzgerald
595b3eb647 [d3d12] Use DeviceAllocationContext for memory allocation 2025-04-07 16:01:19 +02:00
Connor Fitzgerald
74b37916db [d3d12] Move private_capabilities to DeviceShared 2025-04-07 16:01:19 +02:00
Vecvec
e8e66afb72 Fix new acceleration structure building validation errors. (#7486) 2025-04-07 15:17:06 +02:00
Andy Leiserson
a843c880d2 [metal] Fix handling of stage visibility for binding arrays (#7479)
Fixes #7287
2025-04-04 11:20:57 -04:00
Connor Fitzgerald
c860a2cf8c Rename and unsafe start_capture -> start_graphics_debugger_capture (#7470)
* Improve `start_capture` docs

* Docs
2025-04-03 13:07:22 -04:00
Marc Pabst
3d7ae9dc92 Allow to get raw swap chain from DX12 surface (#7399)
* allow to get raw swap_chain from dx12 surface

* Update wgpu-hal/src/dx12/mod.rs

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* allow obtaining IDXGISwapChain3 directly

---------

Co-authored-by: Marc Pabst <mail@xxxxxxx>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Marc Pabst <“marcpabst@users.noreply.github.com”>
2025-03-31 20:15:35 -04:00
teoxoy
2ab3b6da8d guarantee DownlevelFlags::COMPUTE_SHADERS when DownlevelFlags::INDIRECT_EXECUTION is enabled 2025-03-26 18:26:31 +00:00
Bruce Mitchener
b7e7d7ce7a Fix clippy::manual_contains lints (#7384) 2025-03-20 21:55:52 -04:00
Connor Fitzgerald
4687973c9a Use bytemuck instead of slice::from_raw_parts for transmutes (#7376) 2025-03-19 22:05:21 -04:00
Christopher Fleetwood
c6286791fe feat: implement F16 support in shaders (#5701)
Co-authored-by: FL33TW00D <fleetwoodpersonal@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: ErichDonGubler <erichdongubler@gmail.com>
2025-03-19 16:26:50 +00:00
SupaMaggie70Incorporated
e8ce3ae973 Add mesh shader stages to wgt::ShaderStages and naga::ShaderStage (#7292)
* Initial changes

* Fixed metal backend in wgpu-hal, ran tests
2025-03-15 05:34:20 +00:00
Vecvec
a13f0a03ef [vulkan] Automatically add linux buffer sharing extensions if available. (#7317)
* Automatically add linux sharing extensions to the requirements if supported.

* Correct comment.
2025-03-12 15:27:34 +00:00
Teodor Tanasoaia
9021d93b9f [d3d12] fix size of buffer (#7310)
The buffer size was being aligned to `D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT` (256). The buffer size value is used as the binding size (when none is specified), causing `arrayLength()` to return values larger than what users of the API specified for the buffer size.
2025-03-10 17:05:50 +01:00
Matilde Morrone
12ce4e2861 Better handling of drm extensions (#7295) 2025-03-07 13:50:32 -05:00
Erich Gubler
61eda14256 fix(android,vulkan): forcibly convert to u64 in *devid checks 2025-03-06 22:33:08 -05:00
Erich Gubler
6f65d3db2a refactor(vulkan): use slice::contains for st_rdv comparison 2025-03-06 22:33:08 -05:00
SupaMaggie70Incorporated
20bad46d40 Add multiview mesh shaders to wgpu-hal (#7278) 2025-03-06 12:25:55 -05:00
SupaMaggie70Incorporated
cc1e26a799 Fixed DRM(hopefully) (#7277) 2025-03-06 03:36:21 +00:00
Kevin Reid
289d0e5c5a Allow the "gles" backend to (theoretically) compile on no_std targets.
This entirely consists of conditionally replacing `Mutex` with `RefCell`,
then making sure that this doesn’t accidentally happen if we are also
exposing `Send + Sync`.
2025-03-05 11:48:42 +01:00
Marc Pabst
38f3c47a46 Add as_hal for Queue (#7182)
* add as_hal for Queue

* add as_raw for dx12 queue

* return Mutex + add as_raw for Vulkan

* return reference

* restore Cargo.lock

* fix  Cargo.lock

---------

Co-authored-by: Marc Pabst <“marcpabst@users.noreply.github.com”>
2025-03-04 21:24:06 +00:00
Matilde Morrone
7eb69f43b6 Add DRM support to Vulkan backend (#7212)
* Add basic drm support to vulkan backend

* Move vulkan drm implementation to its own module

* Properly feature gate drm support and add safety docs

* Disable drm on wasm targets

* Remove old fixme comment from vulkan drm backend

* Move cfg check inside drm module

* Use expect instead of allow for create_surface_from_drm

* Document that drm is not available on apple platforms
2025-03-04 20:53:38 +00:00
Vecvec
5b3266db23 Support getting hit vertex positions (#7183) 2025-03-04 20:06:44 +01:00
SupaMaggie70Incorporated
a6109bf69b Mesh shaders - initial wgpu hal changes (#7089)
* Initial(untested commit), vulkan and gles only supported

* Maybe fixed compiles for metal and dx12

* Hopefully fixed compiles for other backends and updated to functional(?) vulkan thing

* Fixed the clippy warning

* Fixed silly documentation mistake

* Fixed issue with multiview feature

* Dummy commit for dummy CI

The CI pooped itself, hopefully this fixes that. Will probably be undone either way.

* Re trigger CI checks, to avoid #7126

* Changes based on code review

* Fixed clippy warning, broken cargo.lock

* Unfucked cargo.lock for real this time

* Switched match to if-let in accordance with review

* Updated changelog

* Fix CI error

Done from web out of impatience

* CI is very angry 😡

Made CI less angry by fixing formatting(hopefully). This commit was also done from GitHub web.

* Removed comment in following request

* Update wgpu-hal/src/vulkan/adapter.rs

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-03-04 00:12:38 +00:00
Kent Slaney
3acac093fd msl bitmask fix (#7255) 2025-03-03 15:16:57 +01:00
JMS55
2764e7a399 Add wgpu_hal::vulkan::Adapter::texture_format_as_raw (#7228)
* Add wgpu_hal::vulkan::Adapter::texture_format_as_raw

* Add changelog entry
2025-02-28 20:44:09 -05:00
Erich Gubler
6f0c2434a7 chore(hal,core): use core::{error::Error,format} instead of std
This allows `wgpu-hal` to be used in `no_std` environments, except that
currently, only the `noop` backend supports `no_std`.
In the future, `cfg(all(gles, webgl))` should also be `no_std`, but that
requires further work.

Co-Authored_by: Kevin Reid <kpreid@switchb.org>
2025-02-26 22:58:50 -05:00
Erich Gubler
1bd3c7b4ee refactor(hal): s/once_cell::Lazy/std::sync::LazyLock
Weaken our dependence on the `once_cell` crate by using functionality
from `std` instead that was upstreamed from `once_cell`, this time with
what's available in Rust 1.80+.

It's not yet possible to eliminate this dependency entirely, but do what
we can for now.
2025-02-26 22:58:50 -05:00
Erich Gubler
8774ab53d5 chore: remove std::mem::* imports now unnecessary with CORE_MSRV
`std::mem::{size,align}_of{,_val}` was added to `std::prelude` in Rust
1.80; see
[`rust`#123168](https://github.com/rust-lang/rust/pull/123168/).
2025-02-26 22:58:50 -05:00
Erich Gubler
68803e3b9b refactor: use more c string literals 2025-02-26 22:58:50 -05:00
Erich Gubler
567fdbc2db chore: satisfy clippy::manual_c_str_literals
This was previously an `allow`-by-default warning in Clippy's `pedantic`
group, but with Rust 1.83 it was promoted to a `warn`-by-default member
of its `complexity` group.

Co-Authored-By: Kevin Reid <kpreid@switchb.org>
2025-02-26 22:58:50 -05:00
Jamie Nicol
b7d1f4c6cf [naga spv-out] Ensure loops generated by SPIRV backend are bounded (#7080)
If it is undefined behaviour for loops to be infinite, then, when
encountering an infinite loop, downstream compilers are able to make
certain optimizations that may be unsafe. For example, omitting bounds
checks. To prevent this, we must ensure that any loops emitted by our
backends are provably bounded. We already do this for both the MSL and
HLSL backends. This patch makes us do so for SPIRV as well.

The construct used is the same as for HLSL and MSL backends: use a
vec2<u32> to emulate a 64-bit counter, which is incremented every
iteration and breaks after 2^64 iterations.

While the implementation is fairly verbose for the SPIRV backend, the
logic is simple enough. The one point of note is that SPIRV requires
`OpVariable` instructions with a `Function` storage class to be
located at the start of the first block of the function. We therefore
remember the IDs generated for each loop counter variable in a
function whilst generating the function body's code. The instructions
to declare these variables are then emitted in `Function::to_words()`
prior to emitting the function's body.

As this may negatively impact shader performance, this workaround can
be disabled using the same mechanism as for other backends: eg calling
Device::create_shader_module_trusted() and setting the
ShaderRuntimeChecks::force_loop_bounding flag to false.
2025-02-25 15:23:44 +01:00
Connor Fitzgerald
8fb09a5ad6 Move REPO_MSRV to 1.85 (#7218) 2025-02-24 23:39:34 -05:00
Flávio J. Saraiva
a26171b2a0 Fix compilation for targets that don't have AtomicU64. (#7118)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-02-24 22:07:13 +00:00