Commit Graph

16 Commits

Author SHA1 Message Date
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
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
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
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
Daniel McNab
7709010a79
Naga(msl): Clear named expressions after writing each function (#4594)
This appears to match other backends, and fixes
fix the case where expressions which were named in earlier
functions are used in local variable declarations
2023-11-02 18:46:36 +00:00
Jim Blandy
ea8b619ba4 Add some doc comments to naga::proc::constant_evaluator. 2023-11-02 19:22:35 +01:00
Jim Blandy
e6063c5255 [wgsl-in] Replace TypedExpression with a generic enum, Typed.
Replace the `TypedExpression` struct, used to distinguish between WGSL
pointers and references since Naga has only `Pointer`, with an enum,
`Typed`, with variants for references and plain types. This cleans up
a bunch of code, since the struct's `is_reference` field basically
served as a detached enum discriminant. This also prepares the code
for adding abstract types.
2023-11-02 19:21:31 +01:00
dependabot[bot]
5661de7a3c
Bump arbitrary from 1.3.1 to 1.3.2 (#4616)
Bumps [arbitrary](https://github.com/rust-fuzz/arbitrary) from 1.3.1 to 1.3.2.
- [Changelog](https://github.com/rust-fuzz/arbitrary/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-fuzz/arbitrary/compare/derive_arbitrary@1.3.1...v1.3.2)

---
updated-dependencies:
- dependency-name: arbitrary
  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-10-31 01:50:52 -04: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
Jim Blandy
61bca7e0aa
wgsl-errors: Reverse "old" and "new" sides of diff output. (#4577)
When an error snapshot test fails and we generate a diff comparing the
expected output with the actual output, treat the expected output as
the diff "from", and the actual output as the diff "to" - not the
reverse.
2023-10-26 20:12:39 -04:00
Connor Fitzgerald
34e947de4b
Integration of Naga into Repo (#4296) 2023-10-25 16:51:36 -04:00
Connor Fitzgerald
5369eec3b2
Move naga to subfolder 2023-10-25 14:25:04 -04:00