Hajime Hoshi
73e4423fe7
internal/shader: bug fix: bitwise operators with assignment didn't work
...
Closes #2752
Updates #2754
2023-09-12 03:15:28 +09:00
Hajime Hoshi
c13980158f
internal/shader: add type checks for bitwise operators
...
Updates #2754
2023-09-12 02:40:42 +09:00
Hajime Hoshi
20ddfba983
internal/shader: bug fix: error in assinments to multiple variables
...
Closes #2747
2023-09-04 02:21:45 +09:00
Hajime Hoshi
1bbded8653
internal/shader: bug fix: wrong local variable index was used for assignments
...
Closes #2655
2023-09-04 01:23:03 +09:00
Hajime Hoshi
f82114e8eb
internal/shader: add parseFor
...
Updates #1897
2023-09-03 17:15:39 +09:00
Hajime Hoshi
1269315f75
internal/shader: bug fix: forbid duplicated uniform variables
...
Closes #2648
2023-08-29 00:43:10 +09:00
Hajime Hoshi
2de54c556b
internal/shader: bug fix: wrong for-loop should fail compilation
...
Closes #2680
2023-08-08 23:38:01 +09:00
Hajime Hoshi
6fa8c02d4a
internal/shader: bug fix: div between a matrix and a flaot failed
...
Closes #2719
2023-08-05 02:12:39 +09:00
Hajime Hoshi
d8630f940d
internal/shader: bug fix: forbide comparing non-scalar values
...
Closes #2718
2023-08-01 12:32:16 +09:00
Hajime Hoshi
63df6168d9
internal/shader: use plural forms for Kage compiler directives
...
This change renames
```
//kage:unit texel
//kage:unit pixel
```
to
```
//kage:unit texels
//kage:unit pixels
```
.
Closes #2717
2023-08-01 11:41:38 +09:00
Hajime Hoshi
4df647a400
internal/shader: bug fix: forbid to have an initial value for uniform variables
...
Closes #2711
2023-07-29 20:51:02 +09:00
Hajime Hoshi
5ddf1df423
internal/shaderir: remove ConstType
...
Closes #2550
2023-07-29 15:34:30 +09:00
Hajime Hoshi
7549f4fcd6
internal/shader: reduce ConstType usages
...
Updates #2550
2023-07-29 14:18:32 +09:00
Hajime Hoshi
e225f118fb
internal/shaderir: use ConstType just for an assetion
...
Updates #2550
2023-07-29 14:02:26 +09:00
Hajime Hoshi
900b687f40
internal/shader: add tests
...
Updates #2712
2023-07-28 01:59:31 +09:00
Hajime Hoshi
692d119818
internal/shader: refactoring: reduce ConstType usages
...
Updates #2550
2023-07-28 01:36:15 +09:00
Hajime Hoshi
88be4c5b7c
internal/shader: reland: bug fix: stricter type checks for the built-in cast-like functions
...
Closes #2712
2023-07-28 01:33:27 +09:00
Hajime Hoshi
be2123f7fd
Revert "internal/shader: bug fix: stricter type checks for the built-in functions"
...
This reverts commit 287545b02a
.
Reason: test failures
Updates #2712
2023-07-28 00:54:36 +09:00
Hajime Hoshi
287545b02a
internal/shader: bug fix: stricter type checks for the built-in functions
...
Closes #2712
2023-07-28 00:51:42 +09:00
Hajime Hoshi
ef08873f30
internal/shader: reland2: bug fix: int + ivec failed
...
Closes #2707
2023-07-26 01:23:02 +09:00
Hajime Hoshi
8aefa49510
Revert "internal/shader: reland: bug fix: int + ivec failed"
...
This reverts commit 1c4a0ac0dc
.
Reason: TestShaderUniformMatrix2 failed on Windows
Updates #2707
2023-07-26 00:30:17 +09:00
Hajime Hoshi
1c4a0ac0dc
internal/shader: reland: bug fix: int + ivec failed
...
Closes #2707
2023-07-25 23:02:06 +09:00
Hajime Hoshi
3d8d759976
Revert "internal/shader: bug fix: int + ivec failed"
...
This reverts commit a93908503a
.
Reason: test failures at TestShaderUniformMatrix2
Updates #2070
2023-07-25 22:53:02 +09:00
Hajime Hoshi
a93908503a
internal/shader: bug fix: int + ivec failed
...
Closes #2707
2023-07-25 22:42:06 +09:00
Hajime Hoshi
ad63d0842c
internal/shader: refactoring: check dimensions at AreValidTypesForBinaryOp
2023-07-25 13:46:44 +09:00
Hajime Hoshi
6b94de4ef6
internal/shader: refactoring: integrate type checks to shaderir.AreValidTypesForBinaryOp
2023-07-25 02:51:25 +09:00
Hajime Hoshi
b743b7ab50
internal/shader: bug fix: return true
for float must fail
...
Closes #2706
2023-07-25 02:51:18 +09:00
Hajime Hoshi
29545906c0
internal/shader: refactoring
2023-07-25 01:40:47 +09:00
Hajime Hoshi
c329eab1b2
internal/shader: refactoring
2023-07-24 12:29:27 +09:00
Hajime Hoshi
20123e8420
internal/shader: bug fix: unary operators should keep the type info
...
Closes #2705
2023-07-24 02:21:42 +09:00
Hajime Hoshi
5a1109e56a
internal/shader: refactoring
2023-07-24 02:06:54 +09:00
Hajime Hoshi
0657e67cef
internal/shader: add more tests for % op
2023-07-24 02:00:00 +09:00
Hajime Hoshi
d99da81203
internal/shader: refactoring
2023-07-24 01:49:37 +09:00
Hajime Hoshi
a8c3eb7167
internal/shader: bug fix: don't allow a binary op with different typed constants
...
Closes #2704
2023-07-24 01:41:22 +09:00
Hajime Hoshi
9ffbc51607
internal/shader: remove ConstType usages from canApplyBinaryOp
...
Updates #2550
2023-07-23 14:55:15 +09:00
Hajime Hoshi
94d1df8c7d
internal/shader: simplify canBeFloatImplicitly
...
Updates #2550
2023-07-23 14:06:18 +09:00
Hajime Hoshi
12e60b7273
internal/shader: reduce shaderir.ConstType usages
...
Updates #2550
2023-07-23 13:08:08 +09:00
Hajime Hoshi
a5af8f3b0b
internal/shaderir: remove isUntypedInteger
...
Updates #2550
2023-07-23 13:04:25 +09:00
guangwu
54e1263565
all: unnecessary use of fmt.Sprintf ( #2691 )
...
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-07-05 16:36:29 +09:00
Hajime Hoshi
1035b1d182
internal/shader: bug fix: wrong issue number
...
Updates #2590
Updates #2648
2023-05-09 01:40:33 +09:00
Hajime Hoshi
ad23ae81c1
internal/shader: bug fix: forbide assigning to a uniform variable
...
Closes #2648
2023-05-09 01:38:41 +09:00
Hajime Hoshi
2a1d23d926
internal/shader: bug fix: panic when an assignment mismatch happens
...
Closes #2654
2023-04-26 22:09:25 +09:00
Hajime Hoshi
9d2178cf71
internal/shaderir: rename the built-in func to get a texel to __texelAt
2023-04-23 22:57:30 +09:00
Hajime Hoshi
49582519c1
all: add a compiler directive kage:unit
...
This change adds a new compiler directive 'kage:unit' to Kage. This
takes one of these two values: 'pixel' and 'texel'. The default value
is 'texel'.
With the pixel-unit mode, all the built-in functions treats pixels
instead of texels, and the texCoord argument of Fragment is in pixels.
This simplifies shader programs as programs no longer have the notion
of texels.
With the texel-unit mode, the behavior is the same as the current
behavior.
Closes #1431
2023-04-23 22:11:57 +09:00
Hajime Hoshi
b5ca404c42
internal/shader: bug fix: a swizzling 'r' didn't work for vec2
...
Closes #2652
2023-04-23 21:29:20 +09:00
Hajime Hoshi
00e45affe9
all: update OpenGL version from 2.1 to 3.2
...
'texelFetch' requires OpenGLSL 1.30, which requires OpenGL 3.0+.
macOS might not support OpenGL 3.0 and 3.1, so adopt 3.2.
Updates #1431
2023-04-23 14:25:36 +09:00
Hajime Hoshi
df32901dce
internal/shader: refactoring
2023-04-16 18:37:06 +09:00
Hajime Hoshi
ad7d5a86f9
internal/shader: bug fix: check the type for composite literal
...
Closes #2348
2023-02-20 23:07:11 +09:00
Pierre Curto
4de807cc44
all: fix typos ( #2558 )
...
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Hajime Hoshi
06bc569b73
internal/shader: bug fix: wrongly typed constants were unexpectedly used
...
Closes #2549
2023-01-20 02:26:39 +09:00
Hajime Hoshi
fda0b1cbcb
internal/graphicsdriver/directx: reuse a compiled vertex shader if possible
...
D3DCompile can be a very slow function, and let's skip this if possible.
2022-12-24 17:44:54 +09:00
Hajime Hoshi
88fe3d1287
internal/shaderir: rename TextureNum to TextureCount
2022-12-24 15:55:05 +09:00
Hajime Hoshi
88e5d5e059
Revert "internal/shaderir: refactoring: remove Program.TextureNum"
...
This reverts commit c2bea16776
.
Reason: test compilation errors
2022-12-24 15:53:16 +09:00
Hajime Hoshi
c2bea16776
internal/shaderir: refactoring: remove Program.TextureNum
2022-12-24 15:15:41 +09:00
Hajime Hoshi
f129c23393
all: update URLs in comments
2022-11-21 01:46:50 +09:00
Hajime Hoshi
e9e5d27d2c
internal/shader: bug fix: % operators for integer vecs didn't work
...
Closes #1911
2022-11-21 01:39:20 +09:00
Hajime Hoshi
0b9cbaa1ed
internal/shader: introduce integer vectors (ivec2, ivec3, ivec4)
...
Closes #1911
2022-11-21 00:31:23 +09:00
Hajime Hoshi
5aecd6762c
internal/shader: refactoring
2022-11-20 18:25:08 +09:00
Hajime Hoshi
dc1df824a5
internal/shader: more strict type checks with built-in functions
2022-11-20 17:47:53 +09:00
Hajime Hoshi
5d8216def3
internal/shader: stricter const type check
2022-11-20 15:52:33 +09:00
Hajime Hoshi
5f4e3a0348
internal/shader: add swizzling check
2022-11-19 22:39:17 +09:00
Hajime Hoshi
c4e4e55d75
internal/shaderir: cache reachable uniform variables
...
Updates #2232
2022-11-04 01:28:24 +09:00
Hajime Hoshi
384dee7160
internal/graphicscommand: remove unused uniform variables
...
This improves possibility of merging graphics commands by reducing
uniform variables.
Updates #2232
2022-11-03 22:45:17 +09:00
Hajime Hoshi
1703297f37
internal/shader: add a test for type shadowing
2022-09-24 19:00:23 +09:00
Hajime Hoshi
7f91a681e3
internal/shader: check type redeclaration
2022-09-24 18:56:01 +09:00
Hajime Hoshi
5404e4d68a
all: replace io/ioutil
with io
and os
...
Closes #1770
2022-09-15 02:54:25 +09:00
Hajime Hoshi
c19f45b91c
internal/shader: bug fix: test failures
...
Updates #2304
2022-09-05 02:52:16 +09:00
Hajime Hoshi
4ade34bc02
internal/shaderir: bug fix: wrong argument check on pow
...
Closes #2304
2022-09-05 02:35:48 +09:00
Hajime Hoshi
85d54515cd
internal/shader: check types for && and || correctly
...
Updates #2256
2022-08-19 17:34:03 +09:00
Hajime Hoshi
d6047f3988
internal/shader: add type checks to compare two values
...
Closes #2187
2022-08-19 17:03:29 +09:00
Hajime Hoshi
f63b87f675
internal/shader: refactoring
2022-08-19 15:24:00 +09:00
Hajime Hoshi
590147acda
internal/shader: add type checks for the builtin function texture2D
...
Note that texture2D is usually not called by users.
Closes #2184
2022-08-19 02:27:40 +09:00
Hajime Hoshi
63eee0600e
internal/shader: add type checks for the builtin function transpose
...
Updates #2184
2022-08-19 01:57:24 +09:00
Hajime Hoshi
7a94cbbd62
internal/shader: add refract
...
Closes #2255
2022-08-19 01:48:35 +09:00
Hajime Hoshi
13ae8f5872
internal/shader: add type checks for the builtin function faceforward
...
Updates #2184
2022-08-19 01:48:30 +09:00
Hajime Hoshi
73f12fa704
internal/shader: add type checks for the builtin function smoothstep
...
Updates #2184
2022-08-19 01:27:01 +09:00
Hajime Hoshi
f3ea274d20
internal/shader: add type checks for the builtin function mix
...
Updates #2184
2022-08-19 01:19:20 +09:00
Hajime Hoshi
ec851a85f5
internal/shader: add type checks for the builtin function step
...
Updates #2184
2022-08-19 00:25:04 +09:00
Hajime Hoshi
34cc6405dd
internal/shader: add type checks for the builtin function clamp
...
Updates #2184
2022-08-19 00:14:38 +09:00
Hajime Hoshi
82a9aac689
internal/shader: add type checks for the builtin function cross
...
Updates #2184
2022-08-18 23:45:01 +09:00
Hajime Hoshi
7af6c99954
internal/shader: add type checks for some builtin functions
...
Updates #2184
2022-08-18 23:21:25 +09:00
Hajime Hoshi
fb775d806c
internal/shader: disallow 'discard' in other functions than the fragment entry point
...
Closes #2248
2022-08-17 23:39:52 +09:00
Hajime Hoshi
b211b79a5c
internal/shader: use a return statement in a fragment shader entrypoint
...
Updates #2247
2022-08-17 22:02:13 +09:00
Hajime Hoshi
cf92158e33
ebiten: bug fix: add an indirect function call for a fragment shader
...
Closes #2245
Closes #2247
2022-08-17 16:37:37 +09:00
Hajime Hoshi
205245b094
internal/shader: implement a new built-in function discard
...
Closes #1969
2022-08-09 11:31:59 +09:00
mattn
2bacecca24
fix typos ( #2227 )
2022-08-03 22:40:39 +09:00
Hajime Hoshi
dce34d2306
internal/shader: change the naming convention: Num -> Count
2022-07-13 02:02:48 +09:00
Hajime Hoshi
4afabe34ae
internal/shader: optimization: remove unnecessary local variables
...
Updates #2034
Updates #2188
2022-07-10 19:01:58 +09:00
Hajime Hoshi
b6a340a96f
internal/shader: optimization: use a regular return for a function with one output parameter
...
Updates #2034
Updates #2188
2022-07-10 18:18:46 +09:00
Hajime Hoshi
8c879c7bcf
internal/shader: refactoring
2022-07-10 16:02:50 +09:00
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