Commit Graph

7843 Commits

Author SHA1 Message Date
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
b0b64e3610 ebiten: use premultiplied-alpha format for ColorScale
Closes #2361
2022-10-02 14:41:50 +09:00
Hajime Hoshi
058b8d5635 ebiten: add ColorScaleFormat to DrawTrianglesOptions
Closes #2365
2022-10-02 14:14:11 +09:00
Hajime Hoshi
5e459bbe42 internal/graphicsdriver/opengl, metal, directx: use premultiplied alpha format for color scales
Updates #2365
2022-10-02 13:38:21 +09:00
Hajime Hoshi
8a7d860632 all: unify Windows error handlings for Windows HANDLE
Updates #2366
2022-10-02 02:22:06 +09:00
Hajime Hoshi
a9ba0db3d1 internal/glfwwin, internal/graphicsdriver/directx: bug fix: wrong error handlings for Windows HANDLE
Closes #2366
2022-10-02 01:57:24 +09:00
Hajime Hoshi
f6c4b29a3d ebiten: add TestImageColorMAndScale 2022-10-02 01:02:29 +09:00
Hajime Hoshi
fb6dffaf12 ebiten: remove a wrong comment 2022-10-02 00:21:35 +09:00
Hajime Hoshi
eb3c45c8af Revert "internal/graphicsdriver/opengl, metal, directx: skip multiplying a scale when a color matrix is used"
This reverts commit b457dc3307.

Reason: a color scale might be used with ColorM (DrawTriangles)
2022-10-02 00:19:41 +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
Hajime Hoshi
b457dc3307 internal/graphicsdriver/opengl, metal, directx: skip multiplying a scale when a color matrix is used 2022-10-01 18:14:22 +09:00
Hajime Hoshi
4203a3b68a internal/graphicsdriver/opengl, metal, directx: add comments
Updates #1212
2022-10-01 15:21:02 +09:00
Hajime Hoshi
a10f3d1dad internal/graphicsdriver/opengl, metal, directx: refactoring: clean up the built-in shaders 2022-10-01 14:35:26 +09:00
Hajime Hoshi
9d06875243 ebiten: remove 'experimental' from the shader APIs
Now the Kage shaders are used for the screen and will be used for ColorM.

Updatse #2046
Updates #2171
2022-09-30 22:45:26 +09:00
Hajime Hoshi
cff64894cc internal/affine: refactoring: use slices instead of array pointers
This doesn't change the performance at the test using ColorM:

```
name           old time/op  new time/op  delta
ColorMScale-8  1.11µs ±43%  1.23µs ±70%   ~     (p=1.000 n=5+5)
```
2022-09-30 22:20:32 +09:00
Hajime Hoshi
1f70307582 ebiten: add DrawRectShaderOptions.ColorScale
This change also introduces a new struct ColorScale.

