Commit Graph
277 Commits
Author SHA1 Message Date
teoxoy 31edbfd0dc [wgpu-core] use .strict_get() & .strict_unregister() for command buffers
We now only rely on the presence of the inner `CommandBufferMutable` to determine if command buffers are invalid.
2024-09-10 11:58:54 +02:00
teoxoy 2ea314e978 [wgpu-core] remove Arc around StagingBuffer 2024-09-10 11:58:54 +02:00
teoxoy c630821f1d [wgpu-core] use Fallible for Texture 2024-09-10 11:58:54 +02:00
teoxoy 68e8b7d4a8 [wgpu-core] introduce Fallible and use it for Buffer (first step of invalidity internalization) 2024-09-10 11:58:54 +02:00
teoxoy 07c397a1e5 [wgpu-core] use .strict_get() & .strict_unregister() for queues
This works because we never assign errors to queues (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
Andreas Reich 9794f33823 Handle webgl's queue_copy_external_image_to_texture 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 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 ce9c9b76f6 remove Option around A::SurfaceTexture
We can rely on the snatching mechanism to take the surface texture.
2024-08-13 00:55:32 +02:00
teoxoy 19843c9c5f use ManuallyDrop for Device.fence 2024-08-13 00:55:32 +02:00
teoxoy 728b288fda use ManuallyDrop for Device.zero_buffer 2024-08-13 00:55:32 +02:00
teoxoy 8c7c5c4974 decouple device and queue IDs
Devices and queues can have different lifetimes, we shouldn't assume that their IDs match.
2024-08-05 15:46:12 +02:00
Nicolas Silva 9c6ae1beae Log spring cleaning (#6065)
Remove unused logs in wgpu-core and wgpu-hal
2024-07-31 16:24:23 +00:00
Erich Gubler 65b6e15f0f chore: satisfy clippy::unused_qualifications 2024-07-24 12:09:15 -04: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
teoxoy 205f1e3ab6 [wgpu-core] fix length of copy in queue_write_texture #2
Follow-up to 6f16ea460a & 7e112ca4c0.
2024-07-22 12:25:07 +02:00
Connor Fitzgerald 3c3b532cf3 Remove latest_submission_index (#5976)
* Remove latest_submission_index

* CI

* Comments
2024-07-18 16:43:39 +00:00
teoxoy 9a0adefe88 use ManuallyDrop instead of Option for PendingWrites 2024-07-18 10:30:11 -04:00
Jim Blandy aeb2067e81 [core] Make poll(Wait) not hang after bad command submission.
Add `wgpu_core::device::Device::last_successful_submission_index`,
which records the fence value that `Maintain::Wait` should actually
wait for. See comments for details.

Fixes #5969.
2024-07-17 16:11:04 -07:00
Teodor Tanasoaia 7e112ca4c0 [wgpu-core] fix length of copy in queue_write_texture (#5973)
The size of the given `data` might be less than the size of the staging buffer.
This issue became apparent with the refactor in 6f16ea460a (https://github.com/gfx-rs/wgpu/pull/5946) since there is now an assert in `StagingBuffer.write()`.

Ruffle ran into this in https://github.com/gfx-rs/wgpu/issues/3193#issuecomment-2231209711.
2024-07-17 10:33:48 -04: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
teoxoy 425526828f introduce DeviceTextureTracker which holds weak references to textures 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 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 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 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
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 4df5474c9c remove MissingCopyDstUsageFlag error variants 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