Commit Graph

130 Commits

Author SHA1 Message Date
Hajime Hoshi
c46f62e184 all: add a new package shaderprecomp
The current implementation is only for macOS so far.

Updates #2861
2024-05-05 03:51:04 +09:00
Hajime Hoshi
9a7dcb1077 internal/shader: bug fix: failed to return an array in HLSL
Closes #2923
2024-03-10 11:59:50 +09:00
Hajime Hoshi
0e27a8a30b internal/shader: bug fix: spaces around a compiler directive should be allowed
Closes #2771
2023-09-22 01:45:11 +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
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
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
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
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
df32901dce internal/shader: refactoring 2023-04-16 18:37:06 +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
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
5d8216def3 internal/shader: stricter const type check 2022-11-20 15:52:33 +09:00
Hajime Hoshi
7f91a681e3 internal/shader: check type redeclaration 2022-09-24 18:56:01 +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
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
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
15fe7158fd internal/shader: implement strict type checks in assignments
Closes #1972
2022-04-09 00:02:20 +09:00
Hajime Hoshi
5f97bdc1d3 internal/shader: fix typo
Updates #2011
2022-03-10 02:54:32 +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
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
ab004031d0 shader: Reland: Bug fix: Checking unused variables defined with var 2020-09-17 17:46:35 +09:00
Hajime Hoshi
ac971f77c5 Revert "shader: Bug fix: Checking unused variables defined with var"
This reverts commit 4d3d3134d5.

Reason: Test failures
2020-09-17 17:32:07 +09:00
Hajime Hoshi
4d3d3134d5 shader: Bug fix: Checking unused variables defined with var 2020-09-17 17:29:37 +09:00
Hajime Hoshi
154f86e6c1 shader: Check unused local variables
Fixes #1328
2020-09-13 22:36:41 +09:00
Hajime Hoshi
ed4a7e1856 shader: Forbid init functions
Fixes #1331
2020-09-12 19:50:23 +09:00
Hajime Hoshi
2fb1033183 shader: Initialize output parameters explicitly 2020-09-12 00:35:14 +09:00
Hajime Hoshi
0a0401e217 shader: Refactoring: Simplify calculation of LocalVarIndexOffset 2020-09-08 02:42:43 +09:00
Hajime Hoshi
4308bbbc31 shader: Check the existence of 'return' 2020-09-06 22:33:27 +09:00
Hajime Hoshi
29c7b7687f shaderir: Add Program.UniformNames
Updates #1324
2020-09-06 03:41:17 +09:00
Hajime Hoshi
0b1d29b6e7 shader: Bug fix: Returning value's integer literals were wrong 2020-09-03 02:10:52 +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
8c779447db shader: Friendly error messages when local variable names are duplicated
Fixes #1254
2020-08-30 21:22:10 +09:00
Hajime Hoshi
ee049a19ac shader: Bug fix: Wrong local variable index in a block in the fragment entry point 2020-08-10 02:29:49 +09:00
Hajime Hoshi
9b6b306ca3 shader: Bug fix: Wrong local variable index in a block in an entry point 2020-08-10 02:22:09 +09:00
Hajime Hoshi
4d20da9bc0 shader: Refactoring 2020-08-10 02:02:26 +09:00
Hajime Hoshi
5d2606b6a5 shader: Bug fix: Wrong local variable indices in blocks 2020-08-10 01:09:02 +09:00
Hajime Hoshi
240e20ad87 shader: Bug fix: Wrong variable index at declaration 2020-08-09 23:23:40 +09:00
Hajime Hoshi
a0494210c3 shader: Bug fix: Wrong local variable index in a block 2020-08-09 23:14:28 +09:00
Hajime Hoshi
ee9257e626 shaderir: Use pointers for Block 2020-08-09 18:00:55 +09:00
Hajime Hoshi
a4334c5464 shader: Use arrays at uniform variables
Fixes #1274
2020-08-01 17:22:10 +09:00
Hajime Hoshi
2dc6cbe51a shader: Make parseType return a boolean value indicating ok 2020-07-29 12:02:07 +09:00