Commit Graph

57 Commits

Author SHA1 Message Date
teoxoy
a730236b68 [wgsl-in] eagerly evaluate const-expressions
[wgsl-in] support const-expressions in attributes

allow `Splat` as an evaluated const-expression type
2023-10-12 13:13:26 +02:00
teoxoy
7c3c6a9d47 [glsl-in] move module and active body to Context 2023-09-05 14:00:17 -07:00
Jim Blandy
dce689cf58 [glsl-in]: Document some fields of naga::front::glsl::context::Context. (#2244) 2023-02-16 23:18:13 +00:00
Shaye Garg
67ea8f0c06 [wgsl-in] Split into multiple files (#2207)
Make changes suggested in #2075, but put off to a separate PR because they would interfere with reviewing the change:

- Split the new WGSL front end into modules in a logical way.
- Rename `Parser` to `Frontend`.
2023-01-31 07:17:58 -08:00
Teodor Tanasoaia
01fbdea21f fix 1.65 clippy lints (#2112) 2022-11-03 18:32:20 +01:00
Jim Blandy
115a810981 [glsl-in] Use std::mem::take as appropriate. (#1878) 2022-04-30 15:09:35 -04:00
Teodor Tanasoaia
7ce98dcc7d Make use of new language features (#1841)
* use strip_prefix

* make fn const (resolving TODO)

* make use of nested OR patterns in match arms

* warn on clippy::missing_const_for_fn

* constify functions

* ignore clippy::missing_const_for_fn for into_inner functions
2022-04-17 03:39:54 -04:00
teoxoy
dd75579d7c fix typos 2022-04-14 13:47:18 -07:00
Noel Tautges
42bf3545c9 Standardize some docs (#1660)
* Rewrite front/back doc summaries

- Use line comments instead of block comments
- Standardize language for each front/backend
- Add reference link for each format
- Minor punctuation changes

* Add documentation for keywords module

* Clarify contents of keywords module in summary

* Refer to modules by their type name

* Add basic summary for valid module

* Adjust EarlyDepthTest and ConservativeDepth docs

* Remove "in" from list

* Adjust wording

* Standardize format of docstrings

* Adjust module links to be consistent with other links

* Add summary for reserved keywords list

* Remove extraneous doc spaces with `cargo fmt`

* Correct spelling of whether and rewrite some lines

* Fill out GLSL backend docs

* Remove unnecessary link targets

* Fill out DOT backend docs

* Change module line comments to block comments

* Remove unnecessary spaces

* Fix mistake during rebasing
2022-02-03 13:27:21 -05:00
Dzmitry Malyshau
4c91abe5b3 wgsl: remove stride 2022-01-24 16:44:12 -05:00
João Capucho
af44603e47 [glsl-in] Use Span instead of SourceMetadata 2021-09-21 11:00:33 -04:00
João Capucho
4e181d6af4 [glsl-in] Only add builtins with double arguments if needed 2021-08-17 22:22:30 -04:00
João Capucho
b05ca6e403 [glsl-in] Builtin redefinition and calls fixes 2021-08-17 22:22:30 -04:00
João Capucho
b0b4891045 [glsl-in] Document public api 2021-08-09 10:51:15 -04:00
João Capucho
48a4a9b902 [glsl-in] Cleanup public api 2021-08-09 10:51:15 -04:00
João Capucho
1aaf77489b [glsl-in] Improve error api and make more errors deferred 2021-08-09 10:51:15 -04:00
João Capucho
f6e35f5b66 [glsl-in] Improved preprocessor and error handling 2021-08-09 10:51:15 -04:00
João Capucho
a8a316da15 [glsl-in] API revamp
The new api allows for reuse while keeping some allocations and to
please the borrow checker in future work, it also splits the parser into
logical modules to make it easier to work on.
2021-08-09 10:51:15 -04:00
João Capucho
057dc3100d [glsl-in] Remove support for multiple entry points 2021-08-04 11:06:57 -04:00
João Capucho
e0e840b22c [glsl-in] Implement std140 and std430 layouts
Structs are not yet implemented
2021-07-31 23:25:22 -04:00
Jasper St. Pierre
0995c7161e [glsl-in] Keep around extra linkage variables
WGSL will require this. Note that this still might
cause some issues with multi-entry-point GLSL
that I didn't know how to handle. That is, we will
handle unused builtin inputs but not unused
builtin outputs correctly right now. This is an existing
issue though, not a regression.

This is also provided as an option, but I feel like
the more correct approach is to never strip linkage
variables. We'll see though.
2021-07-14 17:48:54 -04:00
João Capucho
fd042e6f31 [glsl-in] Implement default for options 2021-06-20 23:11:16 -04:00
João Capucho
375f6fb38d [glsl-in] Use typed errors in the parser tests
Rename TokenMetadata to SourceMetadata to reflect it's actual use
2021-05-19 16:24:26 -04:00
João Capucho
7165a06fbf [glsl-in] Add glsl-validate and sampling qualifier 2021-05-19 16:24:26 -04:00
João Capucho
62d3956096 [glsl-in] function prototypes and overloading 2021-05-19 16:24:26 -04:00
João Capucho
8519095f55 [glsl-in] Handle global declarations
parse constant expressions fully
2021-05-19 16:24:26 -04:00
João Capucho
f8c8d192ae [glsl-in] WIP expression parsing 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
João Capucho
076349ddf7 [glsl-in] Export types to allow for error handling 2021-04-23 22:15:16 -04: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
Pelle Johnsen
408002815f [glsl-in] Multi entry points - address comments 2021-02-17 10:05:40 -05:00
Pelle Johnsen
1861fca4ba [glsl-in] Support multiple entrypoints 2021-02-17 10:05:40 -05:00
João Capucho
647dd76dba Moved the ConstantSolver to the glsl frontend 2021-02-06 00:25:30 -05:00
João Capucho
b55aa51f65 Add support for function declarations with arguments
Change ParseError to be public
Change globals to default to private instead of throwing error
2021-01-30 13:44:39 -05:00
Dzmitry Malyshau
bd998f6c32 Validate constant array sizes 2021-01-07 15:04:31 -05:00
Pelle Johnsen
511000d022 [glsl-in] Extract function logic out of parser 2020-12-23 14:54:53 -05:00
Pelle Johnsen
78c9e45182 [glsl-in] Add initial pre-processor (#238)
* [glsl-in] Add initial pre-processor

* [glsl-in] Tweak preprocessor after review

- Add IfState struct
- Use FastHashMap to pre-defines
- Use ok-or() for some errors

* [glsl-in] Remove Option in defines arg
2020-10-15 13:38:02 -04:00
Dzmitry Malyshau
081b90f117 Consolidate rosetta tests 2020-09-17 10:16:32 -04:00
Dzmitry Malyshau
2ebaadaf0c Refactor entry point IR 2020-09-17 10:08:49 -04:00
Pelle Johnsen
a9355f928f [glsl-in] Add gl_VertexIndex (#189)
* [glsl-in] Add gl_VertexIndex

Refactor variable handling out of parser.rs

* [glsl-in] Fixes for gl_VertexIndex

- Make lookup_variable a method of Program

- Try to cleanup conditional logic

* [glsl-in] Error on gl_ builtin in wrong stage

Wrapped in glsl-validate feature
2020-09-13 21:20:46 -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
c122e064a7 Move storage class from image type into the global declaration (#182) 2020-09-09 13:59:29 -04:00
Matus Talcik
b67739034e Implement Execution Modes (#169)
Add documentation, make clippy happy


Compilation errors


Add some more docs


Few more compilation errors


Changes based on the review


glsl-new parser fix


Set default local size to (0, 0, 0)


final cleanup


Last design


New design
2020-08-31 14:34:38 -04:00
Dzmitry Malyshau
d370686351 proc: support parameter types in Typifier 2020-08-28 19:37:39 -04:00
Dzmitry Malyshau
4797773152 Image IR refactor (#153) 2020-08-26 13:26:51 -04:00
Lachlan Sneff
e9d00d38a4 Make "None" interpolation mean default or nothing, depending on context (#146)
* Make no interpolation mean default or nothing, depending on context

* Re-add Interpolation::Perspective
2020-08-21 00:41:14 -04:00
Lachlan Sneff
8c0b1636ea Interpolation support for wgsl, glsl, glsl-new, spirv (front and back), and glsl-out (#140)
* Add interpolation support to naga core and wgsl

* Add glsl-new fragment shader support to examples/convert.rs

* Add interpolation support to glsl_new

* Add interpolation support to spirv frontend

* Add interpolation support to spirv backend

* Add interpolation support to glsl backend

* Add interpolation support to old glsl backend

* Fix interpolation field syntax in glsl backend

* Formatting fix

* thanks clippy

* Add wgsl struct interpolation decoration

* Change wgsl interpolation syntax

* Modify interpolation enum

* Changes responding to review

* Remove interpolation struct member qualifier

* code changes after review
2020-08-19 20:22:21 -04:00
Kristoffer Søholm
6c062087fa Initial GLSL constant evaluation implementation (#94)
Adds constant evaluation for addition, and uses it for globals and array
specifiers.
2020-07-09 20:52:13 -04:00
Dzmitry Malyshau
39998a4c38 Differenciate between local and external function calls at IR level 2020-07-06 14:10:38 -04:00
Paul Kernfeld
ec52598d61 Deny on panics with clippy 2020-07-06 00:13:51 -04:00