Commit Graph

7827 Commits

Author SHA1 Message Date
Andreas Reich
e1913b1209 Introduce msl-out-if-target-apple feature to Naga 2024-07-09 09:53:39 +02:00
Andreas Reich
89c3baf34e Add cfg_alias indirection to Naga's x_out features 2024-07-09 09:53:39 +02:00
Nicolas Silva
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
Erich Gubler
2cffa1d106 chore(clippy): satisfy unused_qualifications 2024-07-08 10:28:46 +02:00
dependabot[bot]
bc8c572d0c
build(deps): bump JamesIves/github-pages-deploy-action from 4.6.1 to 4.6.3 (#5921)
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.1 to 4.6.3.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.1...v4.6.3)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 09:42:18 +02:00
Erich Gubler
25bc704e35 chore: satisfy clippy::manual_unwrap_or_default 2024-07-05 10:35:37 +02:00
Erich Gubler
00a32ca2ad refactor: satisfy missing_docs,clippy::empty_docs 2024-07-04 23:20:34 -06:00
Erich Gubler
d41b9ab29f
refactor: use built-in {integer}::power_of_two methods (#5909) 2024-07-04 23:34:19 -04:00
Erich Gubler
4816a2d1bd
refactor!: suppress dead_code in wgpu::util::DownloadBuffer (#5917) 2024-07-04 23:33:21 -04:00
Erich Gubler
f02ec0e4e8
test: fix wgpu-test building by itself (#5912) 2024-07-04 23:31:37 -04:00
Erich Gubler
5c29ad548b refactor: vertex_index_common: use size_of_val instead of magic number 2024-07-04 16:40:34 -06:00
Erich Gubler
764b15a556 refactor: vertex_index_common: elide tests alloc. w/ Itertools::cartesian_product 2024-07-04 16:40:34 -06:00
Erich Gubler
7600c61b72 refactor: vertex_index_common: use strum enum iter.
Replace manual enumerations of various `enum`s with `derive`d ones via
`strum::{EnumIter, IntoEnumIterator}`.
2024-07-04 16:40:34 -06:00
teoxoy
9f34acd567 [wgpu-hal] return None in Adapter.surface_capabilities() if the Surface and the Adapter don't share the same WebGL2 context 2024-07-04 10:17:07 +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
Jim Blandy
37f283688a [example hello] Produce output when run in the usual way.
Fixes #3503.
2024-07-04 00:24:59 -07:00
Imbris
3a6814770a
Allow unconsumed inputs in fragment shaders (#5531)
* Allow unconsumed inputs in fragment shaders by removing them from vertex
outputs when generating HLSL.

Fixes https://github.com/gfx-rs/wgpu/issues/3748

* Add naga:🔙:hlsl::FragmentEntryPoint for providing information
  about the fragment entry point when generating vertex entry points via
  naga:🔙:hlsl::Writer::write. Vertex outputs not consumed by the
  fragment entry point are omitted in the final output struct.
* Add naga snapshot test for this new feature,
* Remove Features::SHADER_UNUSED_VERTEX_OUTPUT,
  StageError::InputNotConsumed, and associated validation logic.
* Make wgpu dx12 backend pass fragment shader info when generating
  vertex HLSL.
* Add wgpu regression test for allowing unconsumed inputs.

* Address review

* Add note that nesting structs for the inter-stage interface can't
  happen.
* Remove new TODO notes (some addressed and some transferred to an issue
  https://github.com/gfx-rs/wgpu/issues/5577)
* Changed issue that regression test refers to 3748 -> 5553
* Add debug_assert that binding.is_some() in hlsl writer
* Fix typos caught in CI

Also, fix compiling snapshot test when hlsl-out feature is not enabled.
2024-07-04 09:08:46 +02:00
teoxoy
e26d2d7763 move command buffer resolving in Global's methods 2024-07-03 15:01:41 +02:00
teoxoy
a9c74f42d6 use Surface.get_capabilities in all relevant places 2024-07-03 15:01:41 +02:00
teoxoy
ef7d27233e use a read guard instead of write 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
5b2e78da45 cleanup adapter usages within the Device 2024-07-03 15:01:41 +02:00
teoxoy
4f6223534f take guard to render bundles at the top of resolve_render_command_ids 2024-07-03 15:01:41 +02:00
teoxoy
addd80ccd3 replace Registry.read().get_owned() with Registry.get() 2024-07-03 15:01:41 +02:00
teoxoy
3df4c8a502 remove unused std::ops::Index impl for Storage 2024-07-03 15:01:41 +02:00
teoxoy
9308e15048 use Storage.get_owned in cases where we used to later clone the resource anyway 2024-07-03 15:01:41 +02:00
teoxoy
249c8023ff simplify State.set_bind_group 2024-07-03 15:01:41 +02:00
teoxoy
dbcb273188 remove StatelessTracker.add_single 2024-07-03 15:01:41 +02:00
teoxoy
39a268c624 remove FutureId.assign_existing 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
7f3e1bba14 move code after calls to FutureId.assign inside Device fns 2024-07-03 15:01:41 +02:00
teoxoy
40022c1584 remove duplicate check, it's already present in Device.create_texture_view 2024-07-03 15:01:41 +02:00
teoxoy
dc55cb436c add Texture::new fn 2024-07-03 15:01:41 +02:00
teoxoy
53c79bdf7a move buffer creation logic in a new Device method 2024-07-03 15:01:41 +02:00
teoxoy
029168f14a remove no-op, calling schedule_resource_destruction with last_submit_index: !0 does nothing 2024-07-03 15:01:41 +02:00
teoxoy
a971e7f7d4 remove duplicate check, it's already present in Device.create_buffer 2024-07-03 15:01:41 +02:00
teoxoy
7b387007a8 make Device.create_buffer return an Arc<Buffer> 2024-07-03 15:01:41 +02:00
teoxoy
b8c5b2275e don't clone resources for ResourceMetadataProvider::Direct 2024-07-03 15:01:41 +02:00
teoxoy
69b44c6a32 gate fns behind either serde or replay since Firefox needs those 2024-07-02 18:06:19 +02:00
teoxoy
b61be30e53 move out ID to resource mapping code from Device.create_bind_group 2024-07-02 18:06:19 +02:00
teoxoy
1be51946e3 move out ID to resource mapping code from pipeline creation methods 2024-07-02 18:06:19 +02:00
teoxoy
d8b0b5975d assign resources/errors in the Global's pipeline creation functions 2024-07-02 18:06:19 +02:00
teoxoy
79b15b8de8 move out ID to BGL mapping from Device.create_pipeline_layout() 2024-07-02 18:06:19 +02:00
teoxoy
1f6ac35e83 change Storage.force_replace to take an Arc<T> 2024-07-02 18:06:19 +02:00
teoxoy
896418c740 Panic on non-existent entry in Storage.get, this is consistent with Element::Vacant 2024-07-02 18:06:19 +02:00
teoxoy
16c7d84d63 remove Registry.try_get() 2024-07-02 18:06:19 +02:00
teoxoy
b904e2c759 use Registry.get() for device_set_device_lost_closure 2024-07-02 18:06:19 +02:00
teoxoy
c4d71d9af5 use Registry.get() instead of Registry.read().get_owned() 2024-07-02 18:06:19 +02:00
teoxoy
3547138716 remove PrettyError 2024-07-02 18:06:19 +02:00