Commit Graph
8897 Commits
Author SHA1 Message Date
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
SpaceCat~Chan f2624ea378 [glsl-in] add support for .length() (#2017)
Adds parsing support for methods on the glsl frontend, while `.length` is the only method in the base extensions, there might be more in extensions.

Adds support for the `.length` method and tests for it.
2022-08-08 18:09:22 +01: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
Christofer Nolander cfbc91d6cf add emit_to_{stderr,string} helpers for validation errors (#2012)
Mirrors those already found for parse errors.

Also removes the `StringErrorBuffer` writer in favor of the existing `NoColor` writer (from `codespan`) and added the emit_to_string_with_path method to complete the set.
2022-08-06 22:48:07 +01: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
Jim Blandy 228998ae0d Update ci.yml from macos-10.15 to macos-11. (#2940) 2022-08-03 19:27:42 -04:00
João Capucho c6f34fa4d8 dot-out: Improvements
Improves the dot backend output by:
- Linking new nodes to the end of other blocks, instead of the beginning
- Generating merge nodes for conditional statements
- Generating connections from break/continue nodes to their target
- Introducing a "cfg only" mode that only generates statements
2022-08-03 15:01:26 -07:00
Kevin Reid 780209dfb4 Add Buffer::size() and Buffer::usage(). (#2923) 2022-08-02 17:10:49 -04:00
aniandConnor Fitzgerald 29f5f8f60e Add WGSL examples to documentation (#2888)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-08-02 19:24:10 +00:00
i509VCB 8444fbe460 vulkan: fix issues querying multiview support (#2934) 2022-08-01 20:55:53 -04: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
SeamoooandConnor Fitzgerald 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
ReeceandABuffSeagull 4cbf8cfcf1 Fix opening of renderdoc lib (#2930)
* Fix opening renderdoc lib

Renderdoc needs to not be opened by us, but instead open the existing copy.
Unfortunately this requires OS specific flags for opening, plus `libloading`
doesn't have full API coverage currently.

* Added changelog entry for #2930

* Hide RTLD_NOLOAD behind a cfg for unix

Co-authored-by: ABuffSeagull <reecevanatta@hey.com>
2022-08-01 01:39:55 +00: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
Kevin Reid b784eee5af Silence clippy::let_unit_value false positives on objc::msg_send calls. (#2924) 2022-07-31 17:55:37 -04:00
Kevin Reid a420e453c3 StagingBelt: check for free chunks in the receiver as well as free_chunks. (#2906)
* StagingBelt: check for free chunks in the `receiver` as well as `free_chunks`.

Previously, chunks would only be taken from the GPU callback receiver
and put on `free_chunks` during `finish()`. So, there might be chunks
that are actually available for use but wouldn't be used.

Now, we consult the receiver whenever we're about to consult the
`free_chunks`, so the reuse of chunks will be as good as possible (given
the application's uses of operations that trigger `map_async` callbacks).

* Changelog entry.
2022-07-26 14:59:27 +00:00
Valentin 271bb8690e Fix documentation claiming shader entry points must return void (#2911) 2022-07-26 03:40:32 +00:00
i509VCB 75519839be export AdapterContext in Gles hal (#2870) 2022-07-25 23:37:50 -04:00
Kevin Reid 7b487682d9 Expand StagingBelt documentation. (#2905) 2022-07-26 03:36:56 +00:00
Leo Kettmeir aae8c6aaec update deno (#2901) 2022-07-25 23:31:58 -04:00
Nicolas Silva d0aa3f471a Validate the number of color attachments in create_render_pipeline (#2913) 2022-07-25 23:28:52 -04:00
Jeron Aldaron Lau a0058217d6 Make termcolor dependency optional (#2014) 2022-07-23 00:46:28 -04:00
Connor Fitzgerald 537c6bed4e Add warning when using CompareFunction::*Equal without an invariant Attribute (#2887) 2022-07-21 02:24:49 -04:00
Leo Kettmeir 6448c6062f add CODEOWNERS file (#2896) 2022-07-20 12:47:34 -04:00
Leo Kettmeir 534ad76d5a upstream deno changes (#2895)
* upstream GPUAutoLayoutMode

* clean up symbols and fix miscalled op

* fix gfx-rs/wgpu#2778
2022-07-20 12:47:10 -04:00
Ashley cc985396da Handle Unpack2x16float in hlsl (#2002) 2022-07-17 03:18:48 -04:00
ani 8f302a89ef Update reserved WGSL keywords (#2009) 2022-07-17 00:40:05 -04:00
Seamus Mulholland-Patterson e49ef97311 added changelog entry for #2886 2022-07-15 14:11:04 -04:00
Seamus Mulholland-Patterson 6d4677fd7f added downlevel restriction error message for InvalidFormatUsages error 2022-07-15 14:11:04 -04:00
Connor Fitzgerald 48325f1aaa v0.13.2 changelog (#2882) 2022-07-14 01:29:09 +00: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
Jim Blandy 18d053d5af Specify an exact wasm-bindgen-cli version in publish.yml. (#2873)
The versions of wasm-bindgen-cli run by `.github/workflows/publish.yml` must
exactly match the version of `wasm-bindgen` used by `wgpu`. At the moment,
`wgpu/Cargo.toml` specifies `0.2.81`, and our `Cargo.lock` agrees, so
that is what `publish.yml` should mention.
2022-07-13 12:37:47 -04:00
Jim Blandy 5094525fb8 For wgpu web backend, use a real type for submission indices. (#2874)
The wgpu web backend uses `()` as `Context::SubmissionIndex`, which is
fine --- WebGPU provides no way to identify individual queue
submissions --- except that Clippy is concerned about us passing
around `()` in the front end as if it were a real value. Instead,
define a new zero-size `wgpu::backend::web::SubmissionIndex` type for
this use.
2022-07-13 12:37:21 -04: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
Jinlei Li ecf3f5ec38 metal | vulkan-portability: extract the generic code into get_metal_layer (#2826) 2022-07-10 23:06:32 -04:00
i509VCB a108efe6b6 expose context and display from adapter and device for egl hal (#2860) 2022-07-10 18:50:54 -04:00
i509VCB 0dfb1115d2 document Adapter::new_external in wgpu-hal (#2863) 2022-07-10 18:49:53 -04:00
Nicholas Rishel 4add620d37 Fix instruction to run example test in README. (#2868) 2022-07-10 22:18:01 +00: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
i509VCB 94c065cb33 allow access to queue family index in vulkan hal device (#2859) 2022-07-07 19:43:13 -04:00
Ashley 17dcf39a1b Rename hlsl input/output structs (#2001) 2022-07-06 14:27:54 -04:00
Connor Fitzgerald 9c5015f059 Update Changelog 2022-07-06 11:06:34 -04:00
Connor Fitzgerald 259991e258 Refactor GLES's texture_format_capabilities 2022-07-06 11:06:34 -04:00
Connor Fitzgerald 499e9e628e Properly query SRV and UAV format features for depth formats 2022-07-06 11:06:34 -04:00