Commit Graph
997 Commits
Author SHA1 Message Date
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
Timo de Kort e55c6b56e2 Fix SPIR-V back-end, width will now be multiplied by 8 (#108) 2020-07-12 14:22:47 -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
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
Dzmitry Malyshau 28f22810a0 [spv] first steps in control flow graph 2020-07-06 14:10:38 -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
LaughingMan 106cd6d188 WGSL front end: Add basic lexer tests 2020-07-06 00:12:26 -04:00
LaughingMan 1acd12334a WGSL front end: Only accept ASCII chars in identifiers
Previously the lexer would accept any alphanumeric character as part of an
identifier. The spec only allowes identifiers to consist of ASCII alphanumeric
characters though.
2020-07-06 00:12:26 -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
Dzmitry Malyshau 4a769c10b5 [spv] remove the pointer indirection to variables 2020-07-05 09:33:07 -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
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
LaughingMan dff3111485 WGSL front end: Fix panic on invalid input
Until now the WGSL parser would interpret a character index as a byte index.
This could lead to a panic on invalid input strings like "\"\u{2}ПЀ\u{0}\"",
because it would use that index to slice a string without ensuring the slicing
happens on a character boundary.

One possible fix would have been to call `str::find` instead of `position`,
however by relying on `splitn` instead of slicing a str manually it is
easier to convince ourselves that this code can no longer panic.

Fixes https://github.com/gfx-rs/naga/issues/90
2020-07-03 10:01:38 -04:00
Pelle Johnsen aa70703fee Add simple test for glsl-new lexer 2020-07-02 10:06:45 -04:00
Pelle Johnsen 1a9f34ecf2 Handle glsl_new parser errors 2020-07-01 15:20:16 -04:00
Kristoffer Søholm 1f5008f673 Refactor error handling in GLSL frontend 2020-06-30 18:56:58 -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
Gabriel Majeri c2a220840f Document almost everything 2020-06-29 12:25:48 -04:00
Timo de Kort 713fcaaa11 Spirv backend - Extract instructions to own functions 2020-06-27 08:41:33 -04:00
Dzmitry Malyshau e0a1e80fb5 Remove spirv-headers use from IR, make it optional 2020-06-25 00:37:33 -04:00
Dzmitry Malyshau 6eecea5dad First bits of IR validation 2020-06-24 23:17:52 -04:00
Gabriel Majeri 84615eead3 Add support for return value to SPIR-V backend (#79)
* Add test for `glsl_phong_lighting`

* Implement `ReturnValue` op for SPIR-V backend
2020-06-22 16:11:40 +02:00
Timo de Kort 9940460fe6 Add basic tests for SPIR-V back-end writer 2020-06-21 15:11:03 -04:00
Dzmitry Malyshau a9228d2aed Add member offsets and array strides 2020-06-19 08:45:04 -04:00
Timo de Kort 0a781f4ce7 Add Layout Tests
Add Physical Layout test

Add Instruction tests

Add Logical Layout test
2020-06-18 17:19:36 -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
Timo de Kort 82573b288b Implement basic SPIR-V back-end (#46) 2020-06-15 16:01:00 -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
Paul KernfeldandPaul Kernfeld b108a50089 Check constant types (#54)
* Check constant types

A baby step towards #43

* Move tp src/proc/typifier, remove unneeded return

* Don't do pub(crate)

* Don't use crate::proc::UnexpectedConstantTypeError

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2020-05-22 12:30:30 -04:00
Paul Kernfeld 2a3fc6dc54 Replace panics with errors in Metal backend
Fixes #31
2020-05-20 11:18:18 -04:00
Paul Kernfeld e2bd93aa21 Replace write! with TypedGlobalVariable::try_fmt
A step towards #31
2020-05-19 12:48:32 -04:00
Timo de Kort 4b686165c2 Remove duplicate constants in IR module 2020-04-17 17:57:35 -04:00
Timo de Kort 1a1f6a47b0 add support for ConstantComposite 2020-03-28 14:58:45 -04:00
Gabriel Majeri f09f87bb25 Use NonZeroU32 for handle index 2020-03-23 10:31:50 -04:00
Gabriel Majeri 47d7536f35 Format src/arena.rs 2020-03-23 10:31:50 -04:00
Dzmitry Malyshau 3ea6ca428f Move the global usage into the IR function 2020-03-20 16:23:35 -04:00
Dzmitry Malyshau 55fab04353 Refactor the interface processor, many improvements in global variables handling in MSL 2020-03-19 22:36:26 -04:00
Dzmitry Malyshau 80a9254dbe Interface processor 2020-03-19 18:04:58 -04:00
Dzmitry Malyshau df855bc2ff Makefile and RON converter parameters 2020-03-19 09:44:14 -04:00
Dzmitry Malyshau 0de28d1656 [msl] operators, array access, and built-in calls 2020-03-15 23:59:49 -04:00
AIOOB 1ac92cd942 Fixup clippy lints and remove unsafe 2020-03-15 21:09:08 -04:00
Dzmitry Malyshau c467693253 Add quad -> MSL testing 2020-03-15 12:10:19 -04:00