Commit Graph
50 Commits
Author SHA1 Message Date
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
Dzmitry Malyshau 8b56f3ef96 [ir] support function argument names (#270) 2020-11-11 21:34:37 +01:00
Pelle Johnsen 249e0bd4ac [glsl-in] Make sure functions ends with return 2020-11-11 08:01:43 -05:00
Dzmitry Malyshau 41b3865e5b Make variable initializers to be const 2020-11-04 16:38:55 -05:00
Kristoffer Søholm bb5c9567b5 [glsl-in] Add xor, small refactor 2020-11-02 19:34:01 -05:00
Kristoffer Søholm 973cfbc5d3 [glsl-in] Add support for interface blocks 2020-11-02 19:34:01 -05: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
Kristoffer Søholm 4a10aab5f6 [glsl-in] Add iteration statements
while, do-while and for loops
2020-10-30 21:29:53 -04:00
Kristoffer Søholm 3b8b7e28dd [glsl-in] Add selection statements
i.e. if-else and switch-case
2020-10-30 21:29:53 -04:00
Dzmitry Malyshau ce49afa391 Clean up the storage classes (#245) 2020-10-27 09:10:55 -04:00
Dzmitry Malyshau c1830901c7 Simplify bitshift IR (#244) 2020-10-27 09:05:14 -04: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 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
Timo de Kort 4420258001 [ir] Remove Matrix Kind from the IR (#230) 2020-10-06 17:19:29 -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
Dzmitry Malyshau 0651eb8fab Complete expression/statement support in MSL, refactor conversion methods in WGSL, and remove Statement::Empty 2020-09-19 16:16:17 -04:00
Dzmitry Malyshau 14feb9ac01 Validation of global variables and entry points 2020-09-17 16:12:56 -04:00
Pelle Johnsen 1c3f4513de [glsl.in] Implement field lookup 2020-09-17 14:11:09 -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 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
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
Dzmitry Malyshau 33fe3a3dba Struct member origin enum 2020-07-04 11:10:37 -04:00
Dzmitry Malyshau 5d6406b018 Add DepthImage IR type.
Fix all the usage of Bytes type to really mean bytes.
Have logic in the SPIR-V front-end to detect the comparison properties of samplers and images.
2020-07-04 11:10:37 -04:00
Kristoffer Søholm 1f5008f673 Refactor error handling in GLSL frontend 2020-06-30 18:56:58 -04:00
Dzmitry Malyshau e0a1e80fb5 Remove spirv-headers use from IR, make it optional 2020-06-25 00:37:33 -04:00
Dzmitry Malyshau a9228d2aed Add member offsets and array strides 2020-06-19 08:45:04 -04:00
Dzmitry Malyshau e3aea96198 Refactor GLSL parser modules 2020-06-17 09:50:17 -04:00
Dzmitry Malyshau 8e0ae1cf06 Convert glsl module line endings to Unix 2020-06-16 22:54:26 -04:00
Dzmitry Malyshau d55cd79a21 Minor improvements, expose Handle, move glsl module inside the dir. 2020-06-16 22:54:26 -04:00
Dzmitry Malyshau 89d2afa11b Comparison sampler API (#66) 2020-06-16 14:55:40 -04:00
João Capucho b91b9ca987 Glsl frontend (#50)
* Basic glsl support

* Miscellaneous fixes and vertex shader works

* Added rudimentary texture and sampler support

* Basic preprocessor

* Added preprocessor if macros

* Pass tests and handle floats correctly

* Fix preprocessor if wrong precedence ordering when using macros
Refractor for the glsl parser
Partial primary expression parser

* Fix all clippy errors

* Cleanup

* Rollback formatting changes in lib.rs
2020-06-09 13:43:16 -04:00