Commit Graph

3810 Commits

Author SHA1 Message Date
Hajime Hoshi
42833614fb internal/mipmap: bug fix: do not consider filter to determine mipmap level
Now the filter argument is not used (a4e9a05b14),
the filter value can be the nearest filter even though the shader is
for the linear filter.

As long as `canSkipMipmap` is set correctly, we don't have to consider
the parameter `filter`. We should ignore it.

Updates #2364
2022-10-02 18:44:06 +09:00
Hajime Hoshi
4b2a9c3243 internal/testing: add the default exit code 1
This confirms that Update is really called.
2022-10-02 18:16:16 +09:00
Hajime Hoshi
3bb21282af internal/builtinshader: bug fix: typo
Updates #2364
2022-10-02 16:16:49 +09:00
Hajime Hoshi
eea11ba6cb internal/ui: use a Kage shader for Fill
Updates #2364
2022-10-02 16:08:33 +09:00
Hajime Hoshi
7b6f726729 internal/ui: skip uniform variables when possible
Updates #2364
2022-10-02 16:02:44 +09:00
Hajime Hoshi
239f9de2ca internal/ui: use Kage shaders
Updates #2364
2022-10-02 15:54:48 +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
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
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
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
d00bd1cb16 internal/ui: refactoring: move setVerticesCache to ui.Image
Updates #2362
2022-09-29 01:21:46 +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
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
Hajime Hoshi
c7fcfe5bf7 internal/graphicsdriver/directx: refactoring
This makes more explicit that the pixels are sent after the slice
for the pixels finishes modification.
2022-09-19 00:31:44 +09:00
Hajime Hoshi
cfdf59ef8d internal/graphicsdriver/directx: revert changes to remove GetCopyableFootprints
This reverts these commits
* ccddd4ee20
* 8e40c2ce7e
* 2eb1efe3cc

Without GetCopyableFootprints, the test results on 32bit Windows seemed
much more flaky. This didn't fix the memory issue like #2294 anyway.
2022-09-19 00:26:59 +09:00
Hajime Hoshi
ccddd4ee20 internal/graphicsdriver/directx: refactoring: make the lifetime of uploadingStagingBuffer more explicit 2022-09-19 00:16:53 +09:00
Hajime Hoshi
8e40c2ce7e internal/graphicsdriver/directx: refactoring 2022-09-19 00:06:43 +09:00
Hajime Hoshi
2eb1efe3cc internal/graphicsdriver/directx: stop using GetCopyableFootprints
GetCopyableFootprints seems very conservative and returns a quite
big memory size. Instead of using the info from GetCopyableFootprints
let's use our own minimum footprint.
2022-09-18 23:10:15 +09:00
Hajime Hoshi
cd9477491d internal/gamepad: refactoring 2022-09-18 20:09:10 +09:00
Hajime Hoshi
78802f18d9 internal/glfwwin: remove GetProcAddress 2022-09-18 18:04:02 +09:00
Hajime Hoshi
129f201be4 internal/gamepaddb: use go:embed
Updates #1258
2022-09-17 21:02:07 +09:00
TotallyGamerJet
043397c20e
internal/ui: remove Cgo on darwin in ui_glfw_darwin.go (#2329)
Updates #1162
2022-09-16 11:53:46 +09:00
Hajime Hoshi
45b2bd7b2b internal/graphicsdriver/metal/mtl: remove a TODO comment 2022-09-16 11:48:59 +09:00
Hajime Hoshi
53df5aaaf0 internal/cocoa: rename _cmd to cmd 2022-09-16 02:32:12 +09:00