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
9f0cdfe9e5
[glsl-in] Multi entry, don't use find on hashmap
2021-02-17 10:05:40 -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
Pelle Johnsen
c04c971907
[glsl-in] Fix StorageClass for texture and sampler
2021-02-11 10:33:21 -05:00
Pelle Johnsen
61d624c82e
[glsl-in] Implement function call ( #354 )
2021-01-13 08:07:43 +01:00
Pelle Johnsen
6710f5954e
Fix clippy issues
2021-01-04 09:51:32 -05:00
Pelle Johnsen
e062096a6a
[spv-out] Handle import id for GLSL.std.450
2021-01-04 09:51:32 -05:00
Pelle Johnsen
6c8cdea936
[glsl-in] Check number of function args
2020-12-23 14:54:53 -05:00
Pelle Johnsen
7d9054f2c1
[glsl-in] Implement more MathFunctions
2020-12-23 14:54:53 -05:00
Pelle Johnsen
9a51d82c39
[glsl-in] Implement ceil
...
Related to #330
2020-12-23 14:54:53 -05:00
Pelle Johnsen
511000d022
[glsl-in] Extract function logic out of parser
2020-12-23 14:54:53 -05:00
Pelle Johnsen
6bb40ce27b
[glsl-in] Cast gl_VertexIndex to SInt ( #332 )
...
* [glsl-in] Cast gl_VertexIndex to SInt
* [glsl-in] Use conversion cast (gl_VertexIndex)
- Also cast gl_InstanceIndex
* [glsl-in] Simplify global var lookup
* [glsl-in] Fix missing comma
2020-12-15 09:24:48 -05:00
Pelle Johnsen
0f98357223
[glsl-in] Skip gl_PerVertex
2020-11-20 09:54:01 +01:00
Pelle Johnsen
437b33d536
[glsl-in] use TypeInner::scalar_kind for casts ( #279 )
...
* [glsl-in] use TypeInner::scalar_kind for casts
* [glsl-in] Use .ok_or for casts
2020-11-16 11:57:34 -05:00
Pelle Johnsen
9041cd4b10
[glsl-in] Handle simple casts
2020-11-16 12:58:19 +01:00
Pelle Johnsen
249e0bd4ac
[glsl-in] Make sure functions ends with return
2020-11-11 08:01:43 -05:00
Pelle Johnsen
6480370a19
[spv-out] Handle ImageSample ( #261 )
2020-11-03 21:18:30 +01:00
Pelle Johnsen
0101ea7319
[glsl-in] Handle assign ops: +=, *=, etc
2020-11-02 10:06:01 -05:00
Pelle Johnsen
602367c062
[glsl-in] Add initial texture handling
2020-11-01 14:52:11 -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
Pelle Johnsen
6fb195cdc8
[clippy] Fix clippy issues after upgrading to 1.47 ( #237 )
...
* [clippy] disable match_like_matches_macro for now
* [wgsl-in] Return error instead of panic
* [typifier] Convert panics to return error
Still one panic in clone impl for Resolution,
disabled clippy for that one
* [spv-in] REturn error instead of panic'ing
* [spv-out] Return error instead of panic'ing
* [typifier] Use IncompatibleOperand(s) error
Instead of just Other
* [typifier] Use Expression for op in Error
For IncompatibleOperands
* [typifier] revert last commit
2020-10-13 17:14:40 -04:00
Pelle Johnsen
2b268c926c
[glsl-in] Extraxt lexer next_line method ( #232 )
...
Have single place where advancing to next line
2020-10-08 13:14:05 -04:00
Pelle Johnsen
773408663b
[glsl-in] make consume_token a lexer method ( #227 )
...
* [glsl-in] make consume_token a lexer method
* [glsl-in] fix lex for 1.41
2020-10-06 10:31:41 -04:00
Pelle Johnsen
842079a3cd
[glsl-in] Handle spacing for preproces directives
2020-10-02 00:50:18 -04:00
Pelle Johnsen
df9834258f
[glsl-in] Implement swizzle for r-values ( #213 )
...
* [glsl-in] Implement swizzle for r-values
Related to #210
* [glsl-in] Just return Result from field_selection
Removed unneccessary Otion in return type
* [glsl-in] Always match on type in field_selection
* [glsl.in] Borrow by value in field_selection
2020-09-25 10:32:50 -04:00
Pelle Johnsen
e5d17e878b
[glsl-in] Support anonymous global uniforms ( #211 )
...
* [glsl-in] Support anonymous global uniforms
Partly fixes #210
* [glsl-in] Handle anon global structs in fn prelude
2020-09-22 11:52:51 -04:00
Pelle Johnsen
8c48ae51ce
[glsl-in] consolidate tests ( #206 )
...
* [glsl-in] consolidate tests
- remove simple lex test as was covered by others
- combine related tests to single function
- remove redundant prefix in test names
* [glsl-in] Consolidtae lex tests further
2020-09-22 11:50:56 -04:00
Pelle Johnsen
1c3f4513de
[glsl.in] Implement field lookup
2020-09-17 14:11:09 -04:00
Pelle Johnsen
bcd3db2dad
[glsl-in] Add unifroms and structs
2020-09-15 12:45:09 -04:00
Pelle Johnsen
094e4fdd17
Fix lexer operator issues (with tests) ( #188 )
...
* Fix lexer operator issues (with tests)
* [glsl-in] Don't convet to string in lexer tests
* [glsl-in] cleanup lexer tests further
- Consolidate use statements
- Iterate lex directly, check for None at end
2020-09-14 01:16:12 -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
0235c4a86c
[glsl-in] Fix unused braces in parser.rs ( #190 )
2020-09-13 00:22:06 -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
Pelle Johnsen
2fa8eb596d
[spv-out] Add initial Rosetta test ( #181 )
...
* [spv-out] Add initial Rosetta test
For now just check that spv-out succeeds
* [spv-out] Check spv output has len > 0
2020-09-10 00:32:02 -04:00
Pelle Johnsen
789d624710
[rosetta] Add explicit return ( #180 )
2020-09-08 01:18:07 -04:00
Pelle Johnsen
43bad8ee50
[glsl-new] Add jump statements ( #179 )
...
* [glsl-new] Add jump statements
- continue
- break
- return
- discard
* [glsl-new] Fix clippy error for return statement
2020-09-07 01:28:13 -04:00
Pelle Johnsen
2cdb54e266
[glsl-new] Update last exprs to ExpressionRule ( #173 )
...
* [glsl-new] Update last exprs to ExpressionRule
Refactor out binary_expr to keep parser.rs 'small' and readable
* [glsl-new] Change binary_expr to method on Program
* [glsl-new] Make binary_expr a proper method
2020-09-02 01:34:39 -04:00
Pelle Johnsen
f97c62b0e6
[glsl-new] Add bool consts, update logical exprs ( #171 )
2020-09-01 00:52:07 -04:00
Pelle Johnsen
c824287fd5
[glsl-new] Refactor type handling ( #166 )
...
* [glsl-new] Refactor type handling
* [glsl-new] Fix clippy error
2020-08-28 12:09:57 -04:00
Pelle Johnsen
e41dc6958c
Make CI test on multiple rust versions ( #159 )
...
Use 1.41.0 and nightly
2020-08-27 10:30:04 -04:00
Pelle Johnsen
6a3af2fe87
Add dependency on serialize for Rosetta tests ( #150 )
...
* Add dependency on serialize for Rosetta tests
Fixes #149
* Also run default cargo test on CI
2020-08-25 13:51:27 -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
Pelle Johnsen
cf39a88f21
[glsl-new] match wgsl expression order ( #147 )
2020-08-21 10:13:36 -04:00
Pelle Johnsen
b0f1f6285a
[glsl-new] set global_usgae on functions ( #138 )
2020-08-19 14:06:24 -04:00
Pelle Johnsen
c5a302b769
[glsl-new] Use Empty statement ( #139 )
2020-08-19 14:05:24 -04:00
Pelle Johnsen
34cf97cb91
[glsl-new] disable constant expression ( #131 )
2020-08-17 09:37:11 -04:00
Pelle Johnsen
7902bd54a8
[glsl-new] Fix expression ordering for compose ( #130 )
2020-08-16 09:38:07 -04:00
Pelle Johnsen
7f780e8efc
[glsl-new] put validation errors behind featureUsing glsl-validate feature ( #127 )
2020-08-13 16:27:12 -04:00
Pelle Johnsen
b4e1775b9e
[glsl-new] Handle local vars scopes ( #126 )
...
* [glsl-new] Handle local vars scopes
* [glsl-new] scope fixes
- Check loacl vars before globals
- Rename add_scope > push_scope
- Remove unnecessary ref in lookup functions
2020-08-13 15:36:51 -04:00
Pelle Johnsen
b96b7449db
[gls-new] handle local vars
2020-08-10 10:57:31 -04:00
Pelle Johnsen
41c1c713dc
[glsl-new] handle global vars in external_decl
2020-08-10 10:57:31 -04:00
Pelle Johnsen
ede04ba4dc
[glsl-new] Simplify declaration code
...
- Fix clippy issues
2020-08-09 10:57:41 -04:00
Pelle Johnsen
482c6d042d
[glsl.new] Add initial declaration support
...
Focus on handling global in/out vars
2020-08-09 10:57:41 -04:00
Pelle Johnsen
f98054afdd
[glsl-new] add vec2 and vec3
2020-08-09 10:57:41 -04:00
Pelle Johnsen
745ef6a6d6
[glsl-new] Add float consts ( #119 )
2020-08-05 09:45:42 -04:00
Pelle Johnsen
747535906f
[glsl-new] Add ExpressionRule for expr/stmts ( #118 )
...
- Initial work for handling expressions that also generates statements
2020-08-04 15:45:55 -04:00
Pelle Johnsen
1eb637038d
[glsl-new] Add initial handling of stmts and exprs ( #116 )
...
* [glsl-new] Add initial handling of stmts and exprs
* [glsl-new] use &'static str for NotImplemented msg
* [glsl-new] Don't lazy create function context
2020-07-28 22:48:05 -04:00
Pelle Johnsen
3884921f4e
[glsl-new] handle gl_Position builtin ( #114 )
...
* [glsl-new] handle gl_Position builtin
- Also fix width of vec4 type
* [glsl-new] add shader stage as arg to program ctor
2020-07-23 11:52:10 -04:00
Pelle Johnsen
41ca3834f5
[glsl-new] store int constants in module ( #111 )
2020-07-20 10:56:10 -04:00
Pelle Johnsen
d26f754853
Add more glsl-new handling of funcs and types ( #110 )
2020-07-14 08:56:18 -04:00
Pelle Johnsen
244c587457
Glsl new handle version ( #109 )
...
* Fix TokenMetadata for #version
* Add glsl-new #version parsing
* Fix clippy issues
* glsl-new only core profile, allow 440-460
* Cleanup glsl-new profile matching
2020-07-13 13:40:12 -04:00
Pelle Johnsen
c9fea37430
Add inital ast for glsl-new ( #107 )
...
* Add inital ast for glsl-new
* Fix clippy for glsl-new
Deref instead of cloning
2020-07-08 08:46:31 -04:00
Pelle Johnsen
cf62dc3d8c
Glsl new multi line comments ( #103 )
...
* Add multi line comment support to glsl-new
* Fix glsl-new TokenMetadata for multi line comments
2020-07-05 09:35:20 -04:00
Pelle Johnsen
2ffbeba8c6
Fix illegal chars in identifier for glsl-new
2020-07-04 10:58:29 -04:00
Pelle Johnsen
8759572530
Add glsl-new lexer line comment support
...
- Includes test
2020-07-03 10:05:12 -04:00
Pelle Johnsen
aa70703fee
Add simple test for glsl-new lexer
2020-07-02 10:06:45 -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
Pelle Johnsen
1a9f34ecf2
Handle glsl_new parser errors
2020-07-01 15:20:16 -04:00
Pelle Johnsen
6f0f551bac
New GLSL frontend using pomelo ( #87 )
...
* Add initial pomelo glsl work
* Fix ref to glsl_old
* Fix idents with numbers in lexer
* Use glsl_new for .vert in convert example
Controlled by PREFER_GLSL_NEW=1 env var
Also add simple test files
* Start making parser look like spec
* Port 'old' lex.rs to glsl_new
* Apply fixes after rebasing
* Fix clippy issue
* Fix PR comments
- Make into optional feature glsl-new
- Minor code style improvements
2020-06-30 10:42:50 -04:00
Pelle Johnsen
ba0798e5d1
Add glsl handling to convert sample ( #69 )
...
* Add glsl handling to convert sample
- Also fis extension check for spv and wgsl (missing .)
* Use std::path::Path for ext handling
* Also fix ext for .comp
Missing from last commit
2020-06-17 09:34:35 -04:00