Commit Graph

67 Commits

Author SHA1 Message Date
João Capucho
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
Dzmitry Malyshau
7a45d73465 Release v0.6 version, changelog, and spirv update 2021-08-18 00:39:25 -04:00
Dzmitry Malyshau
d55645ac1e Fix bitflags at 1.2 (#1190) 2021-08-12 00:57:13 -04:00
Alex Es
fd70116668 Proof of concept for "span" feature, with WGSL & GLSL parsing augmented. (#1092)
* Proof of concept for "span" feature, with WGSL parsing augmented.

* Review:

1) add_span was actually a bad idea, make it set_span and add
set_span_if_unknown too.
2) panics on getting/setting span for invalid handles.
3) only set span for constants with a name
4) don't overwrite spans for types.

* Added spans to blocks & more expressions getting spans in frontends.

Definitely the shotgunny type of commit, but what can you do. The design
I went with made spans mandatory to specify, so I had to go and wire
them through wherever I could.

* Moved Block to a separate module, +clippy

* More spans for types in GLSL.

* Remove pointless body method.

* Make Arena interface require spans.

Another shotgun commit, oh boy...

* Fix tests.

My loathsome habit to "quickly fix things along the way" made a lot of
extra work for me here, having to fix my "fixes" for WGSL parser.

* Rustfmt + clippy.

* Fix compile-errors with span feature enabled.

* Nuked set_span* from orbit. Deleting code feels great!

* Code review - move feature flags inside functions.

* Fix build with "deserialize" feature enabled.
2021-08-11 16:04:32 -04:00
Jasper St. Pierre
0b69aa8b8a Init env_logger in snapshots tests
For debugging. Maybe there's a way to do it for all tests,
not sure...
2021-07-14 17:48:54 -04:00
Dzmitry Malyshau
8376bab562 Bump version to 0.5 2021-06-18 20:18:52 -04:00
Jim Blandy
fd83816945 Add . to the workspace's default members. Test with no features.
Naga is now a workspace with `naga` and `cli` as its two members. The default
package for cargo commands is `cli`, so that `cargo run` will just run the CLI.

However, this has a few unexpected consequences:

- Now `cargo test` will just try to run `cli`'s tests, of which there are none.
  Adding `"."` to the `default-members` list in the workspace's `Cargo.toml`
  seems to fix this, without breaking `cargo run`.

- Even with `"."` added to `default-members`, `cargo test` will build `naga` by
  default with the features requested for it in `cli/Cargo.toml`: all the front
  and back ends, but no `serialize` or `deserialize`. This means that our CI job
  meant to verify no-feature builds isn't doing that job any more. We need to
  pass `--package naga` to `cargo test` to make it test naga directly.
