Commit Graph

1426 Commits

Author SHA1 Message Date
Nicolas Silva
efb35d4fa1
Snatch bind groups associated with destroyed textures and buffers (#5136)
* Make bind groups snatchable

* Snatch bindgroups when destroying associated textures and buffers.
2024-01-25 05:11:43 +00:00
Nicolas Silva
7d0f656dd9
Snatch texture views of destroyed textures (#5131) 2024-01-24 20:55:20 +01:00
Nicolas Silva
b0e4734a7e Differentiate between device loss caused by an error and caused by dropping the device 2024-01-24 13:41:23 +01:00
Nicolas Silva
8d64915b3c
Remove the lock around TextureView::parent (#5126) 2024-01-23 10:31:13 -05:00
wayne
c4b5cc94ad
don't panic if naga parsing of shader source fails (#5034)
* naga: glsl parser should return singular ParseError similar to wgsl

* wgpu: treat glsl the same as wgsl when creating ShaderModule

* naga: update glsl parser tests to use new ParseError type

* naga: glsl ParseError errors field should be public

* wgpu-core: add 'glsl' feature

* fix some minor bugs in glsl parse error refactor

* naga/wgpu/wgpu-core: improve spirv parse error handling

* wgpu-core: feature gate use of glsl and spv naga modules

* wgpu: enable wgpu-core glsl and spirv features when appropriate

* obey clippy

* naga: derive Clone in Type

* naga: don't feature gate Clone derivation for Type

* obey cargo fmt

* wgpu-core: use bytemuck instead of zerocopy

* wgpu-core: apply suggested edit

* wgpu-core: no need to borrow spirv code

* Update wgpu/src/backend/wgpu_core.rs

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>

---------

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
2024-01-23 10:25:25 -05: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
Brad Werth
ac8756c2d3
Release GPU resources from device.trackers, not from lifetime_tracker. (#5075) 2024-01-22 17:55:42 +01:00
John-John Tedro
e5c62fb5bd
vulkan: Replace fence with semaphore when acquiring surfaces (#4967) 2024-01-21 18:14:17 -05:00
Connor Fitzgerald
8b2098bd4e
Release 0.19 (#5082) 2024-01-17 14:42:11 -05:00
Andreas Reich
b8f27c7284
Expose maximum_frame_latency (#4899)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-01-17 12:46:34 -05:00
Connor Fitzgerald
2e38187954
Re-export public dependencies (#5063) 2024-01-16 19:21:51 +00:00
John-John Tedro
90b078f037
Improve ergonomics of gfx_select! (#5069) 2024-01-16 11:15:56 +01:00
dependabot[bot]
c5a0b0b7b4
Bump the patch-updates group with 12 updates (#5061)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-14 23:48:30 -05:00
Brad Werth
f89bd3b978
Make DeviceLostClosure.from_c consume the closure before dropping it. (#5032)
This clarifies that the Rust and C-style callbacks/closures need to be
consumed (not called) before they are dropped. It also makes the from_c
function consume the param closure so that it can be dropped without
panicking.

It also relaxes the restriction that the callback/closure can only be
called once.
2024-01-14 02:53:40 -05:00
daxpedda
580340f2d3
Add cfg_aliases to wgpu-core and wgpu-hal (#5055) 2024-01-14 00:59:59 -05:00
Nicolas Silva
376d901d1e
Triage suspected resources after triaging submissions (#5050) 2024-01-12 13:19:19 -05:00
Nicolas Silva
11c29c825f
Prevent a few integer overflows (#5042)
* Prevent a few integer overflows

* Add a changelog entry

* use u64
2024-01-12 16:23:23 +01:00
Andreas Reich
4fd4a7142e
Unify surface creation by introducing new SurfaceTarget enum (#4984) 2024-01-11 22:24:01 -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
Nicolas Silva
b30c0c2e00
Remove the free_resources tracker (#5037) 2024-01-11 09:41:09 +00:00
Nicolas Silva
c90f43bc2a
Move the trace recording of destroy events out of triage_resources (#5036) 2024-01-11 00:48:25 -05:00
Nicolas Silva
f27bb443c1
Don't crash if a texture is destroyed before queue submission (#5028) 2024-01-10 14:36:02 +01:00
Nicolas Silva
4400a58470
Fix a bounds check in remove_abandoned (#5024) 2024-01-09 11:24:18 -05:00
Nicolas Silva
37755b6985 Validate that a binding offset fits in the buffer 2024-01-09 16:07:47 +01:00
Nicolas Silva
58fe7eac48
Don't case the dynamic offsets count to u8 (#5026) 2024-01-09 15:41:39 +01:00
Nicolas Silva
1bc71eb8b2
Validate max_vertex_buffers in render bundles. (#5025) 2024-01-09 15:41:24 +01:00
Jim Blandy
8af6975d5e
Prefer Arc::into_inner over Arc::try_unwrap. (#5018) 2024-01-08 19:24:33 -05:00
Jim Blandy
a24bdbaa25
[wgpu-core] Minor doc fixes for initialization tracking. (#5017) 2024-01-08 16:46:57 -05:00
Nicolas Silva
c6eea50b04
Track the actual size of the buffer for memory init (#5014) 2024-01-08 17:24:09 +01:00
Nicolas Silva
8358868526
Propagate errors when openning/closing a command encoder (#4999) 2024-01-06 10:14:38 +01:00
Nicolas Silva
4b82121501 Snatch the raw texture when destroying it 2024-01-05 11:42:28 +01:00
Nicolas Silva
95c451a3b8 Check thata bindgroup's textures are not destroyed before using 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
Connor Fitzgerald
b989e56874
Use Custom Mesa for Building (#4977) 2024-01-03 22:49:40 -05:00
Connor Fitzgerald
fd37dbfae9
Fix hang in multithreaded test (#4975) 2024-01-03 23:05:35 +01:00
Nathan Adams
ec920e85d1
Fix incorrect ConfigureSurfaceError::TooLarge message (#4960)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-01-02 15:32:51 -05:00
Connor Fitzgerald
e26a853654
BGL Weak Pointer Deduplication Pool (#4927)
* Ho boy

* BGL pool finished

* Remove id32 feature

* Add BGL Test

* Iteration

* Working Dedupe

* Tests

* Iteration

* Re-iteration

* Hash Cleanup

* Add large slew of tests

* Whoops
2024-01-02 09:27:22 -05:00
Erich Gubler
e1baa5a56e docs: inline document-features usage, remove dep.
Re-implements https://github.com/gfx-rs/wgpu/pull/4886 (CC @Wumpf)
without the `document-features` crate, which has issues integrating into
Firefox builds after being `cargo vendor`ed into its repository. This
issue is being tracked against
https://github.com/slint-ui/document-features/issues/20. Once resolved,
I expect that we will want to revert this PR in its entirety, since
`document-features` is still a good addition to `wgpu`'s documentation
story.

Internally, consensus has already been achieved for this change.
Firefox's ability to build unfortunately take priority over this
particular convenience. Hopefully, we won't have to compromise shortly!

I tested this by ensuring that the HTML output of our existing
`document_features::document_features!(…)` usage was exactly the same.
There should be exactly zero regressions in the current state of
documentation for users. For maintainers, I have added a disclaimer that
one needs to keep changes in sync. with the relevant `Cargo.toml`
manifests.
2023-12-22 14:31:12 -05:00
Andrew Farkas
2993650ede
Fix typo "layout pipeline layout" -> "pipeline layout" (#4921) 2023-12-22 01:02:41 +00:00
Connor Fitzgerald
87ecc089dd Remove id32 feature 2023-12-20 21:39:24 -08:00
Brad Werth
9eea31a4ae
Eagerly release GPU resources when we lose the device. (#4851)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-20 22:43:43 +00:00
Nicolas Silva
85b91c0408
Buffer snatching (#4896)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-20 16:42:42 -05:00
Nicolas Silva
164e478fcb
Simplify some code around buffer unmapping (#4892) 2023-12-20 15:21:32 -05:00
Nicolas Silva
0524c88c03
Check that raw buffers and raw bind groups are valid (#4895) 2023-12-20 15:13:20 -05:00
sotaroikeda
1d6c7a0263
Support Device fence sharing with dx12 on Windows (#4900)
Co-authored-by: Sotaro Ikeda <you@example.com>
2023-12-20 13:33:47 -05:00
Brad Werth
56d9d32a07
[wgpu-core] Ensure that DeviceLostCallback is always called exactly once
* Ensure device lost closure is called exactly once before being dropped.

This requires a change to the Rust callback signature, which is now Fn
instead of FnOnce. When the Rust callback or the C closure are dropped,
they will panic if they haven't been called. `device_drop` is changed
to call the closure with a message of "Device dropped." A test is added.
2023-12-19 23:16:10 +00:00
Nicolas Silva
aade481bdf
Remove some locks in BindGroup (#4894)
* Remove some locks in BindGroup

These are only written to clear the vectors when triaging bindgroups for destruction, which is not necessary. We can let the reference counts drop when the bind group is dropped.

* Make the mem_leak test pass again
2023-12-19 10:29:32 +01:00