Commit Graph
8897 Commits
Author SHA1 Message Date
Jim Blandy c9ae35edbb [naga wgsl-in] Include base when printing pointer and array types.
When formatting `TypeInner::Pointer` and `TypeInner::Array` as WGSL
source code, bother to actually generate text for the target/element
type. This avoids producing ridiculous messages like:

> the type of `foo` is expected to be `array<unknown, 2>`, but got `array<unknown, 2>`
2023-11-17 23:36:15 +01:00
daxpedda 8859310be2 Add more lints (#4598) 2023-11-17 15:59:56 -05:00
Jim Blandy 15f49fbb59 Fix typo in pull request template. (#4712) 2023-11-17 14:59:20 -05:00
Teodor Tanasoaia a34e39ad2f [dx12] filter out haswell iGPUs (#4709) 2023-11-17 13:40:09 -05:00
Teodor Tanasoaia a26e4a009a [naga] remove span and validate features (#4706) 2023-11-17 13:37:25 -05:00
Fredrik Fornwall a5c93caa56 Add more metal keywords (#4707) 2023-11-17 17:02:36 +01:00
Connor Fitzgerald 77f6e66dc9 Update pull_request_template.md 2023-11-16 19:53:18 -05:00
daxpedda bec6560e10 Add WasmNotSendSync (#4702) 2023-11-16 19:47:10 -05:00
Jim Blandy 3ec547cdca [naga] Preserve spans when compacting Arenas.
When compacting a module, properly adjust spans along with `Arena`
contents.
2023-11-16 22:50:54 +01:00
daxpedda addb1e081f Safe surface creation (#4597) 2023-11-16 16:40:14 -05:00
Nicolas Silva 1d7c7c8a3c Prevent panic when submitting a destroyed buffer 2023-11-16 14:16:53 +01:00
Vrishabh c12c377f09 remove winit from hello-compute example (#4699) 2023-11-16 13:08:57 +00:00
Jim Blandy b7dd59e1dc [naga] Let constant evaluation handle Compose of Splat.
When consuming a `Compose` expression that constructs a vector,
flatten `Splat` subexpressions out into their components.

Fixes #4581.
2023-11-16 13:34:27 +01:00
Connor Fitzgerald acaeb8d9b1 Backport 0.18.1 changelog (#4694) 2023-11-15 21:40:12 +00:00
dependabot[bot] 8870a085a8 Bump termcolor from 1.3.0 to 1.4.0 (#4688)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-15 12:27:05 -05: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
Jim Blandy 611471c4bc Update CHANGELOG.md. 2023-11-14 20:12:31 -08:00
Jim Blandy ecb522e4e3 [naga] New tests for GLSL double-precision builtin functions. 2023-11-14 20:12:31 -08:00
Jim Blandy 16965f64e5 [naga wgsl-out] Correctly include width in matrix constructions.
When generating WGSL for an `Expression::Compose` constructing a
matrix, consult `TypeInner::Matrix::width` when writing the
type name in the construction expression, rather than just always
writing `matNxM<f32>`.

Fixes #4681.
2023-11-14 20:12:31 -08:00
Jim Blandy 721e611b79 [naga glsl-in] Fix type of double ldexp's second arg.
The second argument of the GLSL `ldexp` builtin is always a 32-bit
integer or a vector of such, never a 64-bit integer. In
`inject_common_builtin`, that argument's type should not be influenced
by `float_width`.

Fixes #4680.
2023-11-14 20:12:31 -08:00
Jim Blandy 324ec4a5ec [naga glsl-in] Fix double overload for dot/reflect/distance/ldexp.
The first argument of the `dot`, `reflect`, `distance`, and `ldexp`
GLSL builtin functions may be either a float or a double, and thus the
argument type registered by `inject_common_builtin` must depend on the
`float_width` argument; it cannot simply be `Scalar::F32`.

Introduced by #4673.
2023-11-14 20:12:31 -08:00
Jim Blandy cf2405ca39 [naga wgsl-in] Use to_wgsl functions everywhere appropriate.
Replace `ExpressionContext`'s methods `format_typeinner`,
`format_type`, and `format_type_resolution` with more `to_wgsl`
methods in the `naga::front::wgsl::to_wgsl` module.
2023-11-14 19:58:49 -08:00
Jim Blandy 941cd2e25c [naga wgsl-in] Let TypeInner::to_wgsl take the context by reference. 2023-11-14 19:58:49 -08:00
Jim Blandy cbb59c7bf3 [naga wgsl-in] Move all to_wgsl functions into their own module.
This is code motion only, with minor doc fixes. There should be no
changes to the code.
2023-11-14 19:58:49 -08:00
Jim Blandy a6aa3cd30d [naga] Follow-ups to #4763, Introduce Scalar type to IR.
Clean up some things that should have been taken care of in the
original PR:
- Use `Scalar::float` helper.
- Use `Scalar` associated constants in match patterns.
- Use `Scalar`'s `PartialEq` implementation.
- Clean up identifier paths.
2023-11-14 21:42:38 +01:00
Jim Blandy 734e246e87 [naga] Improve algorithm for Module compaction.
Identify reachable function expressions, constant expressions, and
types using a single pass over each arena, taking advantage of the
fact that expressions and types may only refer to other entries that
precede them within their arena. Only walking the statement tree still
requires a worklist/recursion.

In addition to presumably being faster, this change slightly reduces
the number of non-comment lines of code in `src/compact`.
2023-11-14 11:18:43 -08:00
Nicolas SilvaandTeodor Tanasoaia 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
Jim Blandy 049cb75976 [wgpu-test] Fix typo in error message. 2023-11-13 14:23:32 -08:00
felix sanchez d9b3ffde72 add new line in readme (#4672) 2023-11-13 19:17:54 +00:00
Andreas ReichandTeodor Tanasoaia 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
dependabot[bot] 406119ff71 Bump env_logger from 0.10.0 to 0.10.1 (#4674)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 10:14:42 -05:00
Westerbly Snaydley 2e7fd75712 vk: Enable FifoRelaxed PresentMode (#4666) 2023-11-10 17:09:42 +00:00
dependabot[bot] 951ba61300 Bump tokio from 1.33.0 to 1.34.0 (#4663)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.33.0...tokio-1.34.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-10 17:00:16 +01:00
dependabot[bot] ae48566f25 Bump smallvec from 1.11.1 to 1.11.2 (#4664)
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.11.1 to 1.11.2.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.11.1...v1.11.2)

---
updated-dependencies:
- dependency-name: smallvec
  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-10 16:59:46 +01: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
dependabot[bot] 5f79800244 Bump getrandom from 0.2.10 to 0.2.11 (#4651)
Bumps [getrandom](https://github.com/rust-random/getrandom) from 0.2.10 to 0.2.11.
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.2.10...v0.2.11)

---
updated-dependencies:
- dependency-name: getrandom
  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-08 09:47:18 +01:00
dependabot[bot] 01cb63c758 Bump serde from 1.0.191 to 1.0.192 (#4652)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.191 to 1.0.192.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.191...v1.0.192)

---
updated-dependencies:
- dependency-name: serde
  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-08 09:46:47 +01:00
dependabot[bot] ba3d6898f1 Bump serde from 1.0.190 to 1.0.191 (#4646)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.190 to 1.0.191.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.190...v1.0.191)

---
updated-dependencies:
- dependency-name: serde
  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-07 12:12:05 +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 1d4fa812ef Gate usage of metal::ComputePassDescriptor on timestamp query support (#4643) 2023-11-06 14:30:04 +00:00
Teodor Tanasoaia 261cb7c27d Check if source is empty when constructing hal::DebugSource 2023-11-06 14:32:29 +01:00
Connor Fitzgerald 7f72c9fc3b Fix GL Push Constant Layout (#4607)
* It verks!

* More tests

* Fixes

* Working multi-stage push constants

* Comments

* Add push constant partial update teste

* Docs

* Update Cargo.toml

* Comments
2023-11-06 07:58:26 -05:00
Jim Blandy 267bd488d3 [naga wgsl-in] Introduce Scalar type.
Introduce a new struct `Scalar`, holding a scalar kind and width, and
use it as appropriate in the WGSL front end. This consolidates
many (kind, width) pairs, and lets us name the two components.

Ideally, `Scalar` would be used throughout Naga, but this would be a large
change, touching hundreds of use sites. This patch begins by
introducing `Scalar` to the WGSL front end only.
2023-11-06 13:27:49 +01:00
Connor Fitzgerald 0dad15989f Pass 3 on examples (#4640) 2023-11-06 04:41:49 +00:00
dependabot[bot] 0004e96fa4 Bump syn from 2.0.38 to 2.0.39 (#4638)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-05 23:15:41 -05:00
dependabot[bot] fe1429b927 Bump wasm-bindgen-test from 0.3.37 to 0.3.38 (#4637)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-05 23:15:27 -05:00