Commit Graph

7869 Commits

Author SHA1 Message Date
JMS55
17fcb19425
[naga, hal] miscellaneous fixes for Atomic64 support (#5952)
In `naga:🔙hlsl`:

- Generate calls to `Interlocked{op}64` when necessary. not
  `Interlocked{op}`.

- Make atomic operations that do not produce a value emit their
  operands properly.
  
In the Naga snapshot tests:

- Adapt `atomicOps-int64-min-max.wgsl` to include cases that
  cover non-trivial atomic operation operand emitting.

In `wgpu_hal::vulkan::adapter`:

- When retrieving physical device features, be sure to include
  the `PhysicalDeviceShaderAtomicInt64Features` extending struct
  in the chain whenever the `VK_KHR_shader_atomic_int64` extension
  is available.

- Request both `shader_{buffer,shared}_int64_atomics` in the
  `PhysicalDeviceShaderAtomicInt64Features` extending struct when either of
  `wgpu_types::Features::SHADER_INT64_ATOMIC_{ALL_OPS,MIN_MAX}` is requested.

---------

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-07-13 19:17:59 -07:00
teoxoy
6f16ea460a make the StagingBuffer implementation more robust 2024-07-12 16:33:57 +02:00
teoxoy
347d902bcb introduce FlushedStagingBuffer 2024-07-12 16:33:57 +02:00
teoxoy
2f282cdd06 remove instance_flags arg from StagingBuffer::new 2024-07-12 16:33:57 +02:00
teoxoy
26f65ddffd [wgpu-hal] remove return type from Device.unmap_buffer()
It's already documented that to unmap a buffer it has to have been mapped.
Vulkan was the only backend that was returning an OOM on missing `Buffer.block` but `Buffer.map_buffer` already returns an error in this case.
2024-07-12 16:33:57 +02:00
teoxoy
5e2df1406d use StagingBuffer.flush() in Buffer.unmap_inner()
We should have always unmapped the staging buffer as we are using it on the GPU after this point.
2024-07-12 16:33:57 +02:00
teoxoy
9a7f44bf09 make StagingBuffer creation a method 2024-07-12 16:33:57 +02:00
teoxoy
a8b0f2f6a6 remove device arg from StagingBuffer.flush() 2024-07-12 16:33:57 +02:00
teoxoy
4d285d8b61 remove the Mutex around StagingBuffer's internal buffer 2024-07-12 16:33:57 +02:00
teoxoy
a0c185a28c [wgpu-core] fix trying to create 0 sized staging buffers when creating mapped_at_creation buffers
This issue was introduced by fabbca294a.
2024-07-11 14:10:22 +02:00
Xiaopeng Li
349f182966
[d3d12] Drop resource before free suballocation (#5943) 2024-07-11 13:07:30 +02:00
Bruce Mitchener
750f72af8d wgc: Use explicit feature for raw-window-handle
This helps to prepare for the coming day when explicit features
will be required.
2024-07-11 12:38:49 +02:00
Bruce Mitchener
8fd08ac638 Use derive feature on serde rather than serde_derive
The current code works, but `serde` documents that the feature to
use is `derive` (which then happens to use the `serde_derive`
implicit feature).
2024-07-11 11:58:20 +02:00
Andreas Reich
9796766e8e
Changelog cleanup round (#5936)
* Add missing changelog entry for `msl-out-if-target-apple`/`hlsl-out-if-target-windows` feature addition

* minor changelog reorganisation

* fix missing author attribution & pr link in changelog

* import patch release changelogs and remove redundant items

* move pipeline overridable constants from bugfixes to features
2024-07-11 09:27:47 +02:00
Bruce Mitchener
6349250d74 naga: Fix reference to serde feature.
naga doesn't have a `serde` feature, instead having separate
`serialize` and `deserialize` features, so things that want to
modify the serde handling must check for either of those, not
for `serde` itself.
2024-07-11 08:53:16 +02:00
Bruce Mitchener
ee16de1c63
clippy: Fix doc_lazy_continuation lints (#5935)
These are in nightly builds.
2024-07-11 08:44:43 +02:00
Jim Blandy
b5c33fc1a4 [wgpu] Reorganize buffer mapping docs. Make example code work.
Consolidate the explanation of buffer mapping in the documentation for
`Buffer`. Change the example code to actually compile, given that the
`map_async` callback needs to share access to the buffer with
`map_async`'s caller. Mapping isn't pretty, but covering that up in
the docs doesn't improve matters.

For `BufferSlice`, `BufferView`, and `BufferViewMut`, consolidate
extended explanations and background in the docs for types, rather
than scattering it around in the docs for associated functions.

For `Buffer::slice`, `BufferSlice::get_mapped_range`, and
`BufferSlice::get_mapped_range_mut`, update documentation to provide
necessary details, but defer to types' docs for background.
2024-07-10 10:22:49 -07:00
teoxoy
ef0ce05d3a [wgpu-core] fix .zip() usages 2024-07-10 16:42:35 +02:00
Xiaopeng Li
4349e20b8d
Expose adapter driver version for DX12 backend (#5927) 2024-07-10 16:20:23 +02:00
teoxoy
0ace0813de update target_pixel_byte_cost and target_component_alignment 2024-07-10 15:23:48 +02:00
teoxoy
b68966eea5 [wgpu-core] use the view's format not the texture's format
This fixes a regression introduced in 0a76c0fa84.
2024-07-10 15:23:31 +02:00
teoxoy
425526828f introduce DeviceTextureTracker which holds weak references to textures 2024-07-09 10:48:52 +02:00
teoxoy
aa9cb71a54 introduce DeviceBufferTracker which holds weak references to buffers 2024-07-09 10:48:52 +02:00
teoxoy
f5a4489fd9 don't call drain_transitions() of we drop the results 2024-07-09 10:48:52 +02:00
teoxoy
ac88c738c0 remove unused BufferTracker.get() 2024-07-09 10:48:52 +02:00
teoxoy
152a7e7dd0 remove unnecessary PhantomData 2024-07-09 10:48:52 +02:00
teoxoy
a270577dc4 make resource metadata generic over a T: Clone 2024-07-09 10:48:52 +02:00
teoxoy
0e1c1f7c07 replace the tracker in Device with a new DeviceTracker 2024-07-09 10:48:52 +02:00
teoxoy
3142e15907 remove the triage suspected machinery 2024-07-09 10:48:52 +02:00
teoxoy
3fba403060 don't check if the buffer is still "present" from the user's perspective in LifetimeTracker.handle_mapping
This change doesn't change behavior as `Global.buffer_drop` already unmaps the buffer.
2024-07-09 10:48:52 +02:00
teoxoy
3cc6c2743a remove LifetimeTracker.future_suspected_{buffers,textures} 2024-07-09 10:48:52 +02:00
teoxoy
61739d9583 remove PendingWrites.executing_command_buffers
The Vec only ever contained 0 or 1 command buffers.
We now acquire an encoder on every submit for pending writes but that's not a problem since those are coming from a pool anyway.
2024-07-09 10:48:52 +02:00
teoxoy
439e28bfc1 move trackers into EncoderInFlight on submit 2024-07-09 10:48:52 +02:00
teoxoy
140495006e remove device_maintain_ids 2024-07-09 10:48:52 +02:00
teoxoy
c6761bdd7a add ActiveSubmission.temp_resources that contains all temporary resources.
It's worth noting that `suspected_resources` never contained those resources.
2024-07-09 10:48:52 +02:00
teoxoy
7223bfa88d remove Arcs around TempResource variants 2024-07-09 10:48:52 +02:00
teoxoy
ef909d0a82 remove Device.create_buffer_impl 2024-07-09 10:48:52 +02:00
teoxoy
ab88dce759 remove unused TempResource::Buffer 2024-07-09 10:48:52 +02:00
teoxoy
fabbca294a use StagingBuffer instead of Buffer for mapped_at_creation Buffers 2024-07-09 10:48:52 +02:00
teoxoy
5266bd1f08 change prepare_staging_buffer to return a non null u8 pointer 2024-07-09 10:48:52 +02:00
teoxoy
bd2b284a26 remove unused TempResource::Texture 2024-07-09 10:48:52 +02:00
Andreas Reich
7c51bb4a13 Introduce hlsl-out-if-target-windows feature to Naga 2024-07-09 09:53:39 +02:00
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