Commit Graph

64 Commits

Author SHA1 Message Date
Hajime Hoshi
31104c4e79 internal/processtest: remove TestShaderNoMain and add shadernomain.go
A shader compilation error breaks the state of the graphics command
queue, and this cannot be reused. Thus, a process test is appropriated.
2022-03-21 21:52:38 +09:00
Hajime Hoshi
81b9f91f86 internal/graphicscommand: compile shaders lazily
With DirectX, the graphics driver cannot be determined until the
main loop starts, as a transparent window cannot be treated with
DirectX so far. On the other hand, compiling shaders requires a
graphics driver as it requires information about Y directions of
NDCs and framebuffers.

This change delays compiling shaders until the graphics commands
are actually executed in the main loop.

Updates #1007
Updates #2019
2022-03-21 21:09:02 +09:00
Hajime Hoshi
9b1adf799d internal/shader: move syntax tests to internal/shader 2022-03-21 19:31:06 +09:00
Hajime Hoshi
3c1e64dd67 internal/shaderir/metal: bug fix: define the 'mod' function correctly
Closes #2006
2022-03-04 18:05:44 +09:00
Hajime Hoshi
84c680c6ed internal/shader: ban the operator div on a matrix
The operator div on a matrix doesn't work on Metal.
2022-01-21 03:37:34 +09:00
Hajime Hoshi
2e5b4954f3 internal/shader: bug fix: forbid mat + float
mat + float doesn't work on Metal.
2022-01-21 02:42:22 +09:00
Hajime Hoshi
99f003a17a internal/shader: bug fix: mat *= vec is not allowed
Updates #1971
2022-01-21 02:03:50 +09:00
Hajime Hoshi
0415773b94 internal/shader: bug fix: allow the *= operator for a vector and a matrix
Updates #1971
2022-01-21 01:59:58 +09:00
Hajime Hoshi
9efabfe56e internal/shader: add more tests
Updates #1971
2022-01-21 01:47:26 +09:00
Hajime Hoshi
8d2bf6525c internal/shader: bug fix: wrong type checkings for operator *
Updates #1971
2022-01-21 01:06:02 +09:00
Hajime Hoshi
406b8a4a08 ebiten: add more tests
Updates #1963
2022-01-17 20:54:02 +09:00
Hajime Hoshi
4940159e5b internal/shader: bug fix: operators between vec/mat and float should work
Closes #1963
2022-01-17 20:52:44 +09:00
Hajime Hoshi
260f7e07df internal/shader: bug fix: deduction checks for the % operator were lacked 2022-01-14 03:51:04 +09:00
Hajime Hoshi
d110716dc0 internal/shader: bug fix: check types correctly for assign operators
Closes #1950
2022-01-12 00:39:39 +09:00
Hajime Hoshi
83bd0772d4 internal/shader: bug fix: % should be valid only for integers
Closes #1947
2022-01-11 23:53:09 +09:00
Hajime Hoshi
374871c031 internal/shader: bug fix: a meaningless statement should raise an error (a non-call expression statement)
Updates #1898
2021-12-27 23:14:05 +09:00
Hajime Hoshi
481a2145ae internal/shader: bug fix: a meaningless statement should raise an error
Closes #1898
2021-12-27 22:05:58 +09:00
Hajime Hoshi
d9c362bca9 ebiten: Add more tests (ShaderUnmatchedArgs) 2021-11-14 18:50:20 +09:00
Hajime Hoshi
8ae6793d4d internal/shader: Check the number of arguments 2021-11-14 17:34:06 +09:00
r3vit
57c45a13e4
Remove dot imports from tests - Remove dot imports (#1837)
Closes #1824
2021-10-02 19:58:48 +09:00
Hajime Hoshi
d5150a194c internal/shaderir/glfw: Insert a dummy function to touch uniform array variables
Closes #1754
2021-08-15 18:06:41 +09:00
Hajime Hoshi
853c1f2b92 internal/shaderir/glsl: Bug fix: Remove uncalled functions
Some built-in functions like dFdx is not available in a vertex shader,
then a function that calls such built-in function should not be in
a vertex shader.

Closes #1701
2021-07-09 20:22:40 +09:00
Hajime Hoshi
3b6fa891ac internal/shader: Bug fix: Error on duplicated const/var names
Updates #1192
2021-04-09 00:12:17 +09:00
Hajime Hoshi
5f81065d78 internal/shader: Make function duplications error
Closes #1430
2021-02-07 22:24:23 +09:00
Hajime Hoshi
b1d7a5f595 shaderir/glsl: Enable dFdx for WebGL
With WebGL1, an extension is required for dFdx. On the other hand,
with WebGL2, GLSL ES 300 is required and the extension is forbidden.
This change fixes shaderir/glsl to switch the output depends on the
WebGL version.

This change also adds a new build tag 'ebitenwebgl1' forcing WebGL 1.

Updates #1404
2020-11-21 19:07:54 +09:00
Hajime Hoshi
c6053bcf14 ebiten: Remove the error returning value from NewImage
Updates #1380
2020-10-06 00:48:56 +09:00
Hajime Hoshi
fe97e7b0a5 ebiten: Remove the filter argument from NewImage and NewImageFromImage
Updates #503
2020-10-05 01:40:44 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
138d9b8e47 shareable: Bug fix: Wrong offset calculation 2020-09-21 01:52:21 +09:00
Hajime Hoshi
b2f6cc5791 ebiten: Revive DrawTrianglesShader
Updates #1325
2020-09-20 18:55:24 +09:00
Hajime Hoshi
938d78122f ebiten: Remove shaders from DrawImage
Updates #1325
2020-09-20 18:14:01 +09:00
Hajime Hoshi
0db7dc22b2 ebiten: Allow SubImage at DrawTriangles 2020-09-20 05:10:08 +09:00
Hajime Hoshi
41564533f9 ebiten: Allow SubImage at DrawRectShader 2020-09-20 04:48:10 +09:00
Hajime Hoshi
7bd8fad738 ebiten: Add TestShaderFillWithDrawTriangles 2020-09-20 00:49:57 +09:00
Hajime Hoshi
9adb01a52c ebiten: Add shader matrix test
Fixes #1345
2020-09-17 21:53:07 +09:00
Hajime Hoshi
ab004031d0 shader: Reland: Bug fix: Checking unused variables defined with var 2020-09-17 17:46:35 +09:00
Hajime Hoshi
ac971f77c5 Revert "shader: Bug fix: Checking unused variables defined with var"
This reverts commit 4d3d3134d5.

Reason: Test failures
2020-09-17 17:32:07 +09:00
Hajime Hoshi
4d3d3134d5 shader: Bug fix: Checking unused variables defined with var 2020-09-17 17:29:37 +09:00
Hajime Hoshi
ded223ead0 shader: Bug fix: selector is not available on a blank identifier 2020-09-14 03:41:25 +09:00
Hajime Hoshi
e1d8629189 shader: Bug fix: a blank identifier lhs and += cannot work 2020-09-14 00:51:27 +09:00
Hajime Hoshi
fd51abfb0d shader: Bug fix ++/-- must not be applied to a blank identifier 2020-09-14 00:32:47 +09:00
Hajime Hoshi
3421598e64 ebiten: Add shader tests 2020-09-14 00:21:40 +09:00
Hajime Hoshi
7666987b09 shader: Bug fix: a blank identifier cannot be used as values 2020-09-13 23:55:25 +09:00
Hajime Hoshi
6114c2b49d ebiten: Add more tests of unused variables in shaders 2020-09-13 22:47:00 +09:00
Hajime Hoshi
154f86e6c1 shader: Check unused local variables
Fixes #1328
2020-09-13 22:36:41 +09:00
Hajime Hoshi
e543d4f107 shader: Bug fix: true/false should be available as a local variable 2020-09-13 20:38:51 +09:00
Hajime Hoshi
a5af597594 shader: Forbid assigning to special variables 2020-09-13 05:19:20 +09:00
Hajime Hoshi
5e15ebf580 ebiten: Set zero values for lacking uniform variables
Fixes #1338
2020-09-13 04:29:32 +09:00
Hajime Hoshi
7a06ae4530 ebiten: Add shader tests 2020-09-12 20:16:03 +09:00
Hajime Hoshi
ed4a7e1856 shader: Forbid init functions
Fixes #1331
2020-09-12 19:50:23 +09:00