Commit Graph
113 Commits
Author SHA1 Message Date
Jim Blandy 8b267218a4 Implement module compaction.
Add a new Naga feature, `"compact"`, which adds a new function
`naga::compact::compact`, which removes unused expressions, types, and
constants from a `Module`.
2023-09-20 18:46:33 +02:00
daxpedda bd74b11b4c Bump indexmap to v2 (#2426) 2023-08-11 16:28:28 +02:00
daxpedda 24afaa5cfd Properly test -Zminimal-versions (#2429)
* Properly test `-Zminimal-versions`

* Fix minimal version requirement
2023-08-11 15:32:49 +02:00
Jim Blandy 543cae17a3 Bump MSRV to 1.65. 2023-08-02 09:25:31 -07:00
Connor Fitzgerald bac2d82a43 Bump naga versions 2023-07-20 22:20:46 -04:00
Connor Fitzgerald c67fcc24bb Bump dependencies 2023-07-20 22:20:46 -04:00
Fredrik Fornwall 981c1f9196 Fix installing naga-cli from git (#2398)
Move hl-snapshots out from the xtask workspace, since it's also used as
a dev dependency in the naga crate itself for a test.
2023-07-08 01:33:48 +02:00
Erich Gubler 273ff5d829 style: alphabetize dev-dependencies 2023-06-08 16:56:57 +02:00
Erich Gubler 91d48b2923 build: move from make to cargo xtask workflows
Re-implement `naga` development workflows using [`cargo xtask`]. Convert
`make` logic and shader test configuration as file with Bash variables
into an `xtask` crate and YAML files, respectively.

Pros:

* We now have a _portable_ workflow everywhere, which means Windows
  folks and people who don't install `make` don't have to suffer.
  😮‍💨
* Workflow logic is now relatively easy to inspect and change. Whew!
  💁🏻‍♂️💦
* Contributors can use their existing Rust knowledge to contribute to
  developer experience. 🎉
* `cargo xtask` is a relatively well-known convention for workflows in
  the ecosystem.
* We can do fancy things like allow folks to run at different log levels
  for workflows, depending on their tastes.

Cons:

* There's now a non-trivial compile step to project workflow.
  Incremental rebuilds seem to be pretty short, though!
* Code is much more verbose than the (very) terse `make` implementation.

[`cargo xtask`]: https://github.com/matklad/cargo-xtask
2023-06-08 16:56:57 +02:00
daxpedda b7f4006e46 Bump bitflags to v2 (#2358) 2023-06-01 15:40:47 +02:00
Connor Fitzgerald b99d58ea43 Update to version 0.12 2023-04-19 17:04:49 -04:00
teoxoy a2b39e45bf [hlsl-out] clear named_expressions inserted by duplicated blocks
changed the type of `named_expressions` from `HashMap` to `IndexMap` so that insertion order is preserved
2023-01-31 10:43:02 -08:00
Connor Fitzgerald f0edae8ce9 Update to 0.11 (#2222) 2023-01-25 21:27:09 +00:00
Teodor Tanasoaia 5b79cca384 bump MSRV to 1.63 (#2129) 2022-11-18 16:29:49 +00:00
Erich GublerandDzmitry Malyshau aa22301b4b Parenthesize unary negations to avoid -- (#2087)
* fix(glsl-out,hlsl-out,msl-out): parenthesize unary negations a la `wgsl` everywhere

Unify parenthesization of unary negations across all backends with what the `wgsl` backend does,
which is `<op>(<expr>)`. This avoids ambiguity with output languages for which `--` is a different
operation; in this case, we've been accidentally emitting prefix decrements.

* build: update `rspirv` 0.11 -> 0.12 (FIXME: use upstream release)

* test: add `operators::negation_avoids_prefix_decrement` test

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2022-11-17 11:43:56 +01:00
Erich Gubler b37dda8854 build: move to the Rust 2021 edition (#2085)
* build: move to the Rust 2021 edition

Since the MSRV of `naga` [is currently 1.56][msrv], I don't think there's a strong reason to stay
with the 2018 edition, and there _are_ a [few good reasons][edition-guide] to move to the 2021
edition.

I did this migration mostly automatically, per [official Rust guidelines]:

```sh
$ cargo fix --edition --all-targets
$ sed -i Cargo.toml 's/2018/2021'
$ cargo fix --edition-idioms --allow-dirty # doesn't change anything
```

The only manual edit needed to stymie a new warning introduced was the removal of the `TryFrom`
import in several modules, since it's now in the 2021 prelude.

[msrv]: https://github.com/gfx-rs/naga/blob/a7193d652e49180661a6ca047889e0685667acdb/.github/workflows/pipeline.yml#L14
[edition-guide]: https://doc.rust-lang.org/edition-guide/rust-2021/index.html
[official Rust guidelines]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html#edition-migration

* refactor(wgsl-in): use `pat` instead of `pat_param` again

How we were using `pat` in the Rust 2018 edition is actually the use case that
Rust 2021's `pat` fragment specifier is intended to satisfy. So, let's just use
that!
2022-10-25 08:44:17 -07:00
Sludge a7193d652e Fix repository link pointing to the 0.9 branch (#2078) 2022-10-06 19:39:41 -04:00
Connor Fitzgerald c52d91023d Add changelog and bump version to 0.10 (#2077) 2022-10-05 17:04:49 -04:00
Max Ammann abc4e1572a Explicitely enable std, and don't rely on environment (#2062) 2022-09-17 12:39:34 -07:00
João Capucho 7d0e9847b0 Remove the glsl-validate feature
When it was introduced it was supposed to allow for fast compiles by
skipping glsl specific validation, but as it turns the subset of glsl that's
compilable code is already pretty close to the subset of valid glsl code.

So the current code gated behind glsl-validate amounts to a single branch that
isn't even performance sensitive, and most of the validation is not specific to
glsl and is made by naga's validator which can be turned off, so the original
goal of fast compile times by disabling validation can still be accomplished.
2022-09-05 19:37:39 -07:00
daxpedda 48e79388b5 Implement Clone for Module (#2013)
This is hidden behind the `clone` feature flag
2022-08-16 11:45:19 +01:00
Jeron Aldaron Lau a0058217d6 Make termcolor dependency optional (#2014) 2022-07-23 00:46:28 -04:00
Connor FitzgeraldandTeodor Tanasoaia 06ae90527d Release 0.9 (#1998)
* Release 0.9

* Further update changelog

* Apply suggestions from code review

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2022-06-30 19:51:46 +00:00
João Capucho 357da63076 Patch ron version (#1986)
Require at least version 0.7.1 of ron, this version changed how floating points are
serialized by forcing them to always have the decimal part, this makes it backwards
incompatible with our tests because we do a syntatic diff and not a semantic one.
2022-06-15 15:17:59 -04:00
Mehmet Oguz Derin 9c8a51830c Use Unicode 14 for WGSL
The unicode-xid crate just had a release with Unicode 14 data, which the WGSL spec requires.
2022-05-02 15:34:13 +02:00
teoxoy 850565243d replace unicode-id with unicode-xid 2022-04-18 13:03:37 -07:00
teoxoy 94467c770f fix bitflags min version 2022-04-18 08:08:22 -07:00
teoxoy 743c8aa387 update lexer to match more unicode characters 2022-04-17 21:01:01 -07:00
teoxoy bddfc34299 fix minimal-versions of dependencies 2022-04-17 20:59:59 -07:00
teoxoy 33085863b7 update msrv to 1.56 2022-04-16 08:32:31 -07:00
Dzmitry Malyshau 91990298b3 Don't test on MSRV, just check 2022-02-17 09:49:33 -05:00
Dzmitry Malyshau 5879f9ea73 bench: glsl, spirv, and bincode inputs 2022-02-17 09:49:33 -05:00
Dzmitry Malyshau b05f648842 bench: WGSL parsing 2022-02-17 09:49:33 -05:00
Dzmitry Malyshau b12ed2cc9e Fix arbitrary for MSRV 2022-01-14 12:44:27 -05:00
Dzmitry Malyshau 58b4fd0f57 IR fuzz target with Arbitrary implementations 2022-01-14 12:44:27 -05:00
Benoît du Garreau 9f37624592 Don't pin indexmap version 2022-01-12 13:31:40 -05:00
João Capucho 70b5ddaaad spv-out: use OpFRem instead of OpFMod 2022-01-07 20:19:15 -05:00
Jeff Muizelaar 848ae3dc6e Turn on panic = "abort" by default (#1597)
This reduces the size of a release naga binary on macOS
from 3.5MB to 3.2MB. It's also the configuration we use
for naga in Firefox.
2021-12-26 20:01:49 -05:00
Dzmitry Malyshau c2328fea75 Release v0.8 2021-12-18 12:05:12 -05:00
bjorn3 38366e382f Switch to rustc-hash
See gfx-rs/rspirv#221 for the rationale behind this change
2021-11-16 23:51:19 -05:00
Igor Shaposhnik 30a0a37af0 Update dependencies 2021-11-16 23:46:54 -05:00
Dzmitry Malyshau 3b49981111 Bump version to 0.7.1 2021-10-12 11:44:13 -04:00
Dzmitry Malyshau 3a2f7e611e Release 0.7 (#1455) 2021-10-07 18:04:30 -04:00
Igor Shaposhnik 3e1244c5cb Make shader validation under a separate feature (#1437) 2021-10-05 15:11:32 -04:00
Igor Shaposhnik a4bf25a0d5 Emit std430 layout qualifiers for storage buffers (#1435)
* Remove unused petgraph dependency from glsl-out

* Emit std430 layout qualifiers for storage buffers
2021-09-29 12:24:34 -04:00
Jim Blandy 944a693ae5 Use UniqueArena for types.
Ensure that each distinct type occurs only once in `Module::types`, so that we
can use `Eq` on `Type` or `TypeInner` for type equivalence, without being
confused by differing `Handle<Type>` values that point to identical types.

This removes a number of duplicate types from the ir snapshots.

Fixes #1385.
2021-09-27 15:17:41 -04:00
João CapuchoandJim Blandy 3049f63cad [spv-in] new block parser (#1294)
* [spv-in] New two pass parser based

* [spv-in] Allow expressions defined in dominant block in different scopes

* Make the patch non breaking

* [spv-in] Allow scope transfers in phi instructions

* [spv-in] Remove unused stuff

* [spv-in] Handle switch merges as breaks

* Remove no longer needed stuff

* Revert some changes to prepare to merge

* Remove dead code

* Don't spill into local if in scope

* [spv-in] Documentation, comments, some renaming for clarity.

* Address comments

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2021-09-10 08:51:05 -07:00
aentity a35de06f33 Update deps petgraph and rose-tree 2021-08-24 01:51:52 -04:00
Hans Christian Schmitz 58a5b7d2b9 Implement lexing and parsing for all WGSL number literal types (#1184)
* Implement lexing for all WGSL number literal types

* Move number literal test cases

* Adjust tests to match WGSL spec on number literals

Suffixes are not type names and currently only a plain `u` is supported
for uints. More specifically, `i` and `f` suffixes or suffixes with
widths in bits like `u32` are not supported at the moment.

* Add more tests for invalid number literal suffixes

* Replace code too new for Rust 1.43

* Implement parsing for hexadecimal integers

* Switch to enum number types, and Bytes for width

* Check for negative and leading zeros in int literals

* Implement parsing of hex floats with hexf-parse

* Update error message tests

* Update snapshot test output files

* Clean up lexer state machine code

* Clean up unexpected token error code

* Move number literal parsing to own submodule
2021-08-24 01:50:53 -04:00
Connor Fitzgerald 800f910103 Allow newer bitflags 2021-08-22 22:19:27 -04:00