Commit Graph

204 Commits

Author SHA1 Message Date
Hajime Hoshi
2dc6cbe51a shader: Make parseType return a boolean value indicating ok 2020-07-29 12:02:07 +09:00
Hajime Hoshi
d9c54bc0d0 shader: Implement an array variable
Updates #1235
2020-07-29 02:27:05 +09:00
Hajime Hoshi
a43efb66b2 shaderir: Bug fix: Function prototypes were required for GLSL
Fixes #1267
2020-07-28 00:04:03 +09:00
Hajime Hoshi
bb1d08a681 shader: Remove the comments 2020-07-20 11:14:54 +09:00
Hajime Hoshi
1217db3b1e ebiten: Remove user-defined vertex shaders
Fixes #1253
2020-07-20 10:07:55 +09:00
Hajime Hoshi
36e9803cea shader: Enable to get pixels from multiple images
Updates #1193
2020-07-19 02:33:43 +09:00
Hajime Hoshi
4bd3bc16ac shader: Define special variables for textures __t%d
This eanbles to define texture0At to texture3At.

Updates #1193
2020-07-18 19:37:50 +09:00
Hajime Hoshi
385ff8efdf shader: Bug fix: Wrong local variable names at for-loop
Fixes #1245
2020-07-13 22:49:15 +09:00
Hajime Hoshi
0e6f4fccc0 shader: Add break/continue 2020-07-13 02:59:11 +09:00
Hajime Hoshi
c02213e900 shader: Use the loop counters in the test 2020-07-13 01:48:00 +09:00
Hajime Hoshi
2ca551cdc6 shader: Implement 'for' statement
Fixes #1230
2020-07-13 01:44:05 +09:00
Hajime Hoshi
e15ee77e8e shader: Implement operators ++ and -- 2020-07-12 23:07:30 +09:00
Hajime Hoshi
4a8bd688a9 shader: Bug fix: index out of range at defining a var 2020-07-12 18:40:01 +09:00
Hajime Hoshi
dcb693460e shader: Refactoring: Let parseDecl return statements 2020-07-12 15:51:06 +09:00
Hajime Hoshi
914eb093f8 shader: Bug fix: Compile error on the test 2020-07-08 01:38:27 +09:00
Hajime Hoshi
4021c24534 shader: Separate uniform variables and texture variabls
Textures cannot be treated as a regular variable, then they should
be treated differently from other uniform variables.

Add a new function texture0At replacing texture2D.

Updates #1239
2020-07-08 01:12:07 +09:00
Hajime Hoshi
98ae0826c7 shaderir: Bug fix: Early-returns in the entry points didn't work
Fixes #1238
2020-07-05 17:57:57 +09:00
Hajime Hoshi
f4a72165e4 shader: Bug fix: Comparison with constants didn't work 2020-07-05 17:33:10 +09:00
Hajime Hoshi
8369a4cc15 shader: Bug fix: Wrong out-params when returning is in a block 2020-07-05 04:30:14 +09:00
Hajime Hoshi
ce4732a7dc shader: Treat if's 'init' part correctly
Updates #1230
2020-07-05 04:08:57 +09:00
Hajime Hoshi
f3651e23e4 shader: Bug fix: Some oeprators should be evaluated as bool 2020-07-05 03:29:34 +09:00
Hajime Hoshi
fb63df48ae shader: Better error message 2020-07-05 03:23:56 +09:00
Hajime Hoshi
380b7382ac shader: Add 'if'
Updates #1230
2020-07-05 02:33:49 +09:00
Hajime Hoshi
3ca6e41194 shader: Refactoring: Add statements later 2020-07-05 00:33:54 +09:00
Hajime Hoshi
b00666df22 shader: Refactoring: Split files 2020-07-04 23:47:23 +09:00
Hajime Hoshi
49b389c8b1 shader: Add tests for invalid binary expressions 2020-07-04 20:23:37 +09:00
Hajime Hoshi
f362455387 shader: Bug fix: correct type deduction from 'mat2*vec2'
Fixes #1236
2020-07-04 20:08:01 +09:00
Hajime Hoshi
545342262f examples/shader: Show an image 2020-06-24 01:41:27 +09:00
Hajime Hoshi
f10263fff7 shader: Bug fix: Test failures 2020-06-21 22:32:54 +09:00
Hajime Hoshi
c36d2165e6 shader: Parse number literals in unary expressions correctly
Fixes #1190
2020-06-21 21:47:27 +09:00
Hajime Hoshi
29b70bea95 shader: Parse number literals in binary expressions correctly
Updates #1190
2020-06-21 21:32:40 +09:00
Hajime Hoshi
afc39a100c shader: Reduce the calls of parseExpr so that unneeded variables are reduced 2020-06-21 16:39:26 +09:00
Hajime Hoshi
ac9bb92885 shader: Refactoring: Reduce calls of parseExpr at definings 2020-06-21 05:26:23 +09:00
Hajime Hoshi
40e581c19f shader: Allow to mix an int and a float in a binary expression
Updates #1190
2020-06-21 03:34:55 +09:00
Hajime Hoshi
ea9fae1faa shader: Abort parsing correctly when an error is found 2020-06-21 02:18:21 +09:00
Hajime Hoshi
912135d1e7 shaderir: Use constant.Value for number literals
Updates #1190
2020-06-21 01:30:23 +09:00
Hajime Hoshi
4b5de9f445 shaderir: Refactoring: Add OpFromToken 2020-06-20 23:27:54 +09:00
Hajime Hoshi
255da0367f shader: Bug fix: a binary expression for an int and a float did not work 2020-06-20 18:10:23 +09:00
Hajime Hoshi
5e0e12d290 shader: Bug fix: Resolve types in a binary expression correctly 2020-06-20 17:49:23 +09:00
Hajime Hoshi
f36d6c02a9 shader: Refactoring: Remove detectType 2020-06-20 17:20:44 +09:00
Hajime Hoshi
3da0af5de2 shader: Make parseExpr return types
Updates #1190
2020-06-19 03:19:07 +09:00
Hajime Hoshi
2869885816 shaderir: Fix the initial variable values on GLSL
This is for consistency with number literals we are introducing.

