Commit Graph
292 Commits
Author SHA1 Message Date
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
Jim Blandy ebb011fc6b [core] Use ManuallyDrop for wgpu_core::device::Queue::raw.
Change the field `wgpu_core::device::Queue::raw` from an
`Option<A::Queue>` to a `std::mem::ManuallyDrop<A::Queue>`. Replace
various `.as_ref().unwrap()` chains with calls to a new accessor
function `Queue::raw`.

An `Option` is misleading, as this field is always populated during
the lifetime of a `Queue`. Instead, we simply have a field whose value
needs to be moved in `<Queue as Drop>::drop`; `ManuallyDrop` is the
Rust idiom for this situation.
2024-07-23 14:02:16 -07:00
sagudev d03b7e239d Make RequestAdapterError (de)serializable
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-19 13:37:57 -04:00
sagudev 7a73c75e6a Make RequestDeviceError (de)serializable
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-19 13:37:57 -04:00
Nicolas SilvaandAndreas Reich 4c6318c0d2 Expose gpu allocation configuration options (#5875)
* Expose gpu allocation configuration options

This commit adds hints to control memory allocations strategies to the configuration options. These hints allow for automatic profiles such as optimizing for performance (the default, makes sense for a game), optimizing for memory usage (typically more useful for a web browser or UI library) and specifying settings manually.

The details of gpu allocation are still in flux. The goal is to switch vulkan and metal to gpu_allocator which is currently used with d3d12. gpu_allocator will also likely receive more configuration options, in particular the ability to start with smaller memory block sizes and progressively grow the block size. So the manual settings already provision for this upcoming option. Another approach could be to wait and add the manual option after the dust settles.

The reason for providing presets and defining values in the backends is that I am convinced that optimal fonigurations should take hardware capabilities into consideration. It's a deep rabbithole, though, so that will be an exercise for later.

* changelog

* Update CHANGELOG.md

Co-authored-by: Andreas Reich <r_andreas2@web.de>

* Add a comment about not entirely knowing what we are doing

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-07-08 14:49:44 +02:00
teoxoy 7910fd8059 [wgpu-hal] require a Surface to be passed to Instance.enumerate_adapters() on WebGL2
Also makes wgpu's `enumerate_adapters()` native only.
2024-07-04 10:17:07 +02:00
teoxoy a9c74f42d6 use Surface.get_capabilities in all relevant places 2024-07-03 15:01:41 +02:00
teoxoy eb0eb342cf unregister adapters like all other resources 2024-07-03 15:01:41 +02:00
teoxoy cd9f003477 move Device.set_queue call in create_device_and_queue_from_hal 2024-07-03 15:01:41 +02:00
teoxoy 96255d484f change FutureId.assign to not return a clone of the resource passed to it 2024-07-03 15:01:41 +02:00
teoxoy ed1e8ecf4b remove label getters from Global
Also removes label from `Element::Error` and slightly refactors ContextError.
2024-07-02 18:06:19 +02:00
teoxoy 6fe041d544 make Queue.device non-optional 2024-07-02 18:06:19 +02:00
teoxoy c3ebfde302 remove Resource trait 2024-07-02 18:06:19 +02:00
teoxoy c63f0a02f2 introduce Trackable trait 2024-07-02 18:06:19 +02:00
teoxoy ae7da8f669 introduce Labeled trait 2024-07-02 18:06:19 +02:00
teoxoy 727956fcde introduce StorageItem trait 2024-07-02 18:06:19 +02:00
teoxoy 90f7377cc9 introduce ResourceType trait 2024-07-02 18:06:19 +02:00
teoxoy a422d1cba2 remove ResourceInfo.id 2024-07-02 18:06:19 +02:00
teoxoy 5f78485f30 pass Label to ResourceInfo::new 2024-06-25 11:14:41 +02:00
Erich Gubler b9e787e667 refactor: satisfy clippy::never_loop 2024-06-17 05:26:03 -04:00
Kevin Reid 9b70254437 Reduce string allocations related to labels and logging. (#5690) 2024-05-14 04:39:28 -04:00