Commit Graph
977 Commits
Author SHA1 Message Date
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
teoxoy 77e45d46df add missing device valid check in create_texture_view 2024-07-18 10:29:08 -04:00
teoxoy f767220399 remove same device check from create_texture_binding
`view.parent` will have the same `device` as the `view` itself
2024-07-18 10:29:08 -04:00
teoxoy 63303d4b4e add missing same device checks 2024-07-18 10:29:08 -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
Jim Blandy 2bc328c46f [hal, core] Introduce wgpu_hal::AtomicFenceValue, and use it.
Introduce the new type alias `wgpu_hal::AtomicFenceValue`, which is
the atomic version of `wgpu_hal::FenceValue`. Use this type alias in
`wgpu_core`. Remove `as` conversions made unnecessary since we're not
conflating `usize` with `u64` any more.
2024-07-17 16:11:04 -07:00
teoxoy 91924fb603 [wgpu-core] make implicit_pipeline_ids arg optional for users that don't provide IDs 2024-07-17 16:57:01 +02: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
Jim Blandy d02e2949b2 [core] Correctly check mipmap-filtering samplers against the layout.
Ensure that samplers using non-`Nearest` mipmap filtering are
considered "filtering samplers" when deciding bind group layout
compatibility.

Add tests for layout `NonFiltering` validation.

Fixes #5948.
2024-07-15 10:03:49 +02:00
Jim Blandy 05c0656fa4 [core] Correct docs for LifetimeTracker and its mapped field. 2024-07-15 09:59:04 +02: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 ef0ce05d3a [wgpu-core] fix .zip() usages 2024-07-10 16:42:35 +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 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
Erich Gubler d41b9ab29f refactor: use built-in {integer}::power_of_two methods (#5909) 2024-07-04 23:34:19 -04: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::back::hlsl::FragmentEntryPoint for providing information
  about the fragment entry point when generating vertex entry points via
  naga::back::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 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 5b2e78da45 cleanup adapter usages within the Device 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 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