Commit Graph
45 Commits
Author SHA1 Message Date
João Capucho 7135c051b4 [glsl-in] Support for function parameters with In 2021-04-23 22:15:16 -04:00
João Capucho 2b8b5a271d [glsl-in] Implement textureLod 2021-04-23 22:15:16 -04:00
João Capucho 62e3ba4bcc [glsl-in] Fix type constructor of vec/matrix 2021-04-23 22:15:16 -04:00
João Capucho 6247f2c822 [glsl-in] Load local variables 2021-04-23 22:15:16 -04:00
João Capucho 076349ddf7 [glsl-in] Export types to allow for error handling 2021-04-23 22:15:16 -04:00
João Capucho 19e7f456c4 Remove the call graph processor
Uses the GlobalUse in glsl-out to check for function availability
2021-02-18 11:43:18 -05:00
João Capucho 993521965d Add support for unary ops to glsl 2021-02-06 22:23:09 -05:00
João Capucho 708751a805 Add support for relational functions to glsl-in 2021-02-06 16:57:30 -05:00
João Capucho da8f9ecbb9 Add support for more math functions in glsl-in 2021-02-06 16:57:30 -05:00
João Capucho e0005211a3 Fix the way equality is handled in glsl 2021-02-06 16:04:24 -05:00
João Capucho f9f41fc9bf Add support for more math functions in glsl 2021-02-06 00:41:00 -05:00
João Capucho 2f9c957198 Add support for pow and fix mix arguments 2021-02-06 00:41:00 -05:00
João Capucho ae72fb0933 Add support for component wise comparison to glsl 2021-02-06 00:41:00 -05:00
João Capucho 647dd76dba Moved the ConstantSolver to the glsl frontend 2021-02-06 00:25:30 -05:00
João Capucho 88eee833d7 Add binary op support for the ConstantSolver 2021-02-06 00:25:30 -05:00
João Capucho bb88aac937 Add matrix access to ConstantSolver 2021-02-02 11:17:34 -05:00
João Capucho fcbf2aa4c4 Add support for unary ops to the constant solver
Fix wrong result when casting to bool
Add tests
2021-02-02 11:17:34 -05:00
João Capucho 53bd721895 Add support for casts in constant expressions 2021-02-02 11:17:34 -05:00
João Capucho 68bbf00249 Added support for initalizers and constants 2021-02-02 11:17:34 -05:00
João Capucho c12003f564 Populate ResolveContext with functions
Add support for more math functions
2021-01-31 21:21:51 -05:00
João Capucho daf18642d7 Add support for hexadecimal literals 2021-01-31 21:20:59 -05:00
João Capucho df3759ebff Fix double constant lexing and lex uint constants 2021-01-31 21:20:59 -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
Capucho 3f7ee8cd6e Generate locations with fixed naming scheme for linking 2020-12-22 13:02:22 -05:00
Capucho 181d8721cc [glsl-out] Refractoring
Used thiserror for the error enum
Moved the contents of the error module to the main module
Made the error an actual enum and not just a string
Splitted the write function on the feature manager into a function for
checking for feature availability
2020-11-26 17:04:26 -05:00
Capucho 3fbc801b80 [glsl-out] Wrote more documentation 2020-11-26 17:04:26 -05:00
Capucho 9d5b66934b [glsl-out] Refractoring
Splitted the backend into two more modules (features, errors)
Added a shorthand type for the backend Result
Reorganized function ordering
Moved from using a struct to write image dimension to a function
Started documenting the backend
2020-11-26 17:04:26 -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
João Capucho d45d11e4c5 msl-out: Use io::Write instead of fmt::Write (#250)
* msl-out: Use io::Write instead of fmt::Write

* msl-out: merge std use
2020-10-30 16:51:50 -04:00
João Capucho a718992acb Added new external functions to the glsl backend to make it on par with the typifier (#240) 2020-10-19 09:40:30 -04:00
João Capucho b76dff9d9c Added the new method to the msl Writer (#236) 2020-10-12 11:49:53 -04:00
Capucho 34e46d0a76 Added support for matrix access on the typifier 2020-10-05 16:11:41 -04:00
João Capucho 0aae8ae6f8 glsl-out: More glsl versions (#191)
* Added support for glsl core version up to 400

* Added 330 to the list supported versions

* Added links to all extensions and fixed a extension being wrongfully activated

* Cleanup and check for image formats

* Removed useless extension and location on layout

* Added support for external functions and fixed global names

* Typefier allow Scalars in distance and length

* Addressed comments

* Fixed extension appearing after body

* Fixed entry point not being generated
2020-09-18 17:01:05 -04:00
João Capucho 0129aa2ca6 [glsl-out]: combined image sampler (#177)
* Added generation of the texture mappings to the glsl backend

* Added a temporary workaround for the spirv shaders
Fixed some parts that were using vulkan glsl

* Made texture mapping not require a sampler

* Used interface to build the texture map

* Made global names mandatory except for sampler ones

* Addressed more comments

* Removed the temp fix for the spirv frontend

* Addressed the comments
2020-09-10 14:14:03 -04:00
João Capucho e1e116537e Extended Interface to be used in more places (#183)
* Extended Interface to be used in more places

* Applied comments and added tests

* Removed the statement visitor

* Fixed remaining comments
2020-09-09 17:22:13 -04:00
João Capucho 73204d094c glsl-out: fixes (#164)
* Fixed not generating wrong op on booleans
Correctly handle storage images and sampled images

* Fixed comments
2020-08-27 18:01:19 -04:00
João Capucho 64bb2104cf glsl-out: Less allocations, handle struct member origin and correctly handle empty names (#160)
* Removed half of the clones
Fixed struct field names with invalid ident

* Fix struct member origin not being respected

* is_valid_ident handles empty names
2020-08-27 10:26:55 -04:00
João Capucho f7c5e4873e Made the output of glsl-out more human readable (#154) 2020-08-26 12:29:33 -04:00
João Capucho ac66d149a4 Fixed names beginning with digits and arguments without names (#151) 2020-08-25 15:54:13 -04:00
João Capucho 5d9489871d Add support for glsl es in the glsl backend (#128)
* Initial glsl es 300 support

* Set float default precision

* Generate interface blocks and check storage class in es

* Added more checks on es and fixed uniform blocks with same name type

* Added image checks

* Added the test to the makefile

* applied comments
2020-08-22 10:50:54 -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
João Capucho f94b486d8b Run cargo fmt and enable monocodus (#63) 2020-06-09 14:49:12 -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
João Capucho 706a88e21c Fix clippy errors (#62)
* Move from travis to github actions (#58)

* Added github actions

* Remove travis

* Fixed clippy warnings

* Add the clippy check to ci

* Move workflows to .github

* Fix missing clippy
2020-06-08 16:00:46 -04:00