Commit Graph
312 Commits
Author SHA1 Message Date
Erich Gubler 4db992a66d refactor(core): avoid manually reimplemented sort_by_key (#7366) 2025-03-18 17:43:04 -04:00
Kevin Reid fbe005f11a Make request_adapter() report which backends were tried.
This will help users determine whether the problem is:

* a backend is not statically enabled
* a backend is not dynamically enabled
* no drivers or physical adapters are present for that backend
  (further distinction would be useful here)
* no adapters met the required criteria

There are deficiencies in the reporting of WebGPU vs. WebGL support.
Those would best be fixed by also fixing the mutual exclusion of those
backends.
2025-03-14 11:45:49 +01:00
Kevin Reid 326ad03ce1 Move trace_dir/trace_path to a custom enum inside DeviceDescriptor.
This allows `wgpu` to not unconditionally depend on `std::path::Path`.
It’s also, in my opinion, more user-friendly, because the feature which
most users will not use (and is not currently functional) is now a
defaultable struct field instead of a required parameter.

The disadvantage is that `wgpu-types` now has to know about tracing.
2025-03-10 22:17:06 -04: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
Kevin Reid 7bcbfe0712 wgpu-core: Adjust imports to allow no_std.
Dependencies on `std` that still exist:
* Locks
* `std::error::Error` (waiting for Rust 1.81)
* `std::os::raw::c_char` for FFI
* `thread_local` and `Backtrace` in `snatch`
2025-02-21 08:47:16 +01:00
Kevin Reid 118a985ccd Allow creating Noop backend through the normal mechanisms. 2025-02-12 22:31:47 -05:00
Connor Fitzgerald a1fc4a0316 Allow Short Circuting GL Fences (#6942) 2025-01-21 19:28:14 +00:00
@brodycj - C. Jonathan BrodyandConnor Fitzgerald beb33414c7 trace directory path updates (#6924)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-16 14:50:15 +00:00
@brodycj - C. Jonathan Brody 623f143a82 Start using hashbrown (#6925) 2025-01-16 14:53:36 +01:00
Connor Fitzgerald 0f37714fb8 Separate Out Backend Options into Individual Structs (#6895) 2025-01-15 17:32:15 +00:00
18471d8e78 Image atomics support (#6706)
* Image atomics support

* Address feedback

* fix merge

* Fixes

* Add a couple tests

* Update wgpu-types/src/lib.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* feedback

* feedback

* glsl

* glsl fix

* fix glsl

* fix fix

* fix fix fic

* fix?

* fix

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2025-01-13 15:37:12 +00:00
Andreas Reich fb210ab363 Pass InstanceDescriptor by reference and make it clonable (#6849) 2025-01-06 15:40:30 -05:00
Andreas Reich ed694eda89 Improve logging around surface creation (#6511)
* additional debug logging for request_adapter, demote some messages to debug

* unrelated log messages that annoyed me in Vulkan: debug utils disabled is now `debug`, it being enabled is `info`

* document compatible_surface requirement for WebGL directly on wgt::RequestAdapterOptions

* make adapterenumarge_adapters & request_adapters results info log again when api_log is enabled
2024-12-08 14:44:55 +01:00
atlv 0b6571a68d Align Storage Access enums to spec (#6642) 2024-12-03 17:37:23 +01:00
atlv d5253be7fd rename TFFF::STORAGE_READ_WRITE to STORAGE_WRITE (#6622) 2024-12-01 23:26:47 -05:00
atlv 5e52a313b9 rename TFC::STORAGE to STORAGE_WRITE (#6621) 2024-12-01 16:53:27 -06:00
atlv b75f46cfbe fix typo (#6591) 2024-11-22 21:09:48 -05:00
Teodor Tanasoaia 1abf3fe90e remove unused enum variants (#6550) 2024-11-15 14:25:18 +01:00
teoxoy 6c7dbba399 move PendingWrites into the Queue
The `Device` should not contain any `Arc`s to resources as that creates cycles (since all resources hold strong references to the `Device`).
Note that `PendingWrites` internally has `Arc`s to resources.

I think this change also makes more sense conceptually since most operations that use `PendingWrites` are on the `Queue`.
2024-11-14 06:27:37 -08:00
Andreas Reich ae6c6fbea4 Fix Vulkan surface capabilities being advertised when its query failed. (#6510)
* distinguish `GetSurfaceSupportError` between backend unsupported and failing to get surface caps

* Fix vulkan backend returning invalid surface configuration

* changelog entry
2024-11-12 23:51:07 +01:00
cybersoulK a8214b67f6 Fix missing binding in wgpu-core/src/instance.rs when profiling has a backend enabled (#6422) 2024-10-18 00:15:25 +00:00
teoxoy 3eb9c781cf impl Drop for Surface 2024-10-14 13:24:44 +02:00
teoxoy c38ed8d9fa move surface creation methods on the Instance 2024-10-14 13:24:44 +02:00
teoxoy de97e5449c move enumerate_adapters on the Instance 2024-10-14 13:24:44 +02:00
teoxoy 4d55c6917e make remaining Adapter methods public 2024-10-14 13:24:44 +02:00
teoxoy d1c95d2bfd add adapter getters 2024-10-14 13:24:44 +02:00
teoxoy 321bd64ba2 add Adapter::backend() 2024-10-14 13:24:44 +02:00
teoxoy 5627a0b6d9 move request_adapter on the Instance 2024-10-14 13:24:44 +02:00
teoxoy 40206ce4d7 add new Instance::as_hal fn 2024-10-14 13:24:44 +02:00
Teodor Tanasoaia c8beade187 remove backend from ID (#6263) 2024-09-13 17:30:38 +02:00
teoxoy c182d3f24f [wgpu-core] rename .strict_unregister() & .strict_remove() to .remove() 2024-09-10 11:58:54 +02:00
teoxoy ac74f36590 [wgpu-core] rename .strict_get() to .get() 2024-09-10 11:58:54 +02:00
teoxoy aa280ecd44 [wgpu-core] change return type of device creation methods to be more rusty
This is fine from the WebGPU spec's perspective as device creation returns a promise that can reject.
2024-09-10 11:58:54 +02:00
teoxoy da9afea271 [wgpu-core] use .strict_get() & .strict_unregister() for surfaces
This works because we never assign errors to surfaces (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy 98426329a4 [wgpu-core] introduce Registry .strict_get() & .strict_unregister() and use them for adapters
This works because we never assign errors to adapters (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy eb47449eb9 invalidate the device when we encounter driver-induced device loss or on unexpected errors 2024-09-09 15:03:19 +02:00
Erich Gubler 754ead25ab chore: resolve wgt::Backend::Empty raising unused_qualifications 2024-08-23 16:20:34 -04:00
Marijn Suijten a157c3cf4b [wgpu-hal] Migrate d3d12 backend over to windows-rs (#5956)
* windows-rs 0.58

* Clean up suspicious committed allocation workaround

* dx12: Flatten suballocation module
2024-08-20 11:48:37 -04:00
teoxoy 2c31414517 add an Unexpected variant to DeviceError 2024-08-15 13:56:05 +01:00
Andreas Reich 1bfe8845d5 ignore 'arc instead of rc' warnings on wasm 2024-08-14 17:34:11 +02:00
Andreas Reich 24498f04d4 The second unraveling: hub and all types on it are generic free!
gfx_select macros are empty husks now that are waiting to be removed
2024-08-14 17:34:11 +02:00
Andreas Reich 3181251577 Core adapter no longer uses any generics 2024-08-14 17:34:11 +02:00
Andreas Reich 04cadfb369 Core's Surface, Instance and Adapter use now dynamic hal types 2024-08-14 17:34:11 +02:00
Andreas Reich 7c7e4164f1 The big unraveling: core device now has a boxed DynDevice, ripple effects from there leading to boxing of almost all hal resources 2024-08-14 17:34:11 +02:00
teoxoy 6351a75b0c remove implemented TODO 2024-07-29 17:31:24 +02:00
teoxoy f3e8e594ed remove Hub.surface_unconfigure() since the Hub reference was unused. 2024-07-29 17:31:24 +02:00
teoxoy 1cb7ebab99 [wgpu-hal] replace Instance.destroy_surface() with Drop impls on Surfaces
Only the metal and vulkan backends require
destruction code and it can go in a `Drop` impl since
the `Instance` is unused in those implementations.
2024-07-29 17:31:24 +02:00
Samson 7462754bde Remove 'de: 'static" serde bound and replace &'static str with Cow in some errors (#6048)
* Remove `serde(bound(deserialize = "'de: 'static"))` and replace `&'static str` with `Cow` in deser errors

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Allow `clippy::result_large_err`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-29 09:07:26 +02:00
Erich Gubler 723995d9a9 refactor: warn on and satisfy clippy::{ptr_as_ptr,ref_as_ptr} in wgpu-{core,hal,types}
…using `cargo +1.79.0 clippy --workspace --all-features --all-targets
--fix`, plus some manual changes to (1) catch some missed cases (not run
on all platforms?) and (2) `--fix` doesn't make things compile again. 😀
2024-07-24 12:09:15 -04:00
Erich Gubler 7b2e08fb94 refactor: satisfy clippy::missing_transmute_annotations (#6024)
* refactor(metal): satisfy `clippy::missing_transmute_annotations`

* refactor(gles): satisfy `clippy::missing_transmute_annotations`

* refactor(metal): `metal::Surface::view`: use `ptr::cast` instead of `as`
2024-07-24 08:56:45 +02:00