Commit Graph
261 Commits
Author SHA1 Message Date
Nicolas Silva d47534ed9a Discard draws when the instance/vertex/index count is zero (#5137) 2024-01-25 09:06:29 +01:00
Nicolas Silva 7d0f656dd9 Snatch texture views of destroyed textures (#5131) 2024-01-24 20:55:20 +01:00
Nicolas Silva 8d64915b3c Remove the lock around TextureView::parent (#5126) 2024-01-23 10:31:13 -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
Nicolas Silva 58fe7eac48 Don't case the dynamic offsets count to u8 (#5026) 2024-01-09 15:41:39 +01:00
Nicolas Silva 8358868526 Propagate errors when openning/closing a command encoder (#4999) 2024-01-06 10:14:38 +01:00
Connor Fitzgerald d96d953025 Shorten Lock Lifetimes (#4976) 2024-01-04 09:24:54 +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 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
Mikko Lehtonen 159ac9e373 validation: More detailed on incompatible BGL (#4826) 2023-12-17 18:22:39 -05:00
Nicolas Silva c5e6122b65 Reintroduce buffer snatching Part 1 (#4867)
Introduce snatch guards
2023-12-14 13:14:49 +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
Nicolas Silva 6786548d1e Fix max_vertex_buffers validation (#4708) 2023-11-20 10:17:19 +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 9fd13dcce3 Validate max_vertex_buffers in set_vertex_buffer (#4574) 2023-10-26 19:48:03 -04: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
Brad Werth 5034756948 Use DeviceError::Lost to represent device loss. (#4238) 2023-10-14 00:02:08 -04:00
Nicolas Silva 198e1dfadc Validate that resources belong to the right device. (#4207) 2023-10-04 14:39:03 -04:00
Nicolas Silva 9ff61fee9f Trace logging adjustments (#4188) 2023-10-02 09:05:56 +02: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
Brad Werth 57f8757fad Add device destroy method (#4163)
Plus tests that ensure that an invalid device behaves correctly.
Mostly a stub implementation otherwise.
2023-09-27 14:34:23 +02:00
Nicolas Silva 399637e2b8 Bind group layout dedup (#3925)
* Remove generic parameter in compat::Manager.

The code is specific to bind group layout ids and the generic parameter gets in the way.

* Add a test.

The test actually covers wgpu's configuration where deduplication does not require the indirection rather than the new code. I used it to debug the new code with the configuration hard-coded. It's tedious to add a test to cover dedpuplication of bind group layouts for users of wgpu_core to provide their IDs, we can rely on the CTS which has test for that.

* Implement bind group layout deduplication for all configurations

Currently wgpu-core implement bind group layout deduplication only when it creates its own resource IDs. In other words it works for wgpu but not in Firefox.
This PR bridges the gap by allowing an optional indirection in bind group layouts: each BGL may store an ID referring to its "deduplicated" BGL.
When referring to a BGL the rest of the code must make sure to follow the indirection. The exception is command buffer processing which is considered hot code and where we first validate against the provided BGL ID and only follow the indirection if the initial check failed.

The main pain point with this approach is the various places where wgpu-core manually updates reference counts: we have to be careful about following the indirection to track the right BGL.

* Avoid making decisions based on the size of some generic type.
2023-08-25 21:48:22 +02:00
James0124 7544af0f83 Add validation in accordance with WebGPU setViewport valid usage fo… (#4058)
* Add validation in accordance with WebGPU `setViewport` valid usage for `x`, `y` and `this.[[attachment_size]]`.

`x` and `y` must not be negative, and the rect must be contained in the render target.

* Add changelog entry.
2023-08-15 09:15:19 +02:00
Teodor Tanasoaia c7da76a4c6 Validate DownlevelFlags::READ_ONLY_DEPTH_STENCIL (#4031) 2023-08-11 16:34:35 -04:00
Connor Fitzgerald d11d2f96dc Fix Occlusion Queries on Mac (#4001) 2023-08-02 19:10:21 -04:00
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
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
Pieter-Jan Briers acb7712c5a Allow empty scissor rects (#3863) 2023-06-15 15:49:06 -04:00
Connor Fitzgerald 1d2a667b71 Fix trying to use a renderpass inside a compute pass (#3828)
* Fix trying to use a renderpass inside a compute pass

* Fix pipeline statistics test on mac

* Changelog
2023-06-05 09:05:59 -04:00
Jim Blandy 4d1fbeb753 wgpu-core: Move storage code to new storage module. 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
Erich Gubler 0f0044f358 fix(wgpu-core)!: use u32 indices for bind group layouts everywhere (#3743) 2023-05-03 20:56:54 -04: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 Tanasoaia ac689cbe1f Update feature documentation (#3534) 2023-03-03 12:09:17 -05:00
Connor Fitzgerald db3be88f90 Uppercase all error strings 2023-03-03 11:33:20 -05:00
Connor Fitzgerald c98f4ed662 Improve RenderPass attachment errors 2023-03-03 11:33:20 -05:00
Connor Fitzgerald 38f1f0ede0 Improve RenderPass/RenderBundle compatibility errors 2023-03-03 11:33:20 -05:00
Elabajaba 1e27fd4afb fix clippy for rust 1.67 (#3435)
* clippy --fix

* elide lifetimes

* fmt and more fixes

* disable clippy::needless_borrowed_reference as it clashes with clippy::pattern_type_mismatch

* missed flags for target=wasm32-unknown-unknown
2023-02-01 23:06:03 +01:00
Jinlei Li 0d433214c7 validate the number of color_attachments in begin_render_pass (#3404) 2023-01-25 14:48:27 -05:00
Teodor Tanasoaia 964c94a02d Update TextureView validation (#3410)
* update TextureView validation

* add changelog entry

* remove call to clone

* dereference instead
2023-01-24 12:02:16 +01:00
Connor Fitzgerald 3ce5ca866b Improve dynamic offset binding errors (#3294) 2022-12-15 00:53:42 +00:00
Erich Gubler 18f3f5f6f0 Enable unsafe_ops_in_unsafe_fn lint in all workspaces (#3044) 2022-11-14 10:49:39 -08:00
Ali 3c82a4cd5c Added support for MSAA(x2,x8) beyond WEBGPU restrictions for native a… (#3140)
Closes https://github.com/gfx-rs/wgpu/issues/2910
2022-11-09 15:19:05 -05:00
Jim Blandy 215884184b Reformat comments in wgpu-core. (#3102) 2022-10-13 18:34:44 +00:00
Jim Blandy fa4d8401e8 Use std::fmt::Formatter::debug_struct for RenderPass. (#3100) 2022-10-13 14:00:54 -04:00
Jim Blandy 2cd08a1c9c Placate Clippy 0.1.63. (#2977) 2022-08-24 17:25:59 -04:00
Sébastien Marleau 2ce1318c8c fix deduplication not taking into account render bundles (#2867) 2022-07-10 22:15:52 +00:00
Connor Fitzgerald 464b61d01c Flip span labels to work better with tools (#2820) 2022-06-28 19:49:51 +00:00