Commit Graph
186 Commits
Author SHA1 Message Date
John-John Tedro dec6ea5ea4 Improve the consistency of identifiers (#5108) 2024-01-29 10:56:04 +01:00
Nicolas Silva 60a5739df2 d3d12: Propagate errors when closing command lists (#5125)
Before this commit, command lists that we failed to close were used anyway during submit, causing device loss.
2024-01-23 14:30:08 +01:00
John-John Tedro e5c62fb5bd vulkan: Replace fence with semaphore when acquiring surfaces (#4967) 2024-01-21 18:14:17 -05:00
daxpedda 580340f2d3 Add cfg_aliases to wgpu-core and wgpu-hal (#5055) 2024-01-14 00:59:59 -05:00
Nicolas Silva bc65d84cdb Remove the Destroyed state from Storage (#4970)
* Remove the Destroyed state from Storage

It used to be how we handled destroying buffers and textures but we moved to different approach.

* Explicit check for destroyed textures/buffers in a few entry points

This used to be checked automatically when getting the resource from the registry, but has to be done manually now that we track we track the destroyed state in the resources.
2024-01-11 10:45:12 +00:00
Jim Blandy 8af6975d5e Prefer Arc::into_inner over Arc::try_unwrap. (#5018) 2024-01-08 19:24:33 -05:00
Nicolas Silva 4b82121501 Snatch the raw texture when destroying it 2024-01-05 11:42:28 +01:00
Nicolas Silva defd43dff2 Rename Texture::as_raw into Texture::raw
For consistency with Buffer::raw.
2024-01-05 11:27:17 +01:00
Nicolas Silva bfe235a295 Put raw texture access behind snatch guards 2024-01-05 11:27:17 +01:00
Nick 00cf05c1d0 Fix Queue::write_texture, Fix DX12 write_texture_subset_2d and re-enable the test. (#4990) 2024-01-04 19:50:41 -05:00
Connor Fitzgerald d96d953025 Shorten Lock Lifetimes (#4976) 2024-01-04 09:24:54 +01:00
Nicolas SilvaandConnor Fitzgerald 85b91c0408 Buffer snatching (#4896)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-20 16:42:42 -05:00
Nicolas Silva 192a2fe16c Simplify ResourceMaps (#4880)
* Remove the abstractions in resource maps

ResourceMaps had a rather convoluted system for erasing types that isn't needed anywhere except in one place in the triage_resource function. Everywhere else we are always dealing with specific types so using a member of the resource maps is simpler than going through an abstraction. More importantly there was a constraint that all contents of the resource maps implement the Resource trait which got in the way of some of the ongoing buffer snatching changes.

This commit simplifies this by removing the abstraction. Each resource type has its hash map directly in ResourceMaps and it is easier to have different requirements and behaviors depending on the type of the each resource.
2023-12-18 08:27:58 +00:00
Nicolas Silva c5e6122b65 Reintroduce buffer snatching Part 1 (#4867)
Introduce snatch guards
2023-12-14 13:14:49 +01:00
Mauro Gentile 2c67f79970 Remove resources ONLY when needed inside wgpu and not in user land (#4782) 2023-11-27 13:09:50 +01:00
Nicolas Silva ebcfd25b58 Downgrade resource lifetime management log level to trace. (#4772)
* Downgrade resource lifetime management log level to trace.

Allow promoting it back to info via an feature flag.

* Don't filter out info and warning log in the examples.

* Changelog entry.
2023-11-25 17:33:02 +01:00
Nicolas Silva 350c9633fe Conditionally lift API logging from trace to info level (#4769)
* Conditionally lift API logging from trace to info level

Most of this logging used to be info level until I demoted it to trace. Unfortunately this gets in my way because:
 - Most of the logging I currently need is these API entry points, there is is a fair amount of more verbose logging in wgpu at higher levels than trace
 - Firefox disable all trace and debug logging for optimized builds, which means I miss the this API logging where I need most.

This patch lifts the api logging back to info level.

* Move the api logging behind the api_log macro
2023-11-24 19:14:38 +01:00
6e21f7a929 Arcanization of wgpu core resources (#3626)
Arcanization of wgpu_core resources

---------

Co-authored-by: Elabajaba <Elabajaba@users.noreply.github.com>
Co-authored-by: Niklas Korz <niklas@niklaskorz.de>
Co-authored-by: grovesNL <josh@joshgroves.com>
Co-authored-by: Jim Blandy <jimb@red-bean.com>
Co-authored-by: Mauro Gentile <Mauro.Gentile@ubisoft.com>
Co-authored-by: Sludge <96552222+SludgePhD@users.noreply.github.com>
2023-11-20 08:41:52 +01:00
Nicolas Silva 1d7c7c8a3c Prevent panic when submitting a destroyed buffer 2023-11-16 14:16:53 +01:00
Nicolas SilvaandTeodor Tanasoaia a697e4352c Keep the value in its storage after destroy (#4678)
* Keep the value in its storage after destroy

in #4657 the destroy implementation was made to remove the value from the storage and leave an error variant in its place.
Unfortunately this causes some issues with the tracking code which expects the ID to be unregistered after the value has been fully destroyed, even if the latter is not in storage anymore.
To work around that, this commit adds a `Destroyed` variant in storage which keeps the value so that the tracking behavior is preserved while
still making sure that most accesses to the destroyed resource lead to validation errors.

... Except for submitted command buffers that need to be consumed right away. These are replaced with `Element::Error` like before this commit.

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-11-14 14:23:23 +00:00
Andreas ReichandTeodor Tanasoaia f7420511d0 rename/deprecate block_size -> block_copy_size, improve docs (#4647)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-11-13 19:04:35 +00:00
Nicolas Silva 890825f395 Don't drop command buffers when submitting in wgpu_core (#4660)
Since wgpu's submit API consumes command buffers, they are dropped when submitting via wgpu but not when when using wgpu_core.
2023-11-09 19:00:23 +01:00
Nicolas SilvaandJim Blandy 8c03aa85e6 Make it possible to filter labels out ahead of wgpu-hal (#4246)
* Make it possible to filter labels out.

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2023-10-18 17:45:59 +02:00
Nicolas Silva 198e1dfadc Validate that resources belong to the right device. (#4207) 2023-10-04 14:39:03 -04:00
Nicolas Silva 9a76c483da Add trace level logging to most API entry points (#4183)
* Add trace level logging to most API entry points

* Add a changelog entry
2023-09-28 18:29:44 +02:00
Connor Fitzgerald f825ce4ac2 Fix Callback Ordering (#4036)
* Fix Callback Ordering

* Format & Changelog
2023-08-14 08:33:50 -04:00
daxpeddaandConnor Fitzgerald 88f18ed190 Don't implement Send or Sync on Wasm (#3691)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-06-29 20:31:18 +00:00
Jim Blandy 4478c52deb wgpu-core: Move Device resource methods into device::resource. 2023-05-24 09:54:03 -07:00
Jim Blandy 29914b308f wgpu-core: Move identity code to new identity module. 2023-05-24 09:54:03 -07:00
Jim Blandy 13bd3eea55 wgpu-core: Move HalAPI to new hal_api module. 2023-05-24 09:54:03 -07:00
Jim Blandy f00e6b70ea wgpu-core: Move Global to new global module. 2023-05-24 09:54:03 -07:00
Connor FitzgeraldandConnor Fitzgerald 51bf95bbd6 Make wgpu-core errors non-exhaustive (#3652)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-07 19:18:29 +02:00
Teodor TanasoaiaandConnor Fitzgerald 6918cf33d4 [metal] Fix metal erroring on an array_stride of 0 (#3538)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-04-05 22:40:15 +00:00
Erich Gubler c200597115 refactor: resolve clippy::useless_conversion 2023-03-27 19:24:16 +02:00
Teodor Tanasoaia cf40e64b16 Change type of bytes_per_row and rows_per_image (#3529) 2023-03-06 16:44:36 -05:00
Connor Fitzgerald db3be88f90 Uppercase all error strings 2023-03-03 11:33:20 -05:00
daxpedda e4445205c2 Remove emscripten crate features (#3467) 2023-02-15 21:46:00 +00:00
Teodor Tanasoaia c51edd36fd Support stencil-only views and copying to/from combined depth-stencil textures (#3436) 2023-02-15 16:20:22 -05:00
Teodor Tanasoaia b33731c44c Validate before extracting texture selectors (#3487)
Move calls to `extract_texture_selector` after calls to `validate_texture_copy_range`, to avoid overflow.
2023-02-14 12:31:18 -08:00
Connor Fitzgerald 95a760bb42 Implement queue.copy_external_image_to_texture for WebGL2 and improve WebGPU Impl (#3288)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Closes https://github.com/gfx-rs/wgpu/issues/1888
2023-01-24 18:44:15 +00:00
Connor Fitzgerald 2ecced0c88 Improve write_buffer_with Spans (#3383) 2023-01-15 03:11:14 -05:00
Leo Kettmeir f40611fd5c don't panic on mapped buffer in queue_submit (#3364) 2023-01-15 07:10:11 +01:00
Jim Blandy 8c9f3f159b queue_write_texture: Validate the destination texture. (#3378) 2023-01-14 10:35:46 +01:00
Teodor Tanasoaia 14886ee142 Sync depth/stencil copy restrictions with the spec (#3314)
* sync depth/stencil copy restrictions with the spec

* add changelog entry
2022-12-20 15:26:00 +01:00
Nicolas SilvaandConnor Fitzgerald e90aacea96 Validate texture copy ranges earlier to prevent integer overflow (#3090)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-12-01 01:20:48 +00:00
Erich Gubler 18f3f5f6f0 Enable unsafe_ops_in_unsafe_fn lint in all workspaces (#3044) 2022-11-14 10:49:39 -08:00
Nicolas Silva db30e3909a Avoid integer overflow on multiplication in write_texture. (#3146) 2022-11-07 15:31:19 -05:00
Jim Blandy 215884184b Reformat comments in wgpu-core. (#3102) 2022-10-13 18:34:44 +00:00
Jim Blandy c6ca2a7d0d Always free staging buffers (#2961)
* Have `prepare_staging_buffer` take a raw hal Device.

This helps the borrow checker understand that we can borrow
`pending_writes`'s encoder and the raw Device at the same time.

* Always free staging buffers.

We must ensure that the staging buffer is not leaked when an error
occurs, so allocate it as late as possible, and free it explicitly when
those fallible operations we can't move it past go awry.

Fixes #2959.

* Some tests for texture and buffer copies.

* Add CHANGELOG.md entry.
2022-08-13 18:25:49 -07:00
Jim Blandy 33d313cba9 Document some wgpu-core resource tracking types (#2960) 2022-08-13 20:35:57 -04:00