Commit Graph

212 Commits

Author SHA1 Message Date
Hajime Hoshi
b2a1b9a9a2 internal/shader: bug fix: float constant didn't work with assign operators 2022-07-09 22:29:42 +09:00
Hajime Hoshi
c01821ca5c internal/shader: use all functions for vector comparisons
Updates #2186
2022-07-09 02:30:16 +09:00
Hajime Hoshi
6dcd2ff11c internal/shader: bug fix: wrong assignment rule for booleans 2022-07-08 02:19:42 +09:00
Hajime Hoshi
87be157b23 internal/shader: refactoring 2022-07-08 01:09:42 +09:00
Hajime Hoshi
a3590cb258 internal/shader: add type checks to bool/int/flaot
Updates #2184
2022-07-08 00:22:55 +09:00
Hajime Hoshi
faa2ad5c6f internal/shader: add type checks for mat2/mat3/mat4
Updates #2184
2022-07-07 23:05:26 +09:00
Hajime Hoshi
f89277fd85 internal/shader: add type checks to vec2/vec3/vec4
Updates #2184
2022-07-07 00:20:02 +09:00
Hajime Hoshi
5c63c4a4aa internal/graphicsdriver/metal: support macOS 10.12 by removing packed types
From the Metal shading language specification [1] Table 2.2.3, attribute
variables in Ebitengine's vertices don't have to be packed. Then, we can
remove `packed` types.

[1] https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf

Closes #2107
2022-05-28 23:57:59 +09:00
Hajime Hoshi
853d94c3ef internal/shader: implement strict type checks when calling a function
Closes #2032
2022-04-09 00:32:27 +09:00
Hajime Hoshi
15fe7158fd internal/shader: implement strict type checks in assignments
Closes #1972
2022-04-09 00:02:20 +09:00
Hajime Hoshi
aef00a5235 internal/shader: bug fix: wrong type deduction at (scalar)*(matrix)
Updates #2037
2022-03-27 01:22:54 +09:00
Hajime Hoshi
a936ffc032 internal/shader: restrict the number of arguments for atan/atan2 2022-03-26 19:40:04 +09:00
Hajime Hoshi
d30a31b16c internal/shaderir/hlsl: add function forward declarations 2022-03-26 19:10:03 +09:00
Hajime Hoshi
52376170a4 internal/shaderir: bug fix: float4x4(x) initialized all the components unexpectedly
See https://docs.microsoft.com/en-us/windows/win32/direct3d9/casting-and-conversion#parameter-value-modifiers

Updates #1007
2022-03-26 02:05:35 +09:00
Hajime Hoshi
4893b13acc internal/shaderir: add internal/shaderir/hlsl
Updates #1007
2022-03-26 01:31:05 +09:00
Hajime Hoshi
9b1adf799d internal/shader: move syntax tests to internal/shader 2022-03-21 19:31:06 +09:00
Hajime Hoshi
a617576879 internal/shaderir: replace Mul with ComponentWiseMul and MatrixMul
This is a preparation for DirectX / HLSL.

Updates #1007
2022-03-13 19:17:46 +09:00
Hajime Hoshi
6f00221051 internal/shaderir/msl: rename the package name
Updates #2010
2022-03-10 16:25:11 +09:00
Hajime Hoshi
5f97bdc1d3 internal/shader: fix typo
Updates #2011
2022-03-10 02:54:32 +09:00
Hajime Hoshi
5614e9d7eb internal/shader: fix misspellings 2022-03-10 02:52:44 +09:00
Hajime Hoshi
880dd0682e internal/shader: bug fix: fix some failing tests 2022-03-10 02:24:29 +09:00
Hajime Hoshi
d3b72d4ef9 internal/shader: add test files
Updates #2011
2022-03-10 01:02:51 +09:00
Hajime Hoshi
de05ede27e internal/shader: bug fix: evaluate the builtin float/int functions in the pre-compile phase correctly
Closes #2011
2022-03-10 00:47:16 +09:00
Hajime Hoshi
47bfd0db9e internal/shaderir/metal: rename to msl
Closes #2010
2022-03-10 00:14:06 +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
8b8b96c9e7 internal/shader: bug fix: wrong test (int*float) 2022-01-21 01:31:46 +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
0a537b7ad2 internal/shader: bug fix: a number literal must be represented as floats in some contexts 2022-01-17 21:14:07 +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
08ddb4233b internal/shaderir/glsl: bug fix: % was not available on old GLSLs
Use a new utility function modInt instead.

Closes #1951
2022-01-12 01:41:09 +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
8ae6793d4d internal/shader: Check the number of arguments 2021-11-14 17:34:06 +09:00
Hajime Hoshi
9be4ce928b internal/shader: Add more tests for const
Updates #1847
2021-11-14 17:06:54 +09:00
Hajime Hoshi
36ce3b836e internal/shader: Bug fix: Treat a non-typed consntat argument as a float
Closes #1874
2021-11-14 15:47:59 +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
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
77b51e4707 internal/shader: Add more tests and improve the comment
Updates #1192
2021-04-09 01:25:37 +09:00
Hajime Hoshi
1cdc6ea72b internal/shader: Bug fix: Treat multiple constant definitions in one statement correctly
Updates #1192
2021-04-09 01:18:38 +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
59a80cf953 internal/shader: Implement basic constants
Updates #1192
2021-04-09 00:00:49 +09:00
Hajime Hoshi
5f81065d78 internal/shader: Make function duplications error
Closes #1430
2021-02-07 22:24:23 +09:00
Hajime Hoshi
d3fbf377ef shader: Bug fix: A wrong usage of a pointer 2020-12-20 13:32:22 +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