Commit Graph

188 Commits

Author SHA1 Message Date
Hajime Hoshi
4f2327536c internal/shaderir: improve FilterUniformVariables
```
name      old time/op  new time/op  delta
Filter-8  31.7ns ± 1%  29.9ns ± 1%  -5.60%  (p=0.000 n=9+10)
```

Updates #2601
2023-08-20 03:21:46 +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
5ddf1df423 internal/shaderir: remove ConstType
Closes #2550
2023-07-29 15:34:30 +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
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
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
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
5a1109e56a internal/shader: refactoring 2023-07-24 02:06:54 +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
befe990562 internal/shaderir: refactoring 2023-05-05 14:24:48 +09:00
Hajime Hoshi
ceb2bfc89c internal/shaderir: refactoring: use the append pattern 2023-05-04 14:34:22 +09:00
Hajime Hoshi
e4c9d6705c internal/shaderir: refactoring 2023-05-04 14:26:08 +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
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
7509c1d7f5 internal/graphicsdriver/opengl: remove the version es100
es300 is requried for 'texelFetch' [1].

[1] https://registry.khronos.org/OpenGL-Refpages/es3.0/html/texelFetch.xhtml

Updates #1431
2023-04-19 22:10:32 +09:00
Hajime Hoshi
df32901dce internal/shader: refactoring 2023-04-16 18:37:06 +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
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
0d173834a6 all: speed optimization 2022-12-03 23:09:41 +09:00
Hajime Hoshi
0a6813c17f internal/graphics: use flatten []float32 slice instead of [][]float32
Closes #2479
2022-12-03 20:23:58 +09:00
Hajime Hoshi
724516a0e0 internal/shaderir: add comments 2022-12-03 15:37:14 +09:00
Hajime Hoshi
ae715ba33b internal/shaderir: performance improvement by using a slice instead of a map 2022-12-03 01:10:29 +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
1ecac8d834 all: allow integer uniform variables for Kage shaders
Closes #2305
Updates #2448
2022-11-13 01:49:24 +09:00
Hajime Hoshi
419bb4c1e9 all: use uint32 instead of float32 for uniform values
This is a preparation for other types of uniform values.

Updates #2305
2022-11-12 20:28:07 +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
0762db3b3e internal/shaderir: refactoring 2022-11-03 18:16:54 +09:00
Hajime Hoshi
7dbb078a9e internal/shaderir: refactoring 2022-11-03 17:44:11 +09:00
Hajime Hoshi
e2c25dbc6d internal/shaderir: rename functions 2022-11-03 17:14:49 +09:00
Hajime Hoshi
b28b323920 internal/shaderir: use parentheses for vector equal operators 2022-08-21 04:19:56 +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
7a94cbbd62 internal/shader: add refract
Closes #2255
2022-08-19 01:48:35 +09:00
Hajime Hoshi
3aad4fada1 internal/shaderir: add comments
Updates #2253
2022-08-18 17:46:53 +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
bf4648eb35 internal/shaderir: fix a wrong comment 2022-08-17 17:43:59 +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
Hajime Hoshi
16ff5c5039 internal/shaderir: change the naming convention: Num -> Count 2022-07-13 02:02:48 +09:00
Hajime Hoshi
a5179b9491 internal/shaderir/glsl: bug fix: test failures with OpenGL
Updates #2186
2022-07-09 02:43:48 +09:00