Commit Graph

1838 Commits

Author SHA1 Message Date
John-John Tedro
f45d500c1c Remove HalSurface and fix layout assumptions in AnySurface and AnyDerive 2024-02-02 14:31:28 -05:00
John-John Tedro
84ba4e5461
Remove another unused A: HalApi parameter (#5181) 2024-02-01 14:03:46 +01:00
Nicolas Silva
617050ec16
Always serialize and deserialize ids the same way (#5182) 2024-02-01 13:29:50 +01:00
Nicolas Silva
d7bbababa7
Add information to some of the api logging (#5174) 2024-01-31 09:55:46 -05:00
Andreas Reich
45957088ad
Fix panic when creating a surface while no backend is available (#5166)
* Fix panic when creating a surface while no backend is available

* changelog entry
2024-01-31 08:48:33 +00:00
Brad Werth
0888a630a0
Call device lost callback when it is replaced, or when the global is dropped. (#5168)
This fixes two cases where a DeviceLostClosureC might not be consumed
before it is dropped, which is a requirement:

1) When the closure is replaced, this ensures the to-be-dropped closure
is invoked.
2)  When the global is dropped, this ensures that the closure is invoked
before it is dropped.

The first of these two cases is tested in a new test,
DEVICE_LOST_REPLACED_CALLBACK. The second case has a stub,
always-skipped test, DROPPED_GLOBAL_THEN_DEVICE_LOST. The test is
always-skipped because there does not appear to be a way to drop the
global from within a test. Nor is there any other way to reach
Device.prepare_to_die without having first dropping the device.
2024-01-31 08:15:45 +01:00
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
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
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
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
Mikko Lehtonen
159ac9e373
validation: More detailed on incompatible BGL (#4826) 2023-12-17 18:22:39 -05:00
Andreas Reich
ba56dd2901
Document wgpu & wgpu-core features (#4886) 2023-12-17 22:10:38 +00:00
Nicolas Silva
10dd5844ac
Allow clippy::pattern_type_mismatch (#4887) 2023-12-17 15:00:02 -05:00
daxpedda
2053358d89
Add wgpu crate features for backends (#4815)
* Introduce `dx12` and `metal` crate features to `wgpu`

* Implement dummy `Context` to allow compilation with `--no-default-features`

* Address review

* Remove `dummy::Context` in favor of `hal::api::Empty`

* Add changelog entry

* Panic early in `Instance::new()` if no backend is enabled

Co-Authored-By: Andreas Reich <1220815+Wumpf@users.noreply.github.com>

---------

Co-authored-by: Andreas Reich <1220815+Wumpf@users.noreply.github.com>
2023-12-16 10:39:53 +01:00
Nicolas Silva
855b06977f
Refactor create_buffer so that we can snatch the raw buffer in the error path. (#4878)
The general idea is to register postpone reigistering the buffer until towards the end of the function so that our unique reference to it lets us easily snatch the raw buffer if an error happens.
2023-12-15 10:08:03 +01: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
Connor Fitzgerald
dc842ae289
Some minor cleanups (#4843) 2023-12-07 08:55:02 +01:00
Daniel Keitel
0f4df52b5a
[wgpu-hal] Inline RayQuery Support (#3507)
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-06 21:12:41 +00:00
daxpedda
3e0fb2c14e
Expose shader validation (#4811)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-06 21:06:04 +00:00
Valaphee The Meerkat
a1fafe394f
Remove DX11 backend (#4828) 2023-12-06 15:12:46 -05:00
Nicolas Silva
537f656626
Use Display instead of Debug to log errors. (#4830) 2023-12-04 18:49:33 -05:00
Almar Klein
32c5a22293
Add feature float32-filterable (#4759) 2023-12-04 14:23:13 +01:00
teoxoy
acdc9fcced move alignments & downlevel .clone()s inside function 2023-11-29 19:55:18 +01:00
teoxoy
da73522720 rename DeviceDescriptor.limits to DeviceDescriptor.required_limits 2023-11-29 19:55:18 +01:00
teoxoy
9be6c8890f rename DeviceDescriptor.features to DeviceDescriptor.required_features 2023-11-29 19:55:18 +01:00
Andreas Reich
8da4925948
Remove surface extent validation (and thus fix the annoying Requested size ... is outside of the supported range warning) (#4796)
* Remove surface extent validation

* silence pnext vulkan validation warning which can happen on surface resize

* remove old VUID-VkSwapchainCreateInfoKHR-imageExtent-01689 validation warning ignore

* Validate surface against max texture size
2023-11-29 18:21:26 +01:00
Jim Blandy
276c978b70 [naga] Introduce ScalarKind::AbstractInt and AbstractFloat.
Introduce new variants of `naga::ScalarKind`, `AbstractInt` and
`AbstractFloat`, for representing WGSL abstract types.
2023-11-29 08:58:47 +01:00
dependabot[bot]
723b8baf2a
Bump web-sys from 0.3.65 to 0.3.66 (#4800)
Bumps [web-sys](https://github.com/rustwasm/wasm-bindgen) from 0.3.65 to 0.3.66.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: web-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-29 02:03:18 -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
Mauro Gentile
238c3732a4
Don't keep a strong ref in storage for destroyed resources (#4786) 2023-11-27 13:37:09 +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
TÖRÖK Attila
2964eed6f9
Bump web-sys to 0.3.65 (#4777) 2023-11-26 17:54:29 -05:00
Mauro Gentile
281a7aecd5
remove_abandoned fix (#4781)
* remove_abandoned fix

* Updated doc
2023-11-26 14:58:00 +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
039660ec85
Logging cleanups in device/global.rs (#4752)
* Clean up the trace-level logging for devices

* Log the descriptors for create_buffer and create_texture.

* Make logged ids more concise

Logged ids go from 'Id { index: 204, epoch: 1, backend: Vulkan }' to 'Id(204,1,vk)'.

* Log errors in more places.
2023-11-22 19:28:55 +00: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
Brad Werth
877dd5b26c
Ensure DeviceLostClosureC callbacks have null-terminated message strings. (#4744) 2023-11-22 09:00:28 +01:00
Connor Fitzgerald
1df98d9888
Test And Normalize Vertex Behavior on All Backends (#4723)
Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-11-21 22:11:24 +00:00
Jim Blandy
72462267e8 [naga]: Let TypeInner::Matrix hold a Scalar, not just a width.
Let `naga::TypeInner::Matrix` hold a full `Scalar`, with a kind and
byte width, not merely a byte width, to make it possible to represent
matrices of AbstractFloats for WGSL.
2023-11-21 12:02:50 +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
Teodor Tanasoaia
a26e4a009a
[naga] remove span and validate features (#4706) 2023-11-17 13:37:25 -05:00
Nicolas Silva
1d7c7c8a3c Prevent panic when submitting a destroyed buffer 2023-11-16 14:16:53 +01:00
Nicolas Silva
b47fe3b413 Prevent panic in buffer mapping logic if the buffer is already destroyed. 2023-11-15 13:58:16 +01:00
Nicolas Silva
f5665f73bd Prevent panic in untrack if a resource is already destroyed 2023-11-15 12:15:16 +01:00
Nicolas Silva
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
Jim Blandy
9f91c95c24 [naga] Introduce Scalar type to IR.
Introduce a new struct type, `Scalar`, combining a `ScalarKind` and a
`Bytes` width, and use this whenever such pairs of values are passed
around.

In particular, use `Scalar` in `TypeInner` variants `Scalar`, `Vector`,
`Atomic`, and `ValuePointer`.

Introduce associated `Scalar` constants `I32`, `U32`, `F32`, `BOOL`
and `F64`, for common cases.

Introduce a helper function `Scalar::float` for constructing `Float`
scalars of a given width, for dealing with `TypeInner::Matrix`, which
only supplies the scalar width of its elements, not a kind.

Introduce helper functions on `Literal` and `TypeInner`, to produce
the `Scalar` describing elements' values.

Use `Scalar` in `wgpu_core::validation::NumericType` as well.
2023-11-14 14:21:27 +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
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 Silva
1dc5347b14
Better handle destroying textures and buffers (#4657)
* Better handle destroying textures and buffers

Before this commit, explicitly destroying a texture or a buffer (without dropping it)
schedules the asynchronous destruction of its raw resources but does not actually mark
it as destroyed. This can cause some incorrect behavior, for example mapping a buffer
after destroying it does not cause a validation error (and later panics due to the
map callback being dropped without being called).

This Commit adds `Storage::take_and_mark_destroyed` for use in `destroy` methods.
Since it puts the resource in the error state, other methods properly catch that
the resource is no longer usable when attempting to access it and raise validation
errors.

There are other resource types that require similar treatment and will be addressed
in followup work.

* Add a changelog entry
2023-11-09 15:48:06 +01:00
Brad Werth
4e65eca1e8
More complete implementation of "lose the device". (#4645)
* More complete implementation of "lose the device".

This provides a way for wgpu-core to specify a callback on "lose the
device". It ensures this callback is called at the appropriate times:
either after device.destroy has empty queues, or on demand from
device.lose.

A test has been added to device.rs.

* Updated CHANGELOG.md.

* Fix conversion to *const c_char.

* Use an allow lint to permit trivial_casts.

* rustfmt changes.
2023-11-08 22:22:18 +01:00
Brad Werth
7aaf672576
Ensure that pipeline creation errors register layouts as errors also (#4624)
Since the pipeline id is provided by the caller, the caller may presume
that an implicit pipeline layout id is also created, even in error
conditions such as with an invalid device. Since our registry system
will panic if asked to retrieve a pipeline layout id that has never been
registered, it's dangerous to leave that id unregistered. This ensures
that the layout ids also get error values when the pipeline creation
returns an error.
2023-11-06 15:53:31 -05:00
Teodor Tanasoaia
261cb7c27d Check if source is empty when constructing hal::DebugSource 2023-11-06 14:32:29 +01:00
Connor Fitzgerald
873f19dec6
Fix Panic in Surface Configure (#4635) 2023-11-06 02:09:41 +00:00
daxpedda
37fe6a5424
Mark some methods unsafe (#4596) 2023-10-29 23:59:48 -04:00
TornaxO7
4c5a817071
Bump raw window handle to 0.6.0 (#4202)
Co-authored-by: junglie85 <junglie85@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-27 05:24:46 +00:00
Connor Fitzgerald
2a9fdf9aa1
Misc Repo Cleanup Tasks (#4579)
* Misc Repo Cleanup Tasks

* Dependency Trimming

* Dep cleanup

* Restrict libfuzzer

* Flip cfg

* mod fuzz
2023-10-27 00:15:51 -04:00
Nicolas Silva
9fd13dcce3
Validate max_vertex_buffers in set_vertex_buffer (#4574) 2023-10-26 19:48:03 -04:00
DevJac
6b859a15d8
Improve error message: "Format Bgra8UnormSrgb can't be multisampled" (#4294)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-26 01:36:32 -04:00
Connor Fitzgerald
34e947de4b
Integration of Naga into Repo (#4296) 2023-10-25 16:51:36 -04:00
Connor Fitzgerald
92f4207bc0
Release v0.18.0 (#4295) 2023-10-25 17:53:22 +00:00
wicast
9dc57617e4
feat(spv): shader debug option (#4028)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-23 23:44:04 +00:00
Valaphee The Meerkat
92d237fd93
Fix missing feature checks for dx11 and dx12 (#4287) 2023-10-23 18:49:17 +00:00
Teodor Tanasoaia
ead6348b43
Set the new naga Capabilities::CUBE_ARRAY_TEXTURES (#4263) 2023-10-18 12:13:21 -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
Jim Blandy
da0b3fe685
Let the "strict_asserts" feature enable Token::root assertions. (#4258) 2023-10-17 23:00:39 -04:00
Nicolas Silva
7461781a59 Make deduplication work in compute_pipeline_get_bind_group_layout 2023-10-17 18:04:12 -07:00
Nicolas Silva
a848648943 Fix locking order in render_pipeline_get_bind_group_layout 2023-10-17 18:04:12 -07:00
Teodor Tanasoaia
c07d889f1b
Update naga to 0.13.0@git:6854b0ab4f105131bfb87704927abec3fe366ef9 (#4254) 2023-10-17 15:49:12 +00:00
Brad Werth
5034756948
Use DeviceError::Lost to represent device loss. (#4238) 2023-10-14 00:02:08 -04:00
Nicolas Silva
ff306d20e0
Add support for bgra8unorm-storage (#4228)
* Add `BGRA8UNORM_STORAGE` extension

* Leave a comment in the backends that don't support bgra8unorm-storage

* Pass the appropriate storage format to naga

* Check for bgra8unorm storage support in the vulkan backend

* Add a test

Co-authored-by: Jinlei Li <jinleili0@outlook.com>
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-10-13 10:07:11 +00:00
Jim Blandy
9df73c5c6e
Update naga to 0.13.0@git:9eb3a1dc (const expressions) (#4233) 2023-10-12 11:56:46 -04:00
Nicolas Silva
f95d1c55e3
Expose Instance flags (#4230)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-11 17:39:04 +00:00
Colin Edwards
0f7b530ea8
Add WinUI 3 SwapChainPanel support (#4191) 2023-10-11 13:36:30 -04:00
Erich Gubler
c1748b2fea
Make more HAL APIs require Debug (#4226) 2023-10-11 13:31:37 -04:00
Nicolas Silva
b3135b9320
Properly handle user callbacks in surface_configure (#4227)
* Properly handle user callbacks in surface_configure

* Add a changelog entry
2023-10-11 09:35:00 +02:00
Nicolas Silva
35ebd4a528
Update naga to 0.13.0@git:33b75a27d93c6574b11b4dd4492b85b5783d6c52 (#4229) 2023-10-10 16:54:07 +00:00
Nicolas Silva
2664da88b0
Update naga to 0.13.0@git:3c7dbc4016b84a35c69b30305b12abaeefc21fd9 (#4221) 2023-10-09 16:39:22 +00:00
TornaxO7
a5b9ebb3c9
fix clippy warnings and errors (#4205)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-09 16:34:06 +00:00
Nicolas Silva
651299b870
Handle user callbacks in surface_configure (#4220) 2023-10-09 12:06:00 -04:00
Brad Werth
e6097ce3d4
Make buffer_map and buffer_unmap check for device validity, add tests. (#4212)
* Make buffer_unmap check for device validity, add tests.

This patch makes buffer_unmap check for a valid device, and corrects
buffer_map to return the appropriate error for an invalid device.
Tests are added for both operations.

It also adds device validity checks to device_maintain_ids and to the
functions that get and set buffer sub data.

* Update changelog and test comment.

* Run rustfmt.

* Update test device_lose_then_more to specify more buffer usages to keep Vulkan happy.
2023-10-07 16:28:07 +02: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
Connor Fitzgerald
93d2e5b4ba
Split MSRV in Two Parts (#4204)
* Split MSRV in two parts

* Use toml

* Fix CI

* Update names and cache hits for various jobs

* Comment
2023-10-03 21:03:32 -04:00
Teodor Tanasoaia
fd02a12726
Make GLES optional on Windows & macOS (#4185) 2023-10-03 16:16:24 -04:00
Teodor Tanasoaia
422c636877
Add Rgb10a2Uint format (#4199) 2023-10-03 14:56:21 +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
Aaron Hill
2b4a8b318f
wgpu-core: Only produce StageError::InputNotConsumed on DX11/DX12 (#4116)
* wgpu-core: Only produce StageError::InputNotConsumed on DX11/DX12

This error only exists due to an issue with naga's HLSL support:
https://github.com/gfx-rs/naga/issues/1945
The WGPU spec itself allows vertex shader outputs that are
not consumed by the fragment shader.

Until the issue is fixed, we can allow unconsumed outputs on
all platforms other than DX11/DX12.

* Add Features::SHADER_UNUSED_VERTEX_OUTPUT to allow disabling check

* Pick an unused feature id
2023-09-20 21:02:37 -04:00
Frederik Magnus Johansen Vestre
dc5beac8c9
Support dual source blending (#4022)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-09-19 13:26:30 +02:00
Jim Blandy
471229a48f
Update Naga to df8107b7 (2023-9-15). (#4149) 2023-09-17 15:39:16 -04:00
Nicolas Silva
012304ea11
Update naga to 0.13.0@git:cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c (#4130)
Co-authored-by: Nicolas Silva <nical@fastnmail.com>
2023-09-11 15:57:43 +02:00
Connor Fitzgerald
4235b0dd1c
Fix D3D12 Surface Leak (#4106) 2023-09-05 18:06:33 +00:00
Jim Blandy
7634ae6112 wgpu_core: Add logging to Instance::new.
For each backend `blah`, log::debug/trace whether we were able to
populate `Instance::blah`.
2023-09-05 13:47:27 -04:00
Rajesh Malviya
625afc3b42
Drop texture clear_views in surface_texture_discard (#4057) 2023-08-30 17:58:47 -04: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
Jim Blandy
636bef9cd5 Tracker mod docs: fix explanation of index re-use. 2023-08-19 17:06:07 -07:00
Pieter-Jan Briers
e973a06268
Allow specifying minor GLES3 version (#3998) 2023-08-16 11:51:56 -04: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
Nicolas Silva
50cfc541aa
Update naga to 0.13.0@git:7a19f3af909202c7eafd36633b5584bfbb353ecb (#4051) 2023-08-15 00:09:53 +02:00
Connor Fitzgerald
f825ce4ac2
Fix Callback Ordering (#4036)
* Fix Callback Ordering

* Format & Changelog
2023-08-14 08:33:50 -04: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
Teodor Tanasoaia
48078a800a
Derive storage bindings via naga::StorageAccess instead of naga::GlobalUse (#3985)
Removes the feature check for read-only and read-write storage textures as it's later checked by `create_bind_group_layout`.

335f40f85a/wgpu-core/src/device/resource.rs (L1505-L1518)

Also removes the `GlobalUse` checks from `check_binding_use` as naga is already checking those.

535701f6b2/src/valid/interface.rs (L639-L669)
2023-07-31 15:30:47 +02:00
Teodor Tanasoaia
01160c3ad1
Revert "Make shader write&read storage buffers match non readonly layouts" (#3984) 2023-07-27 12:33:05 -04:00
Connor Fitzgerald
493ff2e564 Bump wgpu versions 2023-07-20 23:14:11 -04:00
amfaber
a60efbde96
Expose TextureUsages in SurfaceCapabilities (#3874)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-07-19 22:57:41 +00:00
Aaron Hill
fd5550cc89
Make RequestAdapterOptions.power_preference optional (#3903)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-07-19 21:04:31 +00:00
dependabot[bot]
db87ee8f20
Bump js-sys from 0.3.63 to 0.3.64 (#3861)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-07-19 16:30:14 -04:00
Nicolas Silva
80d19d890c
Update naga to 0.12.0@git:409239c0e2313bfd0dc4fd64f8c3021185ccef1b (#3935) 2023-07-18 13:25:48 +02:00
Nicolas Silva
7198d60f68
Validate that BufferDescriptor::usage is not zero (#3928)
* Validate that BufferDescriptor::usage is not zero.

* Add a changelog entry.
2023-07-14 22:41:34 +02:00
AdrianEddy
e85cc91b5d
Add support for importing external buffers (#3355) 2023-07-07 18:00:08 -04:00
Fredrik Fornwall
17143c149c
Make shader write&read storage buffers match non readonly layouts (#3893) 2023-06-29 22:30:34 +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
Leo Kettmeir
973cd3ebf8
feat: add link feature (#3853) 2023-06-28 12:30:28 +02:00
Pieter-Jan Briers
acb7712c5a
Allow empty scissor rects (#3863) 2023-06-15 15:49:06 -04:00
Teodor Tanasoaia
dcad7dfba9
Update naga to 0.12.0@git:76003dc0035d53a474d366dcdf49d2e4d12e921f (#3866) 2023-06-14 18:55:33 +02:00
Connor Fitzgerald
10172e1f38
Move Examples and Tests to Their Own Crates (#3841)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-06-10 18:35:46 +00: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
4478c52deb wgpu-core: Move Device resource methods into device::resource. 2023-05-24 09:54:03 -07:00
Jim Blandy
286d625428 wgpu-core: Move device/mod.rs's Global impl to device/global.rs. 2023-05-24 09:54:03 -07:00
Jim Blandy
55e3558db4 wgpu-core: Move Resource trait to resource module. 2023-05-24 09:54:03 -07:00
Jim Blandy
4d1fbeb753 wgpu-core: Move storage code to new storage module. 2023-05-24 09:54:03 -07:00
Jim Blandy
17d5361879 wgpu-core: Move registry code to new registry 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
Malek
dafc189d6b
Fix multiview rendering (#3779) 2023-05-19 00:03:57 -04:00
Erich Gubler
0f0044f358
fix(wgpu-core)!: use u32 indices for bind group layouts everywhere (#3743) 2023-05-03 20:56:54 -04:00
Jim Blandy
49800337d1
Define wgpu_core::Global::create_render_bundle_error. (#3746) 2023-05-03 14:17:18 -07:00
Erich Gubler
3e562aaeaa
docs: note feature req. for Depth32FloatStencil8 (#3734)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-05-03 10:08:52 +00:00
Timo Kösters
4220a42139
Fix typo (#3719)
The error previously printed "otherusages" without a space
2023-04-28 23:15:08 +02:00
Erich Gubler
2571af9557
refactor: resolve clippy::redundant_clone (#3717) 2023-04-24 17:07:08 +02:00
Connor Fitzgerald
011a4e26d0
Release v0.16.0 (#3707)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-19 22:06:21 +00:00
daxpedda
85fc427470
Adjust internal canvas size on Surface::configure() (#3690) 2023-04-19 21:09:31 +00:00
Jinlei Li
62ea7813e4
Implement Features::RG11B10UFLOAT_RENDERABLE (#3701) 2023-04-19 13:34:29 +02:00
Nicolas Silva
4035748c83
Update naga to 0.11.0@git:b9c5cb5a7841a8728137a58840fbbdbb9b310267 (#3705) 2023-04-19 10:54:40 +02:00
François
7c25c00f07
reject binding type multisampled when on a float filterable sample type (#3686) 2023-04-13 13:55:56 -04:00
Connor Fitzgerald
a7defb723f
Cleanups for WebGPU (#3671)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-12 21:27:30 +00:00
Nicolas Silva
f3bf0f782e
Update naga to 0.11.0@git:f59668ccfaf7bdb3a7e43d84363a21c77357b2fe (#3665) 2023-04-11 14:13:16 +00:00
Connor 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
7fd129a535
[metal] Adapt code to work with the new per_entry_point_map (#3524) 2023-04-07 11:01:24 -04:00
Jim Blandy
711ab981b7
Document wgpu_core::hub::Hub locking rules. (#3577)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-05 22:48:43 +00:00
Teodor Tanasoaia
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
dependabot[bot]
a13ed91626
Bump bitflags from 1.3.2 to 2.0.2 (#3606)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-05 22:24:59 +00:00
Lukas Herzberger
b6dbce740f
Implement resolve query set (#3489
* implement command_encoder_resolve_query_set

* fix args

* add BufferUsages::QUERY_RESOLVE

* update changelog

* fix link text

* validate query resolve: check for QUERY_RESOLVE instead of CPY_DST

* update changelog, replace COPY_DST with QUERY_RESOLVE in mipmap example
2023-04-05 17:59:04 -04:00
Benjamin Schaaf
fdbbd02c1e
Properly drop surfaces (#3647)
Co-authored-by: Benjamin Schaaf <bschaaf@sublimetext.com>
Fixes #3646
2023-04-05 17:48:12 -04:00
Erich Gubler
c200597115 refactor: resolve clippy::useless_conversion 2023-03-27 19:24:16 +02:00
Emil Ernerfeldt
d20fc0d2b5
Fix typo I introduced in previous PR (#3615) 2023-03-22 14:44:54 +00:00
Emil Ernerfeldt
a89e35a4e0
Validate shader location clashes (#3613)
* Validate shader location clashes

* Add line to changelog
2023-03-22 14:56:52 +01:00
Connor Fitzgerald
0c3ca5c08b
Fix Metal Mipmap Behvior (#3610) 2023-03-21 16:37:30 +00:00
Jim Blandy
0772df798d
Don't emit ANSI colors in shader validation error messages. (#3591) 2023-03-14 22:35:02 -04:00
Jim Blandy
35b0a16a88
Update docs after #3466. (#3576) 2023-03-10 17:49:19 +00:00
Teodor Tanasoaia
cf40e64b16
Change type of bytes_per_row and rows_per_image (#3529) 2023-03-06 16:44:36 -05:00
Teodor Tanasoaia
7e72f30179
Allow copying of textures with copy-compatible formats (#3528)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-03-03 17:24:17 +00: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
James Liu
6ee0d4c14d
Replace fxhash with rustc-hash (#3502)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-03-01 18:46:38 +00:00
Teodor Tanasoaia
2a3a9bf013
Remove unused STORAGE_ATOMICS flag (#3539) 2023-03-01 13:27:41 -05:00
daxpedda
74303308cd
Make crate features no-op on incompatible targets (#3466)
* Make crate features no-op on incompatible targets

* Remove `portable_features`

* Test `--all-features` in CI

* Make `renderdoc` no-op on WASM

* Address review
2023-02-21 13:50:55 +01:00
Nicolas Silva
438d6394ef
Update naga to 0.11.0@git:9742f1616c3e3dd2cc9a5880616fc886c391bb9f (#3512)
* Update naga to 0.11.0@git:9742f1616c3e3dd2cc9a5880616fc886c391bb9f

* Mark the zero init workgroup test as passing.
2023-02-21 12:50:22 +01:00
Nicolas Silva
71ee61aa09
Update naga to 0.11.0@git:58105a06e2bd5aefeb9330984d47976e63c11dc4 (#3506) 2023-02-20 14:37:08 +00:00
Nicolas Silva
8f1db56fc0
Work around a clippy error (#3505) 2023-02-20 15:35:58 +01:00
Teodor Tanasoaia
074d1da831
Set the new naga capabilities (#3494)
* remove redundant flag

* set the `MULTISAMPLED_SHADING` downlevel flag for gles and dx11

* set the right naga capabilities

add `Features::SHADER_EARLY_DEPTH_TEST`

* add changelog entry

* remove `@early_depth_test` from water example
2023-02-16 22:43:38 -05:00
Nicolas Silva
bf38b4b0b1
Update naga to 0.11.0@git:568d7c4c136dada369ef7f59ee8414a263d6c7b2 (#3491)
* Update naga to 0.11.0@git:568d7c4c136dada369ef7f59ee8414a263d6c7b2

* Fix the clear_texture after naga update.
2023-02-16 15:24:24 +01: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
daxpedda
5b8c55c451
Build for WASM on docs.rs (#3462) 2023-02-09 15:38:40 -05:00
Nathan Adams
238697c2da
Add MULTISAMPLE_X16 texture format feature flag where supported (#3454) 2023-02-06 19:53:48 +01:00
Teodor Tanasoaia
41de797c74
Change type of mip_level_count and array_layer_count (members of TextureViewDescriptor and ImageSubresourceRange) from Option<NonZeroU32> to Option<u32> (#3445)
Clean up duplicated code related to texture layers/mips.
2023-02-03 15:03:34 +01:00
Nicolas Silva
6399dd4866
Update naga to 0.11.0@git:4b796b157cb2b67b0ab166a2238fe4e9473bfd52 (#3451) 2023-02-03 12:30:08 +01:00
Connor Fitzgerald
4ea31598a0
Re-sort view formats (#3444) 2023-02-02 09:22:33 +01: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
João Capucho
c371e7039d
Implement the new checks for readonly stencils (#3443)
wgpu currently checks if the `write_mask` is 0 to determine wether a
stencil is used as readonly or not. However Webgpu contains a more
complex ruleset that also checks the cull mode and face operations to
determine if the stencil is readonly or not.

This commit brings these new rules to wgpu.
2023-02-01 21:13:46 +01:00
Teodor Tanasoaia
98ea3500fd
copyTextureToTexture src/dst aspects must both refer to all aspects of src/dst format (#3431)
* src/dst aspects must both refer to all aspects of src/dst format

* add changelog entry
2023-01-28 17:08:21 +01:00
Connor Fitzgerald
007d933260
Fix wgpu-core versioning 2023-01-25 19:30:39 -05:00
Connor Fitzgerald
d3fec9524f
Release of 0.15 (#3424) 2023-01-25 19:25:41 -05:00
Teodor Tanasoaia
d2809137ba
Zero-initialize workgroup memory (#3174)
fixes https://github.com/gfx-rs/wgpu/issues/2430
2023-01-25 18:28:35 -05:00
Jinlei Li
33f94c7c84
Implement view_formats for SurfaceConfiguration (#3409)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-01-25 21:04:41 +00:00
Jinlei Li
0d433214c7
validate the number of color_attachments in begin_render_pass (#3404) 2023-01-25 14:48:27 -05:00
Jinlei Li
969af43c05
move require_downlevel_flags(VIEW_FORMATS)? from create_texture_view() to create_texture() (#3420) 2023-01-25 17:33:58 +01:00
IceSentry
bb876f372a
Better error message for 16 byte alignment error (#3414)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: gilescope <gilescope@gmail.com>
Closes https://github.com/gfx-rs/wgpu/pull/3099
Closes https://github.com/gfx-rs/wgpu/issues/2832
2023-01-24 20:46:19 +00: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
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
Jinlei Li
4cd753bccd
vk: improve view_formats setting (#3412)
* vk: improve view_formats setting

* Fix extension detection

* Update wgpu-hal/src/vulkan/device.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* Follow the suggestion

* Tiny doc fix

* Follow the suggestion

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-01-23 16:02:25 +01:00
Xiaopeng Li
24a904256e
Add create_surface_from_surface_handle (#3225)
Co-authored-by: lixiaopeng.jetspark <lixiaopeng.jetspark@bytedance.com>
2023-01-19 11:16:11 -05:00
Nicolas Silva
a3e3d2503f
Update naga to 1be8024. (#3405) 2023-01-19 15:25:25 +00:00
Connor Fitzgerald
2c3f9fabb7
Allow vulkan to change view formats (#3399) 2023-01-19 14:20:15 +01:00
Elabajaba
81569dd6c3
Updated Dxc integration for DX12 backend (#3356)
Co-authored-by: unknown <alimilhim5@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Closes https://github.com/gfx-rs/wgpu/issues/2722
closes https://github.com/gfx-rs/wgpu/pull/3147
2023-01-18 21:25:56 +00:00
Jinlei Li
0849e78600
Add view_formats in TextureDescriptor (#3237)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Closes https://github.com/gfx-rs/wgpu/issues/3030
2023-01-18 16:03:56 -05:00
Teodor Tanasoaia
fae740df5c
Fix being able to sample a depth texture with a filtering sampler (#3394) 2023-01-18 15:53:50 -05: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
Nicolas Silva
5a2e60c50e
Update naga to e98bd92 (#3352) 2023-01-10 14:04:18 -05:00
JMS55
ad4dac87fb
Allow non-filtering integer texture sampling (#3362)
* Allow non-filtering integer texture sampling

* Add changelog entry
2023-01-09 11:08:14 +01:00
James0124
a06ef71fd7
Add validation in accordance with WebGPU GPUSamplerDescriptor valid… (#3353)
* Add validation in accordance with WebGPU `GPUSamplerDescriptor` valid usage for `lodMinClamp` and `lodMaxClamp`.

`lodMinClamp` must not be negative, and `lodMaxClamp` must be >= `lodMinClamp`

* Add changelog entry.

* Run `cargo fmt`.
2023-01-06 13:16:16 +01:00
Jinlei Li
33e5b7af26
vulkan feature exclude macOS and iOS by default (#3292)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Closes https://github.com/gfx-rs/wgpu/issues/3287
2023-01-04 21:35:29 +00:00
Teodor Tanasoaia
784ee43be7
Make ObjectId structure and invariants idiomatic (#3347) 2023-01-04 15:13:59 -05:00
Nathan Adams
186a29c34d
Implement TextureFormat::Stencil8 + add stencil example (#3343)
* Implement TextureFormat::Stencil8

* Add stencil-triangles demo to test Stencil8 and show how to use stencil testing

* Added changelog for Stencil8
2023-01-02 13:47:10 +01:00
Connor Fitzgerald
9670e9e6b9 Make sure all doctests and tests in wgpu-types run 2022-12-21 17:24:46 -05:00
Andreas Reich
eaa87ba42c
Force all adapters to report min buffer alignment of 32 (#3262) 2022-12-21 13:46:15 -05:00
Connor Fitzgerald
9b9cc330ca
Fix up strict-assert usage (#3320)
* Removes unused assertions.rs

* Strict assert macro fixes

* Strict asserts shouldn't be default on wgpu
2022-12-20 22:04:45 -08:00
Connor Fitzgerald
5241633b3a
Implement Presentation Timestamp Correlation (#3240)
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2022-12-20 17:52:08 +00:00
Teodor Tanasoaia
62e932b0a8
Add missing DEPTH_BIAS_CLAMP and FULL_DRAW_INDEX_UINT32 downlevel flags (#3316)
* add missing `DEPTH_BIAS_CLAMP` and `FULL_DRAW_INDEX_UINT32` downlevel flags

* add changelog entry

* use require_downlevel_flags
2022-12-20 18:21:54 +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
i509VCB
052bd17d41
Context dynamic dispatch (#3051) 2022-12-19 19:17:19 -05:00
Jim Blandy
de070b2846
Fix documentation comments for Rust 1.66. (#3310)
Somewhere after 1.64 but by 1.66, `rustdoc` started checking for
unmatched HTML tags in doc strings, meaning that text like

    /// Convenience function turning Option<Selector> into this enum.

causes problems, since `rustdoc` will pass through `<Selector>` as
HTML tag, which browsers displaying the output will misunderstand.
2022-12-19 11:41:19 -08:00
Erich Gubler
3cc6621fd3
Resolve Rust 1.66 clippy lints (#3304) 2022-12-16 17:23:12 -05:00
Jim Blandy
0e4c7dd6d2
Remove workspace inheritance (#3295) 2022-12-15 15:46:28 -05:00
Imbris
645469d2f9
Small typo fix in TextureViewDescriptor docs (#3300) 2022-12-15 15:19:00 -05:00
Connor Fitzgerald
3ce5ca866b
Improve dynamic offset binding errors (#3294) 2022-12-15 00:53:42 +00:00
Jim Blandy
a50836e0cb
Make wgpu-core users responsible for choosing back ends. (#3254) 2022-12-07 20:58:45 -05:00
Jim Blandy
537f077132
Evaluate gfx_select's #[cfg] conditions at the right time. (#3253)
See the comments in the code for details.
2022-12-05 12:47:42 -08:00
Kevin Reid
2209463a54
Return an error instead of panicking when canvas context is unavailable (#3052)
* Low-level error handling in canvas context creation (for WebGPU and WebGL 2).

Part of fixing #3017. This commit changes the handling of `web_sys`
errors and nulls from `expect()` to returning `Err`, but it doesn't
actually affect the public API — that will be done in the next commit.

* Breaking: Change type of `create_surface()` functions to expose canvas errors.

Part of fixing #3017.
2022-11-30 23:41:29 -05:00
Nicolas Silva
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
Nicolas Silva
a9d33193b3
Fix incorrect offset in get_mapped_range (#3233)
* Add a test.

* Fix incorrect offset in get_mapped_range.

* Add an entry in the changelog.
2022-11-30 16:45:49 -05:00
Connor Fitzgerald
84cb3e65a9 Unify Surface Capabilities APIs under one function call 2022-11-27 01:50:47 -05:00
Nicolas Silva
82e9dcf8f7
Allow unspecified bits when deserializing the API's bitflags (#3229) 2022-11-25 23:13:22 -05:00
Jim Blandy
d4b1d57f3c
Move ResourceMetadata into its own module, and give it a proper interface (#3213) 2022-11-23 17:29:20 -05:00
Jim Blandy
73b23f1c8d
Move minimum supported rust version (MSRV) from 1.65 back to 1.64. (#3231) 2022-11-23 21:22:03 +00:00
Jim Blandy
f41a1c294b
Remove unnecessary mutability from ResourceMetadata field uses. (#3210) 2022-11-15 21:52:12 +00:00
Erich Gubler
18f3f5f6f0
Enable unsafe_ops_in_unsafe_fn lint in all workspaces (#3044) 2022-11-14 10:49:39 -08:00
i509VCB
0e937c8cd0
make Ids a u64 internally (#3178) 2022-11-09 15:48:07 -05: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
Erich Gubler
319a916cb6 refactor: fix label shadow warning for new_alpha_mode 2022-11-07 17:36:04 -08:00
Erich Gubler
fb67de908e refactor: resolve clippy::explicit_auto_deref 2022-11-07 17:36:04 -08:00
Andreas Reich
b838b0871c
Added new UNRESTRICTED_INDEX_BUFFER downlevel flag. (#3157)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-11-07 15:45:50 -05:00
Nicolas Silva
db30e3909a
Avoid integer overflow on multiplication in write_texture. (#3146) 2022-11-07 15:31:19 -05:00
i509VCB
32febc5c9e export the strict assert macros uniformly 2022-11-01 04:59:24 -04:00
i509VCB
085e41171f use debug_assert_** with not(feature = "strict_asserts")
strict_asserts should at least validate with the debug_assert_** family of macros in debug builds. Otherwise undefined behavior can sneak by.
2022-11-01 04:59:24 -04:00
Harald Reingruber
51b34c5b51
Improve compute shader validation error message (#3139)
* Improve compute shader validation error message

* Add entry to changelog.

* Improve error message wording (by cwfitzgerald)

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* Add credit and PR link to changelog

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-10-29 17:49:03 -04:00
Jinlei Li
dcc0baa1ff
Fix texture_as_hal internal unwrap may cause panic (#3131) 2022-10-26 17:13:43 -04:00
i509VCB
d81cb46be0
enable doc_auto_cfg for docs.rs (#3113)
* enable doc_auto_cfg for docs.rs

This should expose more feature labels in the generated documentation and removes the needs for the manually labeling the features for a type, function or enum variants.

* enable docsrs cfg when building docs for master
2022-10-26 17:07:25 -04:00
Jinlei Li
cc448817e7
Use cargo 1.64 workspace inheritance feature (#3107) 2022-10-20 01:41:17 -04:00
Xiaopeng Li
754a4bad80
Add Surface::as_hal_mut (#3123) 2022-10-19 16:06:23 -04:00
Jim Blandy
b28a87e298
Global init remove dummy argument (#3101) 2022-10-13 17:41:58 -04:00
Nicolas Silva
d1ff3838b8
Expose the full Result type to the rust map_async callback (#2939) 2022-10-13 15:41:52 -04: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
Nicolas Silva
eca04f59db
Make some errors not fatal (#3094) 2022-10-11 13:40:30 -04:00
daxpedda
02cc2ae234
[BREAKING] Make Shader(Module)Source::Wgsl optional (#2890) 2022-10-08 01:12:50 -04:00
Nicolas Silva
0a3e209c90 Shrink the default max binding index to 640 and expose it in Limits.
Following the corresponding changes happening in WebGPU.
2022-10-06 10:12:16 -07:00
Jim Blandy
c781971792
When a command encoder is dropped, destroy its hal command buffer. (#3069)
Fixes #2965.
2022-10-06 01:06:55 -07:00
Connor Fitzgerald
872b436104 Update version to 0.14 2022-10-05 18:45:25 -04:00
Connor Fitzgerald
91e0dbd1ae Update naga + deps 2022-10-05 18:45:25 -04:00
Mikko Lehtonen
60fd2a32e9
Implement missing PrettyError impls (#3066) 2022-10-05 18:43:52 -04:00
i509VCB
2372895944
Handle unsupported surfaces more gracefully (#3054) 2022-10-05 16:42:06 -04:00
SpecificProtagonist
b65ebb4b30
remove copyless (#3050) 2022-09-26 05:15:35 +00:00
Xander Warnez
2c1d7a8a5c
Split Blendability and Filterability into Two Different TextureFormatFeatureFlags (#3012)
* Split Blendability and Filterability into Two Different TextureFormatFeatureFlags

* Update CHANGELOG.md

* Split out individual booleans to improve readability

* Make sure blendablity is correctly set for guaranteed format features of WebGPU

* Cargo fmt

Co-authored-by: Xander Warnez <xander.warnez@materialise.be>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-09-21 19:39:01 +00:00
Mauro Gentile
cdf6ee0c87
Updating TextureFormat matching specs (#2954)
Co-authored-by: Mauro Gentile <Mauro.Gentile@ubisoft.com>
2022-09-20 12:08:06 -04:00
daxpedda
95408cd48b
[BREAKING] Wrap ShaderSource::Naga in Cow<'static> (#2903) 2022-09-19 00:50:46 -04:00
Imbris
41006d7a88
Buffer usages mismatch check and documentation for mapped_at_creation size requirement. (#3023)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-09-19 04:41:29 +00:00
Jinlei Li
44399bb4a3
Expose alpha_mode, support non-opaque mode on metal and vk backends (#2836) 2022-09-19 00:10:21 -04:00
Alphyr
d1c94d09e2
Update dependencies (#3021) 2022-09-18 23:53:21 -04:00
i509VCB
9e3efd7019
pass around RawDisplayHandle and RawWindowHandle in implementation (#3022)
This change is to help with an attempt to allow the Context type in wgpu to be swappable at runtime. In order to do that, the functions provided by Context and it's associated types need to be object safe. Instead of passing a impl trait that combines both HasRawWindowHandle and HasRawDisplayHandle, we seperate the types into their RawDisplayHandle and RawWindowHandle parts internally to reduce some of the hal implementation code mess.
2022-09-15 16:29:20 -07:00
Jim Blandy
bec26b79ec
Don't use a callback to return backend instance handles. (#2991)
Change `Instance::as_hal<A>` to simply return an
`Option<&A::Instance>`, rather than passing it to a callback. We're
just borrowing a reference to some `wgpu_hal::Api::Instance` owned by
the `wgpu_core::instance::Instance`, so there's no special scoping or
locking magic required here.
2022-09-02 17:32:58 -07:00
Jim Blandy
701564da8c
Use () instead of PhantomData as IdentityManager's Input type. (#2972)
* Use () instead of PhantomData as IdentityManager's Input type.

PhantomData suggests that there's some sort of persuasion required
for lifetime variance inference or other sorts of arcana, but it
doesn't seem to be necessary at all. `()` works just fine.
2022-09-02 15:37:21 -07:00
Jim Blandy
58bc205f2a Update to Naga b209d911 (2022-9-1).
This removes an expected failure on AMD RADV. I guess #2751 was our
bug all along.
2022-09-02 11:33:55 -07:00
Jim Blandy
7d138e2e76
Avoid overflow in check texture copy bounds. (#2963) 2022-08-28 20:07:04 -04:00
Jim Blandy
a0dfb28b8d
Document wgpu_core id handling, factories, etc. (#2973) 2022-08-28 19:49:09 -04:00
Jim Blandy
2cd08a1c9c
Placate Clippy 0.1.63. (#2977) 2022-08-24 17:25:59 -04: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
Nicolas Silva
6e99cd3a3e
Fix calculation/validation of layer/mip ranges in create_texture_view (#2955)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-08-14 00:01:19 +00:00
Nicolas Silva
96a85b3ac5
Add missing validation in copy_texture_to-Buffer. (#2958) 2022-08-13 19:48:17 -04:00
Jim Blandy
d655017439
Implement "strict_asserts" feature in wgpu-core. (#2872)
Since `wgpu-core`'s public functions are supposed to validate their
parameters, the internal `track` module skips many of Rust's usual
run-time checks in release builds. However, some `wgpu-core` users are
happy to pay the performance cost in exchange for more safety. The
`"strict_asserts"` feature causes `wgpu_core` to perform the same
checks in release builds as it does in debug builds.
2022-08-08 00:45:39 -04:00
Wyatt Herkamp
f7526ae960
winit 0.27 Update and raw-window-handle 0.5 (#2918) 2022-08-04 06:09:37 +00:00
Nicolas Silva
ef3b31cd9a
Map bounds check (#2938)
* Validate that map_async's range is not negative.

map_async already checks that the range's end is within the bounds of the buffer, so this also ensures the range start is within bounds.

* Add an entry in the changelog.
2022-08-03 20:28:36 -07:00
Nicolas Silva
e59c33046b
Validate against the maximum binding index (#2892)
* Validate binding indices in create_bind_group_layout.

* Add an entry in the changelog
2022-08-01 16:25:32 -04:00
Seamooo
0dce58dfbd
changed websys features in core and hal to align with used features (#2922)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-08-01 19:06:26 +00:00
Nicolas Silva
a05c8dc2dc
Fix buffer zeroing with offset in map_buffer (#2916)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-07-31 22:05:18 +00:00
Valentin
271bb8690e
Fix documentation claiming shader entry points must return void (#2911) 2022-07-26 03:40:32 +00:00
Nicolas Silva
d0aa3f471a
Validate the number of color attachments in create_render_pipeline (#2913) 2022-07-25 23:28:52 -04:00
Connor Fitzgerald
537c6bed4e
Add warning when using CompareFunction::*Equal without an invariant Attribute (#2887) 2022-07-21 02:24:49 -04:00
Seamus Mulholland-Patterson
6d4677fd7f added downlevel restriction error message for InvalidFormatUsages error 2022-07-15 14:11:04 -04:00
Nicolas Silva
6058676dd2
Record that the buffer is mapped when its size is zero. (#2877)
* Record that the buffer is mapped when its size is zero.

* Avoid internally trying to map a zero-sized buffer if mapped_at_creation is true.

* Add an entry in the changelog.
2022-07-13 18:01:12 +00:00
Nicolas Silva
af345cd6c3
Validate the range in map_async. (#2876)
* Validate the range in map_async.

* Add an entry in the changelog.
2022-07-13 12:34:36 -04:00
i509VCB
db24c066cb
fix panic with as_hal functions (#2871) 2022-07-12 14:38:59 -04:00
Sébastien Marleau
2ce1318c8c
fix deduplication not taking into account render bundles (#2867) 2022-07-10 22:15:52 +00:00
Nicolas Silva
324de1bef6
Ensure the BufferMapCallback is always called. (#2848)
* Ensure the BufferMapAsyncCallback is always called.

This solves two issues on the Gecko side:
 - The callback cleans up after itself (the user data is deleted at the end of the callback), so dropping the callback without calling it is a memory leak. I can't think of a better way to implement this on the C++ side since there can be any number of callback at any time living for an unspecified amount of time.
 - This makes it easier to implement the error reporting of the WebGPU spec.

* Update the changelog.
2022-07-07 23:29:05 -07:00
Connor Fitzgerald
59f4efe93a Prevent get_texture_format_features from saying textures always support COPY_* 2022-07-06 11:06:34 -04:00
Connor Fitzgerald
7e369fdd57 Fix texture multi-sample-ability check with TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES 2022-07-06 11:06:34 -04:00
Craig
1da5bbd7b4
Prevent OpenGL from taking preference over Vulkan (#2853)
* Prevent OpenGL from taking preference over Vulkan

* update changelog

* fix wasm build of example
2022-07-06 00:11:22 -04:00
Connor Fitzgerald
7d85efb301 Fix out of bounds access when surface texture is written to by multiple command buffers 2022-07-03 01:08:40 -04:00
Connor Fitzgerald
eea8edb8a0 Fix AutoNoVsync on OpenGL 2022-07-03 01:08:40 -04:00
Spencer C. Imbleau (he/him)
72a4ef9362
Fixes #2840 (#2842) 2022-07-03 02:00:25 +00:00
Connor Fitzgerald
1ceef24261
Add changelog for 0.13 (#2823)
* Changelog

* Update CHANGELOG.md

* Bump versions to 0.13
2022-06-30 20:25:49 +00:00
Connor Fitzgerald
ea05b44f38
Improve Presentation Api (#2803)
* Add new presentation modes

* Expand presentation formats

* Add Surface::get_supported_modes

* Update to rust 2021 and improve some metal surface code

* Update wgpu-types/src/lib.rs

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>

* Fix windows build errors

* Fix issues with ALLOW_TEARING

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-06-30 14:24:17 -04:00
Jinlei Li
98597da1ec
Allow fragment stage to have more outputs than the pipeline has (#2822) 2022-06-30 03:36:11 +00:00
Connor Fitzgerald
1d8bc57a86
Don't wait for current submission inside of submit (#2824) 2022-06-30 03:05:42 +00:00
Connor Fitzgerald
464b61d01c
Flip span labels to work better with tools (#2820) 2022-06-28 19:49:51 +00:00
Teodor Tanasoaia
5eb09f6bd7
Implement Queue::write_buffer_with (#2777)
* implement Queue::write_buffer_with

* address comments

* update doc

* Fix copy span location

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-06-28 18:32:43 +00:00
Jinlei Li
b0c798639a
core: restrict hal::TextureUses::COLOR_TARGET condition within create_texture (#2818) 2022-06-28 18:12:34 +00:00
Jim Blandy
7cfbd874af
Update Naga to 27d38aae (2022-6-27). (#2816) 2022-06-27 21:36:00 -04:00
Jinlei Li
61796b1d59
Relax render pass color_attachments validation (#2778)
* Make the color attachments `Option`-al in render pipelines, render passes, and render bundles

* vk:  `Option`-al color attachments support

* dx12: sparse color_attachments support

* Only non-hole attachments is supported on wasm target and gl backend

* deno_webgpu: `Option`-al color attachments support

* Follow all suggestions
2022-06-27 16:10:18 -07:00
Connor Fitzgerald
84633a8b12
Force binding sizes to be multiples of 16 on webgl (#2808) 2022-06-27 02:39:51 +00:00
i509VCB
f041991d0c allow creating wgpu::Instance from wgpu_core::Instance 2022-06-26 15:32:34 -07:00
Connor Fitzgerald
533fc13afe
Properly Barrier Compute Indirect Buffers (#2810) 2022-06-26 21:03:56 +00:00
Connor Fitzgerald
de5fe90f20
Restrict WriteTimestamp Inside Passes (#2802)
* Define feature flags in terms of the previous

* Add WRITE_TIMESTAMP_INSIDE_PASSES feature
2022-06-25 01:23:13 -04:00
victorvde
7375acb230
get_supported_formats: sort like the old get_preferred_format and simplify return type (#2786)
* get_supported_formats: sort srgb first like the old get_preferred_format

* get_supported_formats: simplify return type
2022-06-22 21:04:18 +00:00
Nicolas Silva
5dcd19c167
Add a vulkan workaround for large buffers. (#2796)
* Add Limit::max_buffer_size.

* Prevent very large buffer with some drivers.

Some drivers run into issues when buffer sizes and ranges are larger than what fits signed 32 bit integer. Adapt the maximum buffer size accordingly.
2022-06-22 12:31:53 -04:00
Nicolas Silva
a9f1b4f8e0
Add create_texture_error. (#2800)
Firefox needs it to implement WebGPU's error model (see create_buffer_error).
2022-06-22 12:58:37 +00:00
Kevin Reid
2881a74de9
Fix formatting of TextureDimensionError::LimitExceeded. (#2799)
in the thiserror error format string, `{0:?}` ends up referring to the
first named argument, not the first struct field or a compile error, so
the error was incorrectly
    Dimension 32768 value 32768 exceeds the limit of 16384
instead of
    Dimension X value 32768 exceeds the limit of 16384
2022-06-21 21:46:12 -04:00
Rajveer Malviya
f27a9788fd
fix BufferMapCallbackC & SubmittedWorkDoneClosureC (#2787) 2022-06-18 16:55:24 +00:00
Steven
0d4d3f4ceb
Change get_preferred_format to get_supported_formats (#2783)
* Change all the functions

* Return the set of supported TextureFormat specified by WebGPU

* Remove redundant filtering and use list directly

* Replace pops with first

* Remove now unused function

* Fix doc and clarify preffered format

* Dereference enums

* Remove unused list

* Remove fancy coode

* Update wgpu-core/src/device/mod.rs

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-06-18 00:21:02 -04:00
Jim Blandy
aba7197fe8
Update Naga to 0b60f410 (Thu 2022-6-16). (#2779) 2022-06-17 16:51:22 -04:00
Jinlei Li
f4c01052ef Rename MAX_COLOR_TARGETS to MAX_COLOR_ATTACHMENTS to match spec 2022-06-16 20:36:15 -07:00
Jinlei Li
f2c3d42818 Add InvalidGroupIndex validation at create_shader_module 2022-06-16 10:06:11 -07:00
Nicolas Silva
191537021e
Expose naga span location helpers (#2752)
* Expose the source location in CreateShaderModuleError.

* Bump naga dep to 89bed99.
2022-06-14 23:10:22 -04:00
Jim Blandy
6da57dd4e0
Add type annotation to render pass code, for rust-analyzer. (#2773)
This is a workaround for a limitation in rust-analyzer:
https://github.com/rust-lang/rust-analyzer/issues/12247
2022-06-14 23:06:22 -04:00
Jim Blandy
915be10443
wgpu_core::command::bundle: Consolidate pipeline and vertex state. (#2769)
Refactor `wgpu_core::command::bundle::State` to more closely resemble
the internal slots of a WebGPU `GPURenderBundleEncoder`, and add
validation required by the WebGPU specification.

Use `Option` to represent state that may be left unset on the encoder:
specifically, the pipeline and vertex buffers. (Previous commits have
already addressed index buffers and bind groups.) Use `.ok_or`, etc.
for unwrapping, to ensure that encoding state errors are reported.

Consolidate state derived from the pipeline in a new `PipelineState`
struct.

Remove `wgpu_core::command::bundle::PushConstantState::is_dirty`; just
represent push constant state as a vector of `PushConstantRange`
values. It's sufficient to simply zero the push constants whenever the
vector is non-empty.

Rename `bundle::State::flush_push_constants` to `zero_push_constants`a.
This is not a "flush pending state changes" function like all the
others; it just ensures that each pipeline's push constant state is
initialized.
2022-06-14 23:06:05 -04:00
Jim Blandy
b30b445423
Clarify docs for wgpu_core's Id and gfx_select!. (#2766)
Clarify that `gfx_select!` is not specific to `hub::Global`.

Clarify that the `T` in `id<T>` is not a real resource type.
2022-06-14 00:46:58 -04:00
Jim Blandy
3a193ec3d3
Introduce VertexStep: a stride and a step mode. (#2768)
This is used in various places around render pipelines, passes, and
bundles.

The public `wgpu_core::pipeline::VertexBufferLayout` could use
`VertexStep` as well, but I think it's best to let that continue to
resemble `GPUVertexBufferLayout`.
2022-06-14 00:42:03 -04:00
Jim Blandy
a4352a1dac
Improve push constant documentation, including internal docs. (#2764) 2022-06-11 15:11:06 -04:00
Nicolas Silva
629ccaf4e0
Align the validation of Device::create_texture with the WebGPU spec (#2759) 2022-06-10 16:02:49 -04:00
Jim Blandy
b2cc6ff185
Move RenderBundleEncoder::finish's pipeline layout id into the state. (#2755) 2022-06-10 15:41:32 -04:00
Jim Blandy
f94f25f355 Fix documentation links. 2022-06-09 17:42:03 -07:00
Jinlei Li
f0c7fe3a8e
Improve read-write and read-only texture storage error message (#2745)
* Improve read-write and read-only texture storage error message

* Update wgpu-core/src/binding_model.rs

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-06-07 06:21:17 +00:00
Jim Blandy
091e9b1788
Clean up render bundle index buffer tracking. (#2743)
* Remove unused field `bundle::IndexState::pipeline_format`.

* Clean up render bundle index buffer tracking.

Put all state associated with an established index buffer within an
`Option`, so that the Rust types accurately represent value liveness.

Generate `MissingIndexBuffer` errors as needed for `DrawIndexed` and
indexed `MultiDrawIndirect` commands.
2022-06-07 02:17:27 -04:00
Jim Blandy
d26c04c715
Don't dirty the vertex buffer for stride/rate changes on bundles. (#2744)
`wgpu_core::command::bundle::State::set_pipeline` marks a vertex
buffer slot dirty if the pipeline's stride or step mode for that
vertex buffer slot differs from what had been previously established.
The effect of marking the slot dirty is to ensure that a new
`SetVertexBuffer` command is inserted before the next draw command
that uses that vertex buffer. However, this is unnecessary:
`wgpu_hal::CommandEncoder::set_vertex_buffer` does not need to be
called simply because the stride or rate has changed.
2022-06-07 02:10:08 -04:00
Jim Blandy
5bee63e605
Track depth and stencil writability separately. (#2693)
Put some plumbing in place to accomodate the latest definition of
`GPURenderBundleEncoderDescriptor` in the WebGPU spec, which now has
separate `depthReadOnly` and `stencilReadOnly` members.

Rename `RenderPassDepthStencilAttachment::is_read_only` to
`depth_stencil_read_only`, and don't skip validation steps due to
early returns.
2022-06-07 02:02:23 -04:00
Harald Reingruber
25b16d5cc8
OffscreenCanvas Support for WebGL Backend (#2603)
* First attempt of exposing create_surface_from_canvas for webgl

* Test Fix Compile For WebGL Offscreen Canvas

* Only specify web-sys feature version in wgpu-core, so that patch version is taken from workspace

* Reuse already existing fn create_surface_from_canvas

* Remove unnecessary unsafe

* Remove unsafe prefix also from top-level create_surface_from_canvas

* Add create_surface_from_offscreen_canvas() for webgl

* Cargo fmt

* Store webgl2_context instead of canvas, which works also for OffscreenCanvas

* Copy skybox example for OffscreenCanvas example

* Use offscreen_canvas instead in newly created example

* Update skypbox_offscreen readme.md

* Allow enabling OffscreenCanvas in examples via http://localhost:8000/?offscreen_canvas=true

* Fix cargo fmt

* [fix warning] Only import FromStr for wasm32

* [fix warning] Exclude offscreen_canvas_setup from non-wasm32

* [fix warning] Add ImageBitmap feature as well so that all related methods can be used

* Fix cargo fmt

* Fix emscripten build

* Remove `webgl` feature from wgpu-core as webgl is the only wasm32 backend

Co-authored-by: Zicklag <zicklag@katharostech.com>
2022-06-07 01:57:16 -04:00
Connor Fitzgerald
5bd0a6c4ac
Implement submission indexes (#2700)
* Implement submission indexes

* Write some unit tests for poll

* Update wgpu/src/lib.rs

Co-authored-by: Jim Blandy <jimb@red-bean.com>

* Unify Maintain in both wgc and wgpu

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2022-06-05 17:22:25 -04:00
Robert Bragg
444836f747
Acquire texture: Option<std::time::Duration> timeouts (#2724)
* surface.acquire_texture: pass Option<Duration> for timeout

A std::time::Duration allows for timeouts to be specified more clearly in
Rust using whatever units are convenient for the caller, and an Option also
makes it clearer in case no timeout is wanted, as opposed to passing a
bitwise !0 as special timeout value.

Notably there was an impedance mismatch with the Vulkan backend that
takes a 64bit timeout in nanoseconds and uses u64::MAX to indicate no
timeout and the backend was not mapping a given u32::MAX into a u64::MAX

* surface.acquire_texture: ignore timeout for Android < 11

Prior to Android 11 then Android's vkAcquireNextImageKHR implementation was
non-conformant and didn't support timeouts and additionally would log a
verbose warning if a timeout was requested.

For reference this version of AcquireNextImageKHR doesn't support timeouts:
https://android.googlesource.com/platform/frameworks/native/+/refs/tags/android-mainline-10.0.0_r13/vulkan/libvulkan/swapchain.cpp#1426
and this version does:
https://android.googlesource.com/platform/frameworks/native/+/refs/tags/android-mainline-11.0.0_r45/vulkan/libvulkan/swapchain.cpp#1438
(i.e. timeout support was added in Android 11)

This patch adds a dependency on the `android-properties` crate that provides
a simple wrapper for the `__system_property_set` syscall so that the
platform version can be read via the `ro.build.version.sdk` property
and then for versions < 30 (corresponds to Android 11) any timeout
given to `acquire_texture` will be ignored (and `u64::MAX` will be
passed to Vulkan)
2022-06-04 16:05:40 +00:00
Jinlei Li
9e3cd08e59
Improve InvalidViewport error message (#2723) 2022-06-03 01:54:09 -04:00
Jinlei Li
75db572bf7
Improve InvalidScissorRect error message (#2713) 2022-06-02 07:35:13 +00:00
Connor Fitzgerald
32af4f5607
Convert map_async from being async to being callback based (#2698) 2022-05-31 11:22:21 -04:00
Jinlei Li
8063edc648
Add DEPTH24UNORM_STENCIL8 feature (#2689) 2022-05-30 15:29:12 -04:00
Connor Fitzgerald
fd954a2bd6
Stop using storage usage for sampling (#2703) 2022-05-29 19:52:41 -04:00
Connor Fitzgerald
c12ae0880f
Check that all vertex outputs are consumed by the fragment shader (#2704) 2022-05-29 23:38:11 +00:00
Daisuke Kato
16c796578c
Add symlink LICENSE files into crates. (#2604) 2022-05-29 03:07:42 -04:00
Jim Blandy
0c0bbdb3ad
Perform "valid to use with" checks when recording render bundles. (#2690)
* Update module docs for `wgpu_core::commands::bundle`.

* Perform "valid to use with" checks when recording render bundles.
2022-05-28 04:57:06 -04:00
Connor Fitzgerald
9114283707
Tracking Optimization and Rewrite (#2662)
* Texture state full is dead code

* temp

* temp2 - next is lifetime only

* temp3 - all trackers in place

* temp4 - continue muddling along

* temp5 - doodle doodle

* temp6 - continuous progress is continuous

* temp7 - pro-gress

* temp8 - Add refcounts to trackers

* temp9 - Soundness, generics, refcounts, and epochs

* temp10 - Compiling?!1?!1?!1

* temp11 - Add bind group state optimization

* temp12 - Safety and adding size setting

* temp13 - unsafe

* temp14 - Abstract all the state transitions

* temp15 - It verks! kinda...

* temp16 - it more verks!

* temp17 - debugging and unit tests

* temp18 - fixing unfixed things

* temp19 - hmmm

* temp20 - curious about line deltas

* temp21 - working texture trackers

* temp22 - write merge/update/barrier for buffers

* temp23 - cleanup and buffers

* temp24 - clippy cleanup

* temp25 - Add inline markers on buffer functions

* temp26 - Fix buffer trackers

* temp27 - fixed texture insert to handle both sides

* temp28 - document tracker and usages

* temp29 - document track/mod.rs

* temp30 - convert STORAGE_WRITE to STORAGE_READ_WRITE

* temp31 - Add some debug asserts to make sure we can't insert invalid states

* temp32 - clippy is opinionated sometimes

* temp33 - renaming and documentation

* temp34 - logging
2022-05-24 11:36:13 -04:00
Jim Blandy
c7872ab8b5 Eliminate wgpu_core::commands::bundle::State::raw_dynamic_offsets.
This vector's contents always ended up identical to the
`RenderBundleEncoder`'s `BasePass`'s `dynamic_offsets` vector, so
we can just take values from there instead of copying them.
2022-05-22 08:38:47 -07:00
Jim Blandy
87d75d9c7b Document command::BasePass. 2022-05-22 08:38:47 -07:00
Jim Blandy
afed25fa5c Clean up render bundle bind group tracking.
The `dynamic_offsets` and `is_dirty` flags only make sense when the
slot is occupied, so they should be inside the `Option`. This makes
`State::bind` into an `ArrayVec<Option<BindState>>`, and cleans up
various other bits.
2022-05-22 08:38:47 -07:00
Jim Blandy
d3235484f9 Document some parts of wgpu_core's render bundle code. 2022-05-22 08:38:47 -07:00
Jim Blandy
b53a8bcb17
New function: Global::create_buffer_error. (#2673) 2022-05-19 13:10:47 -04:00
Jinlei Li
8b2e6fe3a2
Roll naga to 571302e (50 revisions) (#2672) 2022-05-18 21:09:22 -07:00
i509VCB
f5c2ff11d0
Adapter and Instance as_hal functions (#2663)
These functions are added to allow lower level access to adapter and instance from backends.
2022-05-17 06:13:58 +00:00
Jinlei Li
26f96c7dfe
Add DEPTH32FLOAT_STENCIL8 featue (#2664) 2022-05-17 02:11:05 -04:00
Jim Blandy
b51fd851be Report invalid pipelines in render bundles as errors, not panics.
Fixes #2665.
2022-05-16 14:26:36 -07:00
Jim Blandy
c608ee0bbe
Accept both parking-lot 0.11 and 0.12.*, to avoid windows-rs. (#2660)
In parking_lot 0.12 and parking_lot_core 0.9.0, those crates switched
from the winapi crate to the official Microsoft windows-sys crate.
This is fine, except that windows-sys and its dependencies are even
larger than winapi. Some users may wish to stick with winapi for the
time being; this change allows wgpu to accommodate them.
2022-05-16 01:16:53 -04:00
Jim Blandy
202d81a64a
Move set_index_buffer FFI functions back into wgpu. (#2661)
It's very odd to have almost all the render pass and compute pass ffi
functions in `wgpu` except for the `set_index_buffer` functions, which
live in Firefox. I'd like to remove these from Firefox and put them
back next to their companions.

These functions were originally removed from wgpu in #1077, because
wgpu-native has its own incompatible version of IndexFormat (see that
PR for details). However, with wgpu-native#85, that code was removed,
so having these functions in `wgpu` should be no longer be a problem
for wgpu-native.
2022-05-15 15:18:05 -04:00
Shaye Garg
75b881e636
fix: panic in Storage::get (#2657)
* fix: don't panic on invalid id in Storage::get

* formatting

* removed double matches

* more match removal

* fix formatting

* add fix to Storage::label_for_invalid_id
2022-05-14 14:59:47 +05:30
Jim Blandy
284ed4654e Spell out the type of the result from map_pass_err.
Without these changes, rust-analyzer cannot determine the type of
`cmd_buf`.
2022-05-13 22:18:12 -07:00
Poly
bfcf5fa513 Make GLES DeviceType unknown by default 2022-05-11 20:32:43 -07:00
xiaopengli89
654a75b058 Return all_queue_empty for Instance::poll_all 2022-05-10 16:35:56 -07:00
xiaopengli89
3f3af605db Return queue_empty for Device::poll 2022-05-10 16:35:56 -07:00
Emilio Cobos Álvarez
a613a568b6
Update parking_lot. (#2639) 2022-05-03 04:28:17 +00:00
Connor Fitzgerald
e54a36ee78
Move texture-array example over to wgsl (#2618) 2022-04-25 18:32:53 +00:00
Connor Fitzgerald
bc850d2a0e
Bind group deduplication (#2623) 2022-04-25 04:19:25 +00:00
Jinlei Li
8feac35033
Update texture_create_view logic to match spec (#2621) 2022-04-21 12:08:13 -04:00
Jinlei Li
5706263917 Rename dispatch -> dispatch_workgroups 2022-04-20 23:24:21 -07:00
Jim Blandy
6d7c092dad Update Naga to 85056524 (2022-4-18). 2022-04-18 20:27:42 -07:00
Jim Blandy
06ee8a6862 Permit non-struct, non-array types as buffers.
Fixes #2583.
2022-04-18 09:50:51 -07:00
Jim Blandy
3d10678a91 Update to Naga 0e2bb019. 2022-04-18 09:09:47 -07:00
Kevin Reid
cb7ad30d58 Prefix every wgpu-generated label with (wgpu internal).
This is intended to help developers new to wgpu or to graphics debugging
quickly recognize in a debugging tool which items are wgpu-generated, as
opposed to either part of their program or part of the platform graphics
system.

I also removed existing marker-like text such as leading underscores and
angle brackets.
2022-04-15 22:39:08 -07:00
Igor Shaposhnik
eff50436f5 Update to Naga rev 1720725 2022-04-15 22:22:48 +03:00
Jim Blandy
a47b5c554f Update to Naga rev 7aaac25f. 2022-04-13 14:41:26 -07:00
Jim Blandy
84fadca870 wgpu-core: Register new pipelines with device's tracker.
Without this change, `LifetimeTracker::triage_suspected` never notices
that compute or render pipelines are free, and they stick around until
the hub is destroyed.

Fixes #2564.
2022-03-31 22:59:11 -07:00
Jim Blandy
85e5c36b68 Tell cargo test to ignore pseudocode in gfx_select macro docs. 2022-03-31 22:59:11 -07:00
Jim Blandy
44dafd3b4d Documentation for various things. 2022-03-31 22:57:38 -07:00
Jim Blandy
3bdef1cbe3 Free the raw device when wgpu::Device is dropped.
Go ahead and call `global.device_drop` from `direct::Context::device_drop`.

Let `Global::device_drop` simply drop the life guard's `RefCount`, and
put off everything else entailed in freeing a device until
`Device::maintain` says its queue is empty and there are no more
references to it. (The user can reach that function, even after
dropping their `Device`, by calling `wgpu::Instance::poll_all`.)

Fixes #2563.
2022-03-31 22:54:20 -07:00
Jim Blandy
b58b512afb Add logging to Global::X_drop methods.
This adds `log::debug` lines reporting calls to the `wgpu-core` entry
points for dropping resources.
2022-03-31 22:51:49 -07:00
Jim Blandy
d6f3472467 Add logging to LifetimeTracker::triage_suspected.
This adds `log::debug` lines reporting the decision to actually free
something, for all resource types.
2022-03-31 22:51:49 -07:00
Jim Blandy
1e42208657
Provide a proper new method for RefCount. (#2570) 2022-03-31 22:50:48 -07:00
Alphyr
58f318550d
Fix clippy lints (#2560) 2022-03-28 09:00:09 -04:00
Jim Blandy
0d39818b91 Document some aspects of resource tracking. 2022-03-27 07:41:31 -07:00
Jim Blandy
1be43d8073
Document the gfx_select! macro. (#2555) 2022-03-23 19:35:42 -04:00
Jim Blandy
e821e185a1
Simplify implementation of RefCount and MultiRefCount. (#2548)
`RefCount::rich_drop_inner` is no longer used by anything other than `RefCount::drop`. It's simpler to just handle it directly in `drop`.

`MultiRefCount` has no need to heap-allocate the count, since it's
never cloned.
2022-03-21 16:40:11 -07:00
Igor Shaposhnik
c5d5dbc7eb [naga] Update naga with new struct members separator 2022-03-16 20:42:21 -07:00
Connor Fitzgerald
73f42352f3
Dx11 Backend (#2443) 2022-03-12 17:14:18 +00:00
Connor Fitzgerald
129c32ffc3 Prevent 3D compressed textures 2022-02-28 21:38:52 -08:00
Connor Fitzgerald
b61939650c Add DownlevelFlag to prevent copies between Depth32 Textures 2022-02-28 21:38:52 -08:00
Connor Fitzgerald
df50028e49 Fix up some downlevel capabilities 2022-02-24 23:52:41 -05:00
Connor Fitzgerald
80da80b497 Move limit comparison logic into wgpu-types for easy reuse 2022-02-24 23:52:41 -05:00
Connor Fitzgerald
b87e50feae Rename get_downlevel_properties to get_downlevel_capabilities 2022-02-24 23:52:41 -05:00
Connor Fitzgerald
1e403e12a3 Always check texture features if we're running on a downlevel platform 2022-02-24 23:52:41 -05:00
Jinlei Li
1bd85a835a Roll naga from 8e2e39e to a45b9a6 (27 revisions) 2022-02-22 15:45:05 -05:00
Jinlei Li
7f3c6f7019 vulkan: correctly set INDEPENDENT_BLEND,make runable on Android 8.x 2022-02-22 15:45:05 -05:00
Jinlei Li
01628a1fad vulkan: HDR ASTC formats support 2022-02-20 00:00:06 -05:00
Jinlei Li
fa35c0a0f4 Re-allow vk backend on Apple platforms via vulkan-portability feature 2022-02-18 20:26:53 -05:00
Dzmitry Malyshau
0545e36aa8 Validated render usages for 3D textures 2022-02-15 18:49:04 -05:00
Nicolas Silva
210014ed89 Fix mistake in Access doc comment. 2022-02-15 09:59:42 -05:00
Jinlei Li
1c17d15507
Metal backend ASTC HDR formats support (#2477) 2022-02-15 09:43:16 -05:00