Commit Graph

1467 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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