2021-06-16 13:53:00 -04:00
Jakob Hellermann
4224d14a08 move bin/naga.rs to a separate crate in workspace (#938)
* move bin/naga.rs to a separate crate

* enable all shader languages for naga binary

* [naga-cli] add env logger

* [naga-cli] remove unneccessary code

* [naga-cli]enable glsl-validate feature

* move naga-cli to cli, add trailing newline

* remove commented env_logger dependency
2021-06-12 19:24:01 -04:00
Igor Shaposhnik
ce88c9d537 Exclude bin and tests from publishing 2021-06-03 13:06:45 -04:00
João Capucho
39ccec5e7d [glsl-in] Update pp-rs for location info 2021-05-19 16:24:26 -04:00
João Capucho
ff8f15e034 [glsl-in] Start writting a parser without pomelo 2021-05-19 16:24:26 -04:00
Matúš Talčík
0960d1162f [spv-in] multiple improvements
- added constructs
- added loop detection
- some logic from Tint borrowed for selection constructs
2021-05-06 10:49:09 -04:00
Dzmitry Malyshau
93e57ffcf2 Another CHANGELOG update for v0.4 (#796) 2021-04-29 00:52:43 -04:00
Dzmitry Malyshau
74f0a153cb Rename the binary to just naga 2021-04-23 20:14:16 -04:00
Igor Shaposhnik
c1675d06f9 Start wgsl-out (#727) 2021-04-19 00:23:27 -04:00
Dzmitry Malyshau
c2c93e4ecd Remove cargo-insta 2021-04-14 16:10:31 -04:00
Timo de Kort
5d487941b2 Start hlsl-out (#408)
* Add hlsl-out feature

* Integrate hlsl-out with snapshots

* Add snapshot
2021-04-11 11:36:26 -04:00
Dzmitry Malyshau
62fe72be2e Enable all features for the docs 2021-04-01 10:26:00 -04:00
Dzmitry Malyshau
dd823a4b84 Enforce pointer semantics at the type level. 2021-03-06 11:01:14 -05:00
Dzmitry Malyshau
3fcc0759ed GraphViz backend 2021-03-03 21:20:12 -05:00
Dzmitry Malyshau
69bf7f5f17 Miscellaneous fixes 2021-03-01 09:35:29 -05:00
Joshua Groves
bb7105387d [wgsl-in] Use codespan to report errors 2021-02-28 00:07:37 -05:00
Dzmitry Malyshau
afbcf05006 Move the convert from an example to a binary target 2021-02-25 10:05:21 -05:00
Pelle Johnsen
51cbd4c112 [glsl-in] Add initial support for glslpp-rs (#513)
* [glsl-in] Add initial support for glslpp-rs

* [glsl-in] Add remaining Punct mappings

Fix some tests.

* [glsl-in] Add basic error handling for glslpp-rs

* [glsl-in] Fix clippy issues

* [glsl.in] Add pp-rs floats

* [glsl-in] Remove old lex and preprocessor

* [glsl-in] Improve lexer token code

* [glsl-in] Rename lex_pp > lex

Also LexerPP > Lexer

* [glsl-in] glslpp-rs review feedback

* [glsl-in] Use rev for pp-rs dep

* [glsl-in] Parse on lexer err
2021-02-24 12:07:09 -05:00
Dzmitry Malyshau
91a1f581e0 Fix insta dependency to 1.5.2 2021-02-15 11:13:11 -05:00
Dzmitry Malyshau
537a516ff5 Version bump to 0.3.1 2021-01-31 18:27:08 -05:00
Dzmitry Malyshau
40974d503c Bump version to 0.3 and update changelog 2021-01-30 11:48:37 -05:00
Dzmitry Malyshau
dc98305bb8 Print out detailed WGSL errors 2021-01-28 01:22:10 -05:00
Dzmitry Malyshau
08b6c416a3 Unlock arbitrary binding indices in the validator 2021-01-09 20:59:51 -05:00
Joshua Groves
9a625a570e Add insta prototype 2020-12-10 00:24:07 -05:00
Dzmitry Malyshau
148fac0601 [spv] enable quad conversion test, refactor binary operations 2020-12-08 09:25:59 -05:00
Capucho
bc0d876422 [glsl-out] Backend cleanup
Moved the global writing part to it's own function
Merged the texture and the global loop
Applied some suggestions from kvark
Added a topological sorting of the call graph before writing
Removed the struct block loop and now every struct is written
Organized the main backend file a bit
2020-11-22 14:45:12 -05:00
Capucho
dd5021234d [glsl-out] Reworked the backend
The backend now works in a similar way to the msl backend
Should require less loops, allocations and backtracking
Overall just better to work with it

Added a build script which reads a file with the glsl keywords and
generates a slice to be used in the Namer

Added a way to build a call graph
2020-11-22 14:45:12 -05:00
Dzmitry Malyshau
621af3cbcb Bump thiserror to 1.0.21 (#241) 2020-10-20 14:44:56 -04:00
Dzmitry Malyshau
d6cc17f051 Refactor feature names 2020-09-15 07:51:45 -04:00
Dzmitry Malyshau
b278e10ea7 [spirv-in] make pointers totally transparent (#187) 2020-09-11 12:19:55 -04:00
Pelle Johnsen
2ea0310b63 [glsl] Promote glsl-new to glsl (#184)
* [glsl] Promote glsl-new to glsl

* [glsl-in] rename feature glsl > glsl-in
2020-09-10 01:11:52 -04:00
Dzmitry Malyshau
1b17030d05 Split wgsl into sub-modules, and gate by a feature (#165) 2020-08-27 23:30:53 -04:00
Dzmitry Malyshau
4797773152 Image IR refactor (#153) 2020-08-26 13:26:51 -04:00
Pelle Johnsen
92c1ffb588 Add initial Rosetta testing (#148)
* Add initial Rosetta testing

* Make rosetta tests run as part of cargo test

* Fix rosetta test failure
2020-08-24 00:09:37 -04:00
Matus Talcik
c12c9a9fac init control flow graph (#122)
format

major refactor


Change spirv to spirv_headers


Remove files


First translation to naga + format


Fix Int Constant error


Don't add unnecessary blocks.


Some cleanups


format


remove constructs


docs


fix debug leftovers


format, clippy


satisfy clippy
2020-08-23 23:14:51 -04:00
Dzmitry Malyshau
50cd2b1bc2 Bump version to 0.2, add changelog 2020-08-16 23:49:48 -04:00
Pelle Johnsen
7f780e8efc [glsl-new] put validation errors behind featureUsing glsl-validate feature (#127) 2020-08-13 16:27:12 -04:00
Lachlan Sneff
466cd1b728 Serialize and Deserialize Module (#125)
* Add serialize and deserialize features with examples

* Fix formatting

* Make some types (de)serialize transparently

* Fix more formatting

* Remove new examples and add (de)serialization support to the convert example

* Remove extraneous file

* Rename param file
2020-08-13 12:27:10 -04:00
João Capucho
a16204456e WIP: glsl 450 backend and common glsl module (#123)
* Initial backend implementation

* Refractored glsl450 backend to have a common module between further glsl backends
Implemented more missing functionality

* Error handling

* Implemented most of the suggestions

* Addresed all comments
Fixed some bugs

* Made code style consistent
2020-08-11 16:20:23 -04:00
Dzmitry Malyshau
4a769c10b5 [spv] remove the pointer indirection to variables 2020-07-05 09:33:07 -04:00
Pelle Johnsen
7d5bc0b2e2 Make glsl dep more specific
- Require 4.1 as 4.0 now gives compile errors
2020-07-02 00:20:00 -04:00