Commit Graph

178 Commits

Author SHA1 Message Date
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
Hajime Hoshi
c01821ca5c internal/shader: use all functions for vector comparisons
Updates #2186
2022-07-09 02:30:16 +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
2d912a2387 internal/shaderir/hlsl: bug fix: wrong offset of uniform array variables
Closes #2038
2022-03-27 01:49:52 +09:00
Hajime Hoshi
d30a31b16c internal/shaderir/hlsl: add function forward declarations 2022-03-26 19:10:03 +09:00
Hajime Hoshi
dcccd27629 internal/shaderir/msl: bug fix: mod for a vector and a scalar didn't work
Updates #2029
2022-03-26 02:57:38 +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
cfd0de5c41 internal/shaderir: make outputs for unexpected operators consistent 2022-03-26 01:40:02 +09:00
Hajime Hoshi
4893b13acc internal/shaderir: add internal/shaderir/hlsl
Updates #1007
2022-03-26 01:31:05 +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
044d41dd2d internal/shaderir: change Op from string to int
This is a preparation to distinguish Hadamard product and matrix
product for HLSL.

Updates #1007
2022-03-13 16:20:04 +09:00