Updates #1190
2020-06-17 01:59:02 +09:00
Hajime Hoshi
d04fdbde61 shader: Add more tests 2020-06-11 23:26:32 +09:00
Hajime Hoshi
f39c591252 shader: Enable more Go syntax 2020-06-11 01:13:03 +09:00
Hajime Hoshi
4a60c01f03 shader: Implement assigning 2020-06-10 22:29:45 +09:00
Hajime Hoshi
d0027ebc5f shader: Bug fix: Skip tests on browsers
With wasmbrowsertest, file system is not available.
2020-06-08 12:32:15 +09:00
Hajime Hoshi
91fb8e92d8 shader: Implment defining variables in multiple-value context 2020-06-08 12:15:09 +09:00
Hajime Hoshi
75706504bf shader: Add testdata directory 2020-06-08 11:18:27 +09:00
Hajime Hoshi
acba49952c shaderir: Add a test for nested function calls 2020-06-08 02:19:37 +09:00
Hajime Hoshi
399bb93044 shaderir: Add space lines between functions 2020-06-08 01:41:47 +09:00
Hajime Hoshi
84fb951729 shader: Implement variable initialization in multiple-value context 2020-06-08 01:33:12 +09:00
Hajime Hoshi
1ca5dd16b2 shader: Let parseExpr return multiple values 2020-06-08 01:17:11 +09:00
Hajime Hoshi
bee79e3b67 shader: Refactoring 2020-06-07 23:50:53 +09:00
Hajime Hoshi
2c1e71931e shader: Move some functions 2020-06-07 23:33:47 +09:00
Hajime Hoshi
3fd8062fbe shader: Let detectType return multiple types 2020-06-07 23:32:50 +09:00
Hajime Hoshi
c986da8970 shader: Implement function call 2020-06-07 22:23:20 +09:00
Hajime Hoshi
2ffbd49602 shader: Use shaderir.Type instead of typ struct 2020-06-07 22:06:06 +09:00
Hajime Hoshi
e64c806698 shader: Let parseExpr return statements for Call 2020-06-07 19:24:27 +09:00
Hajime Hoshi
6d779965f9 shader: Fix misspelling 2020-06-07 17:03:40 +09:00
Hajime Hoshi
869a61d9be shader: Parse initial values of variables 2020-06-07 16:25:04 +09:00
Hajime Hoshi
e14cd559b6 shader: Remove variable.init 2020-06-07 05:20:04 +09:00
Hajime Hoshi
147c82f212 shader: Bug fix: Test compile error 2020-06-07 00:52:51 +09:00
Hajime Hoshi
ba36d5a8e9 shader: Reland: Add a predefined uniform variable: __viewportSize 2020-06-07 00:14:09 +09:00
Hajime Hoshi
dde7d00231 shader: Accept an ast directly
This is a preparation to modify the AST before passign to Compile.
2020-06-06 23:12:01 +09:00
Hajime Hoshi
3dbf4c0a83 shader: Enable to specify entrypoint names 2020-06-05 01:11:39 +09:00
Hajime Hoshi
fc44589705 shader: Format 2020-06-03 23:58:05 +09:00
Hajime Hoshi
762b9788a0 shader: Parse fragment entry point 2020-06-03 23:56:08 +09:00
Hajime Hoshi
382ba75139 shader: Enable to put global variables anywhere 2020-06-03 23:19:07 +09:00
Hajime Hoshi
cd3d396975 shader: Implement vertex shader entry point 2020-06-03 01:03:27 +09:00
Hajime Hoshi
3118657fff shaderir: Fix integer literals 2020-06-02 21:45:33 +09:00
Hajime Hoshi
909ba638a3 shader: Add more shadowing tests 2020-06-01 03:24:43 +09:00
Hajime Hoshi
37cc30bc38 shader: Add define (:=) 2020-06-01 02:23:27 +09:00
Hajime Hoshi
6fa7b4bb5a shader: Analyze blocks and shadowings 2020-06-01 00:58:33 +09:00
Hajime Hoshi
5de0493294 shader: Implement multiple out params 2020-05-31 19:20:53 +09:00
Hajime Hoshi
afd114e606 shader: Parse function bodies 2020-05-31 19:03:33 +09:00
Hajime Hoshi
91e5dde320 shader: Parse return 2020-05-31 18:01:12 +09:00
Hajime Hoshi
ddba8a911f shader: Parse function signatures 2020-05-31 16:20:36 +09:00
Hajime Hoshi
5ea5dfccfc shader: Remove stmt 2020-05-31 02:23:51 +09:00
Hajime Hoshi
1ede103ce6 shader: Add tests for uniform variables 2020-05-31 02:06:41 +09:00
Hajime Hoshi
e7323e04bf shader: Remove sorting 2020-05-31 01:47:12 +09:00
Hajime Hoshi
8cb70062b7 shader: Remove dumping and original types 2020-05-31 01:25:24 +09:00
Hajime Hoshi
6d182c4b55 shader: Parse structs 2020-05-11 00:43:17 +09:00
Hajime Hoshi
90fdececa0 shader: Refactoring 2020-05-11 00:00:21 +09:00
Hajime Hoshi
ba9d27b8ba shader: Rename type -> basicType 2020-05-10 23:28:05 +09:00
Hajime Hoshi
02eafb2929 shader: Forbid unexported global variables 2020-05-10 21:57:12 +09:00
Hajime Hoshi
a39376ad47 shader: Add stmtBlock 2020-05-10 21:45:12 +09:00
Hajime Hoshi
73255f4663 shader: Add more tests 2020-05-10 20:41:43 +09:00
Hajime Hoshi
8ede0b3891 shader: Bug fix: fix tests 2020-05-10 19:48:24 +09:00
Hajime Hoshi
b78194afd5 shader: Detect types from rhs 2020-05-10 19:37:09 +09:00
Hajime Hoshi
9430b6be37 shader: Parse assignments 2020-05-10 02:27:14 +09:00
Hajime Hoshi
1a7da0bc63 shader: Do not sort variables since the order matters 2020-05-10 01:21:34 +09:00
Hajime Hoshi
eaf93a532f shader: Unify parsing decls 2020-05-10 01:05:57 +09:00
Hajime Hoshi
4742c49c21 shader: Separate variable and constant 2020-05-10 00:39:26 +09:00
Hajime Hoshi
8b2a22fb47 shader: Parse return 2020-05-10 00:23:40 +09:00
Hajime Hoshi
5e6be91eac shader: Parse block variables 2020-05-09 23:45:53 +09:00
Hajime Hoshi
e848eacedf shader: Parse arguments and returns 2020-05-09 19:21:01 +09:00
Hajime Hoshi
7ba434ad6d shader: Start parsing functions 2020-05-09 18:05:55 +09:00
Hajime Hoshi
1b2c29f6f3 shader: Refactoring 2020-05-09 17:32:10 +09:00
Hajime Hoshi
195c51fe51 shader: Rename test name 2020-05-09 17:19:05 +09:00
Hajime Hoshi
00b32a663e shader: Add token positions to the error message 2020-05-09 16:47:07 +09:00
Hajime Hoshi
c8045210ac shader: Fix comments 2020-05-09 05:13:43 +09:00
Hajime Hoshi
fc0604805a shader: Parse constants 2020-05-09 04:21:45 +09:00
Hajime Hoshi
ffae970c26 shader: Parse uniform and global variables 2020-05-09 03:38:37 +09:00
Hajime Hoshi
b3df3a7864 Add shader package
Updates #482
2020-05-09 01:11:40 +09:00