Commit Graph

1225 Commits

Author SHA1 Message Date
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
Kevin Reid
67f1554e77 Fix build of wgpu-hal on macOS with features = ["gles"]. (#7266)
Without this change, `cargo build -p wgpu-hal --features=gles` will fail
if `target_os = "macos"`.
2025-03-05 00:12:43 -05: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
c626d4f819 build: update CORE_MSRV 1.80.1 → 1.82.0 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
Erich Gubler
18951ea3d2 build: update CORE_MSRV 1.76.0 → 1.80.1 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
minus1ms
e95f6d632c binding size fix (#7177) 2025-02-24 15:48:06 +01:00
Connor Fitzgerald
ae5dc0e7cb Target Specific Compilation (#7076) 2025-02-22 12:38:58 +01:00
Connor Fitzgerald
f781a6b6ca Fix Obscured Warning (#7193) 2025-02-21 22:47:06 -05:00
Kevin Reid
bea4fb9e2d wgpu-hal: Adjust imports to eventually allow no_std.
We need `core::error::Error` (Rust 1.81) to make it a reality.
2025-02-21 08:47:16 +01:00
Mads Marquart
7b00140b16 Add layer observer based on raw-window-metal (#7026)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-02-20 21:30:58 +00:00
Teodor Tanasoaia
b5e32cec58 add max_shader_model to Dx12Compiler (#7167) 2025-02-18 13:44:23 +01:00
Connor Fitzgerald
194d4b1f36 New Binding Array Limit (#6952) 2025-02-17 09:22:24 -05:00
Connor Fitzgerald
d8833d0798 Use Update After Bind Descriptors for Bind Groups With Binding Arrays (#6815)
* Use Update After Bind Descriptors for Bind Groups With Binding Arrays

Update After Bind

x

* Comments

* Fix URL
2025-02-15 12:02:27 -05:00
Connor Fitzgerald
7e119968ce Properly Deal with Timeouts (#7030) 2025-02-14 23:19:51 +00:00
Erich Gubler
b05e9705bf fix: add cbindgen:ignore on const with the same ident. 2025-02-14 12:18:41 -05:00
Kevin Reid
118a985ccd Allow creating Noop backend through the normal mechanisms. 2025-02-12 22:31:47 -05:00
Kevin Reid
7293a13a97 Extend the capabilities of the Noop backend.
This will allow using it in tests of wgpu resource management code
that does not actually require a backend.

* `enumerate_adapters()` returns an adapter instead of failing.
* `open()` returns a device instead of failing.
* `create_buffer()` allocates actual memory.
* `map_buffer()` actually provides access to that memory.
* `clear_buffer()` actually clears the buffer.
* `copy_buffer_to_buffer()` actually copies data.
* Fences actually work (trivially, because all operations are
  synchronous).

Future work could include implementing texture copies,
timestamp queries, and the clearing part of render passes.
2025-02-12 22:31:47 -05:00
Kevin Reid
0143b4aaa0 Rename Empty backend to Noop.
This is in preparation for making it a more substantial test stub,
able to execute nontrivial code, and usable from the safe `wgpu` API.
2025-02-12 22:31:47 -05:00
richerfu
ff907736ef feat(gles): support gles backend on openharmony (#7085)
* fix(gles): fix gles backend crash on openharmony

* docs: add changelog

* ci: add OpenHarmony to CI

* Update .github/workflows/ci.yml

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-02-13 03:01:50 +00:00
Adrian Wielgosik
0f5d575ef3 Lower max_color_attachments limit for GL to 4 (#6994)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-02-13 00:37:34 +00:00
Amr Bashir
2f607d3e64 fix(dx12): map composite alpha mode (#7117)
* fix(dx12): map composite alpha mode

closes #7108

* changelog entry

* add composite modes based on surface target

* fix missing `in` in change log entry
2025-02-12 23:02:50 +00:00
Vecvec
3a4a40aae4 [wgpu-hal] Blas compaction (#7101) 2025-02-12 13:19:07 +00:00
Vecvec
0922631125 Fix transform buffer when building blas (#7062)
Co-authored-by: Nicolas Silva <nical@fastmail.com>
2025-02-10 20:18:41 -05:00
Shaye Garg
dad9d0b577 Fix 3D Texture Views on Dx12 (#7071)
* use all w slices

* update changelog
2025-02-06 22:29:06 +00:00
Vecvec
d34707ec3f Rename instance_id & instance_custom_index to instance_index & instance_custom_data (#6780) 2025-02-05 18:23:22 +01:00
Erich Gubler
9b76bcf12e fix(dx12): query resource binding tier, not resource heap tier, for bindless feature check (#7059) 2025-02-05 10:41:46 -05:00
Connor Fitzgerald
d9e9c3aa19 Fix Zero Sized Sampler Heap Issue (#7054) 2025-02-03 15:49:31 -05:00
Jamie Nicol
4e7d892317 [naga msl-out hlsl-out] Improve workaround for infinite loops causing undefined behaviour (#6929)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2025-01-31 15:27:52 -05:00
@brody4hire - C. Jonathan Brody
a8cc83e17a avoid default features in many dependencies (etc.) (#7031) 2025-01-30 10:30:42 -05:00