Commit Graph

9 Commits

Author SHA1 Message Date
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
a310b7c5bb internal/builtinshader: fix comments 2022-10-10 13:14:37 +09:00
Hajime Hoshi
b489548963 internal/builtinshader: fix comments 2022-10-03 01:09:28 +09:00
Hajime Hoshi
534d82c17d internal/builtinshader: move Filter and Address from internal/graphicsdriver 2022-10-02 23:24:15 +09:00
Hajime Hoshi
ff72898b85 internal/builtinshader: use a struct instead of a map
With a map, we might miss typos.
2022-10-02 20:17:47 +09:00
Hajime Hoshi
3bb21282af internal/builtinshader: bug fix: typo
Updates #2364
2022-10-02 16:16:49 +09:00
Hajime Hoshi
a4e9a05b14 ebiten: reland: use Kage shaders instead of built-in shaders for a color matrix
This replaces the built-in shaders with Kage shadres. This is a
refactoring and doesn't degrade performance:

```
go test -bench=^BenchmarkColorMScale$ -run=^$ . -count=5
```

```
name           old time/op  new time/op  delta
ColorMScale-8   978ns ±15%  1184ns ±46%   ~     (p=0.413 n=4+5)
```

A follow-up change to remove the built-in shaders is needed.

Closes #2364
2022-10-02 15:35:40 +09:00
Hajime Hoshi
520c47f0e8 Revert "ebiten: use Kage shaders instead of built-in shaders for a color matrix"
This reverts commit 7fc79c50c3.

Reason: a color scale might be used with ColorM (DrawTriangles)

Updates #2364
2022-10-02 00:19:37 +09:00
Hajime Hoshi
7fc79c50c3 ebiten: use Kage shaders instead of built-in shaders for a color matrix
Closes #2364
2022-10-02 00:08:14 +09:00