72 Commits

Author SHA1 Message Date
teoxoy
487f79ba44 Add missing device validity checks 2025-07-02 11:11:37 +02:00
Erich Gubler
964c5bbf4c feat(core): impl WebGpuError for API errors 2025-06-30 10:58:56 -04:00
Andy Leiserson
3a5d0f2747 Deferred error reporting for other command encoder operations
* clear commands
* query set functions
* command_encoder_as_hal_mut
* ray_tracing
2025-06-17 16:17:43 -07:00
Andy Leiserson
77d2b0017a
Split EncoderStateError from CommandEncoderError (#7779) 2025-06-10 09:46:30 -07:00
Connor Fitzgerald
c344bec508 Comments 2025-04-03 10:35:20 -04:00
Connor Fitzgerald
6a986f4bc4 Timestamp normalization 2025-04-03 10:35:20 -04:00
Kevin Reid
7bcbfe0712 wgpu-core: Adjust imports to allow no_std.
Dependencies on `std` that still exist:
* Locks
* `std::error::Error` (waiting for Rust 1.81)
* `std::os::raw::c_char` for FFI
* `thread_local` and `Backtrace` in `snatch`
2025-02-21 08:47:16 +01:00
JMS55
0fc0b35899
Transition resources (#6678)
* WIP

* Fix typo

* WIP: Implement structure of  command_encoder_transition_resources

* WIP

* More work

* Clippy

* Fix web build

* Use new types for API, more docs

* Add very basic test

* Try to fix test cfg

* Fix merge

* Missed commit

* Use wgt types instead of hal types

* Implement `Clone` for `ShaderModule` (#6939)

* Move to dispatch trait, move more things to wgt

* Move existing code to use new wgt types

* Fixes

* Format import

* Format another file

* Fixes

* Make module private

* Fix imports

* Fix test imports

* Rexport types

* Fix imports

* Fix import

---------

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-24 00:54:19 -05:00
Erich Gubler
3b3e1939f9
Eliminate overflow in query set bounds checks (#6933) 2025-01-17 16:36:22 +00:00
teoxoy
a5c3be575e remove device arg from all CommandEncoder methods 2024-12-20 15:44:15 +01:00
teoxoy
02b28e28f0 use EncoderGuard for the other command encoder operations
The spec requires us to invalidate the encoder if there was any error during the body of these operations.
2024-12-02 15:59:14 -08:00
teoxoy
5e1fbd7176 move CommandEncoderStatus on the CommandBuffer and change its variants to hold CommandBufferMutable
This makes the code more straightforward, we were previously holding invalidity state in 2 places: `CommandBuffer::data` could hold `None` and in `CommandEncoderStatus::Error`.

This commit also implements `Drop` for `CommandEncoder` which makes the destruction/reclamation code automatic. We were previously not reclaiming all command encoders (`CommandBufferMutable::destroy` didn't call `release_encoder`) even though all encoders are coming from a pool.
2024-12-02 15:59:14 -08:00
Erich Gubler
6365e2dd75 fix(core): validate dst_buffer isn't destroyed when resolving query sets 2024-11-21 23:23:15 -05:00
Erich Gubler
be50bdfc18 fix(core): validate bounds of pass timestamp writes' indices 2024-11-21 23:22:15 -05:00
teoxoy
ac74f36590 [wgpu-core] rename .strict_get() to .get() 2024-09-10 11:58:54 +02:00
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
b14fe14e88 [wgpu-core] use Fallible for QuerySet 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
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
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
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
b0cc0d2ebc use QuerySet.raw() instead of QuerySet.raw.as_ref().unwrap() 2024-08-13 00:55:32 +02:00
teoxoy
152a7e7dd0 remove unnecessary PhantomData 2024-07-09 10:48:52 +02:00
teoxoy
e26d2d7763 move command buffer resolving in Global's methods 2024-07-03 15:01:41 +02:00
teoxoy
dbcb273188 remove StatelessTracker.add_single 2024-07-03 15:01:41 +02:00
teoxoy
3547138716 remove PrettyError 2024-07-02 18:06:19 +02:00
teoxoy
1841857fea use .check_usage() for QUERY_RESOLVE 2024-07-02 18:06:19 +02:00
teoxoy
a4bb5dff2b rename error variants that contain IDs 2024-07-02 18:06:19 +02:00
teoxoy
c63f0a02f2 introduce Trackable trait 2024-07-02 18:06:19 +02:00
teoxoy
3c389b9057 resolve occlusion query set prior to render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
8ee9df9eb3 move same device check and tracker insertion inside validate_and_begin_pipeline_statistics_query 2024-06-27 10:20:11 +02:00
teoxoy
06da3e88d0 remove IDs from QueryResetMap 2024-06-25 11:14:41 +02:00
teoxoy
7bd9195aa2 take resource lookup out of StatelessTracker.add_single 2024-06-20 16:34:17 +02:00
teoxoy
a024afe182 consolidate destroyed texture/buffer errors and separate them from invalid ID errors 2024-06-20 16:34:17 +02:00
teoxoy
a979d2ed46 simplify BufferTracker.set_single's return type 2024-06-20 16:34:17 +02:00
teoxoy
43177d78d6 replace uses of Id.backend() with A::VARIANT 2024-06-20 16:34:17 +02:00
teoxoy
ce716adb5e improve device mismatch errors 2024-06-19 11:15:38 +02:00
teoxoy
53f8477b15 validate for same device via Arc::ptr_eq rather than IDs 2024-06-19 11:15:38 +02:00
Andreas Reich
9a27ba53ca
Fix QuerySet ownership of ComputePass (#5671)
* add new tests for checking on query set lifetime

* Fix ownership management of query sets on compute passes for write_timestamp, timestamp_writes (on desc) and pipeline statistic queries

* changelog entry
2024-06-04 07:47:27 +00:00
teoxoy
895879b8c6 [wgpu-core] validate that all resources passed to encoder commands belong to the same device as the encoder 2024-04-16 15:02:41 +02:00
Andreas Reich
f350f28c35
Separate native-only feature for wgpu::CommandEncoder::write_timestamp (#5188)
* split out TIMESTAMP_QUERY_INSIDE_ENCODERS from TIMESTAMP_QUERY

* changelog entry

* update changelog change number

* fix web warnings

* single line changelog

* note on followup issue
2024-02-13 16:03:33 +00:00
John-John Tedro
950d765a4d
Remove G parameter in Global<G> and generic IdentityHandlerFactory (#5159) 2024-01-29 15:37:57 +01:00
John-John Tedro
dec6ea5ea4
Improve the consistency of identifiers (#5108) 2024-01-29 10:56:04 +01:00
Nicolas Silva
8358868526
Propagate errors when openning/closing a command encoder (#4999) 2024-01-06 10:14:38 +01:00
Nicolas Silva
0524c88c03
Check that raw buffers and raw bind groups are valid (#4895) 2023-12-20 15:13:20 -05:00
Nicolas Silva
c5e6122b65
Reintroduce buffer snatching Part 1 (#4867)
Introduce snatch guards
2023-12-14 13:14:49 +01:00
Mauro Gentile
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
Christopher Fleetwood
3305e88d63
feature: Timestamp queries (#3636)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-08-02 18:04:24 -04:00
Valaphee The Meerkat
494ae1a815
Add support for occlusion queries (#3402)
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-08-02 19:05:59 +00:00
Jim Blandy
4d1fbeb753 wgpu-core: Move storage code to new storage module. 2023-05-24 09:54:03 -07:00