Commit Graph
1062 Commits
Author SHA1 Message Date
Erich Gubler fb67de908e refactor: resolve clippy::explicit_auto_deref 2022-11-07 17:36:04 -08:00
Andreas ReichandConnor Fitzgerald 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 ReingruberandConnor Fitzgerald 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
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 GentileandMauro 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
ImbrisandConnor Fitzgerald 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 SilvaandConnor Fitzgerald 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 SilvaandConnor Fitzgerald 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