Closes #2361
2022-09-30 21:44:48 +09:00
Hajime Hoshi
4864814d78 cmd/ebitenmobile: get the gomobile version dynamically
Closes #2356
2022-09-29 02:23:21 +09:00
Hajime Hoshi
d00bd1cb16 internal/ui: refactoring: move setVerticesCache to ui.Image
Updates #2362
2022-09-29 01:21:46 +09:00
Hajime Hoshi
6b23a94ae2 ebiten: bug fix: resolveSetVerticesCacheIfNeeded was not called for the offscreen
Closes #2362
2022-09-28 23:09:09 +09:00
Alexander F. Rødseth
0d2c8b59fc
ebiten: reorder fields as recommended by the fieldalignment utility (#2359)
This reduces the struct size from 64 to 32 bytes.
2022-09-28 18:11:08 +09:00
Hajime Hoshi
ebbf0fbc08 cmd/ebitenmobile: update gomobile 2022-09-28 14:23:48 +09:00
Hajime Hoshi
7f95072fce ebiten: typo 2022-09-28 03:24:36 +09:00
Hajime Hoshi
9492b4ecf5 internal/mipmap: refactoring
This change replaces the member `volatile` with `imageType` to make
the code more explicit.

In the old code, it was not obvious whether a mipmap was used for a
screen image. Actually a mipmap was not used since `canSkipMipmap` is
always true for a screen image, but this was too tricky.
2022-09-28 03:07:40 +09:00
Hajime Hoshi
6b35ad4a88 internal/mipmap: bug fix: mipmap images were unexpectedly volatile
Closes #2354
2022-09-28 01:40:38 +09:00
Hajime Hoshi
3a0f28ce6b internal/ui: refactoring: reduce global-variable usages 2022-09-26 00:46:03 +09:00
Hajime Hoshi
fa108ca717 internal/ui: bug fix: compiie errors on mobiles and browsers 2022-09-26 00:34:44 +09:00
Hajime Hoshi
4a82a109be internal/ui: use sync/atomic for performance 2022-09-26 00:27:04 +09:00
Hajime Hoshi
909f2fe492 internal/ui: bug fix: make inFrame concurrent-safe
Updates #1816
2022-09-25 23:56:14 +09:00
Hajime Hoshi
12f42544dd internal/ui: refactoring: simplify logic by removing setSizeCallbackEnabled
Closes #1816
2022-09-25 23:48:40 +09:00
Hajime Hoshi
70ebd34d99 internal/ui: refactoring: separate setWindowSizeInDIPImpl to setWindowSizeInDIP and setFullscreen 2022-09-25 22:55:56 +09:00
Hajime Hoshi
f0dbf86799 internal/ui: refactoring: adjust the width earlier 2022-09-25 22:34:14 +09:00
Hajime Hoshi
c7deed6e72 internal/ui: add setFullscreen 2022-09-25 22:31:26 +09:00
Hajime Hoshi
e47f9ac38f internal/ui: bug fix: wrong bit operations
Closes #2349
2022-09-25 20:10:37 +09:00
Hajime Hoshi
9302230fef internal/ui: refactoring 2022-09-25 19:56:53 +09:00
Hajime Hoshi
98076bd512 internal/ui: refactoring: simplify initializing fullscreen 2022-09-25 18:28:57 +09:00
Hajime Hoshi
6167cc4f54 internal/ui: remove unnecessary function calls
updateSize was introduced at 7eff5cbd4a, but
apparently calling setWindowSizeInDIP was originally not needed.
2022-09-25 18:19:35 +09:00
Hajime Hoshi
25405783a7 internal/ui: refactoring
Updates #1816
2022-09-25 02:05:26 +09:00
Hajime Hoshi
b2f3d39acf internal/restorable: add color tests at TestAllowWritePixelsForPartAfterDrawTriangles
Updates #2346
2022-09-24 22:09:08 +09:00
Hajime Hoshi
1703297f37 internal/shader: add a test for type shadowing 2022-09-24 19:00:23 +09:00
Hajime Hoshi
7f91a681e3 internal/shader: check type redeclaration 2022-09-24 18:56:01 +09:00
Hajime Hoshi
0c19b8d7ae ebitenutil: typo 2022-09-24 13:53:10 +09:00
Hajime Hoshi
ac651def3b ebiten: typo 2022-09-24 09:37:59 +09:00
Hajime Hoshi
a031389275 .github/workflows/site: update the redirection 2022-09-23 19:30:59 +09:00
Hajime Hoshi
284c9fcc7f update URLs in comments 2022-09-23 19:09:25 +09:00
Hajime Hoshi
d3457e8cf7 update the website from ebiten.org to ebitengine.org 2022-09-23 19:01:11 +09:00
Hajime Hoshi
cda6fa156f examples/flappy: reorder build tags 2022-09-20 23:56:27 +09:00
Hajime Hoshi
c5867c3357 internal/ui: bug fix: avoid 0 as arguments for Layout
Updates #2340
2022-09-20 22:50:39 +09:00
Hajime Hoshi
b5ddee3e4a internal/ui: bug fix: reentering updateImpl caused double unlocking
updateImpl can be invoked in multiple ways. This should have been
protected by a mutex, or this caused unexpected reentrance.

Closes #2339
2022-09-20 13:19:43 +09:00
divVerent
47de8027b9
internal/gamepaddb: fix mapping support for e.g. dpleft:-a0. (#2335)
SDL interprets this as "map -1 to 1, map 0 to -1", so we should do the same.

This fix contains two parts:
* Fix the intended output range.
* Also fix the formula to map a range to a range.
The fix does not change behavior if a "-a" mapping isn't used, as in any other case max-min == 1 or max+min == 0.

Fixes #2334
2022-09-20 00:34:46 +09:00