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
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
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
0b9cbaa1ed
internal/shader: introduce integer vectors (ivec2, ivec3, ivec4)
...
Closes #1911
2022-11-21 00:31:23 +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
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
205245b094
internal/shader: implement a new built-in function discard
...
Closes #1969
2022-08-09 11:31:59 +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
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
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
185e367295
shader: Implement cap function
...
Fixes #1361
2020-10-17 23:36:09 +09:00
Hajime Hoshi
3c71eba446
shaderir: Bug fix: Implement atan2 for Metal correctly
...
Fixes #1360
2020-09-22 04:29:34 +09:00
Hajime Hoshi
2fb1033183
shader: Initialize output parameters explicitly
2020-09-12 00:35:14 +09:00
Hajime Hoshi
29c7b7687f
shaderir: Add Program.UniformNames
...
Updates #1324
2020-09-06 03:41:17 +09:00
Hajime Hoshi
f5829b2cf3
shader: Check at least one variable on left side of :=
...
Updates #1330
2020-09-03 01:15:41 +09:00
Hajime Hoshi
06ed4f5444
shader: Implement len function
...
Fixes #1279
2020-08-16 02:07:39 +09:00
Hajime Hoshi
f71346da6c
shaderir: Add bool/int/float conversion
...
Updates #1289
2020-08-11 23:04:55 +09:00
Hajime Hoshi
5d2606b6a5
shader: Bug fix: Wrong local variable indices in blocks
2020-08-10 01:09:02 +09:00
Hajime Hoshi
ee9257e626
shaderir: Use pointers for Block
2020-08-09 18:00:55 +09:00
Hajime Hoshi
18b3859e20
shaderir: Export IsValidSwizzling
...
This is a preparation for compiling the IR to Metal.
Updates #1165
2020-08-08 19:08:10 +09:00
Hajime Hoshi
6003d85f75
shaderir: Remove some builtin functions
...
'degrees' and 'radians' are not defined in Metal.
2020-08-05 02:06:28 +09:00
Hajime Hoshi
c22ec580bc
shaderir: Remove bultin functions for bvec
2020-08-05 01:41:06 +09:00
Hajime Hoshi
8bac08cbd9
Add internal/shaderir/glsl
2020-08-03 23:27:27 +09:00
Hajime Hoshi
f95ca46c99
shaderir: Add Stmt.ForVarType and use constant.Value
...
Updates #1230
2020-07-12 22:31:12 +09:00
Hajime Hoshi
291d69500b
shaderir: Add Stmt.ForVarIndex
...
Updates #1230
2020-07-12 21:55:07 +09:00
Hajime Hoshi
202bb34bac
shaderir: Add builtin funcs dfdx, dfdy, fwidth
...
Fixes #1242
2020-07-11 21:50:10 +09:00
Hajime Hoshi
aecd29325e
shaderir: Bug fix: Wrong function names for some bulitin funcs
2020-07-11 21:46:21 +09:00
Hajime Hoshi
776de77744
shaderir: Remove and rename some builtin functions
...
Apparently matrixCompMult and outerProduct are not portable.
We adopted the naming rule foobar instead of fooBar.
2020-07-11 21:43:24 +09:00
Hajime Hoshi
4021c24534
shader: Separate uniform variables and texture variabls
...
Textures cannot be treated as a regular variable, then they should
be treated differently from other uniform variables.
Add a new function texture0At replacing texture2D.
Updates #1239
2020-07-08 01:12:07 +09:00
Hajime Hoshi
912135d1e7
shaderir: Use constant.Value for number literals
...
Updates #1190
2020-06-21 01:30:23 +09:00