Commit Graph

435 Commits

Author SHA1 Message Date
John-John Tedro
950d765a4d Remove G parameter in Global<G> and generic IdentityHandlerFactory (#5159) 2024-01-29 15:37:57 +01:00
Nicolas Silva
6e020a079e Fix the validation for vertex limits for regular render passes (#5156) 2024-01-29 14:01:03 +01:00
John-John Tedro
dec6ea5ea4 Improve the consistency of identifiers (#5108) 2024-01-29 10:56:04 +01:00
Bude
4face1c2ba Feature/serde feature (#5149)
* Add serde, serialize, deserialize features to wgpu and wgpu-core
Remove trace, replay features from wgpu-types

* Do not use trace, replay in wgpu-types anymore

* Make use of deserialize, serialize features in wgpu-core

* Make use of serialize, deserialize features in wgpu

* Run cargo fmt

* Use serde(default) for deserialize only

* Fix serial-pass feature

* Add a comment for new features

* Add CHANGELOG entry

* Run cargo fmt

* serial-pass also needs serde features for Id<T>

* Add feature documentation to lib.rs docs

* wgpu-types implicit serde feature

* wgpu-core explicit serde feature

* wgpu explicit serde feature

* Update CHANGELOG.md

* Fix compilation with default features

* Address review comments
2024-01-28 20:13:04 +00:00
Nicolas Silva
e2e9ef5547 Fix the validation of vertex/index/instance ranges in render bundles 2024-01-26 17:26:44 +01:00
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
daxpedda
580340f2d3 Add cfg_aliases to wgpu-core and wgpu-hal (#5055) 2024-01-14 00:59:59 -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
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
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
Nicolas Silva
8358868526 Propagate errors when openning/closing a command encoder (#4999) 2024-01-06 10:14:38 +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
Connor Fitzgerald
d96d953025 Shorten Lock Lifetimes (#4976) 2024-01-04 09:24:54 +01: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
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
Nicolas Silva
a1b183f736 Avoid allocating memory every time we might log a label (#4893)
We allocate a String every time we want to get a label for logging. The string is also allocated when logging is disabled. Either way, the allocation is unnecessary. This commit replaces the String with a dyn Debug reference which does not need any allocation.
2023-12-18 13:08:18 +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
Teodor Tanasoaia
0cbabcf229 Update multi-planar texture API (#4837) 2023-12-07 14:06:56 -05:00
Xiaopeng Li
a6503e59c9 Support nv12 texture format (#4573)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-11-28 16:11:26 +00: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
ca4e1313f7 Downgrade some of wgpu_core's logging level from info to trace and debug (#4771)
* Downgrade storage log level from info to trace

* Downgrade tracking log level from info to trace

* Demote present log from info to debug

* Downgrade device/life.rs log from info to debug and trace

* Downgrade more log from info to trace
2023-11-24 20:09:36 +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
7dad106039 Make the command_encoder_clear_buffer's size an Option<BufferAddress> (#4737)
* Make the size parameter of command_encoder_clear_buffer an Option<BufferAddress>

* Add a changelog entry
2023-11-22 11:42:34 +01:00
Nicolas Silva
6786548d1e Fix max_vertex_buffers validation (#4708) 2023-11-20 10:17:19 +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
Andreas Reich
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
9fd13dcce3 Validate max_vertex_buffers in set_vertex_buffer (#4574) 2023-10-26 19:48:03 -04:00
Nicolas Silva
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
32b761a591 Implement a missing part of bind group layout deduplication (#4200)
* Don't create a raw bind group layout for duplicates.

* Fully support bind group layout deduplication in Pipeline::get_bind_group_layout

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-04 11:12:19 +02: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
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
daxpedda
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
Pieter-Jan Briers
acb7712c5a Allow empty scissor rects (#3863) 2023-06-15 15:49:06 -04:00