Hajime Hoshi
daf349ab72
internal/graphicscommand: bug fix: present at the end of the frame explicitly
...
Before this change, presenting happened when the rendering destination
was the final screen. Now this assumption is wrong as the final screen
might be used in the middle of the commands due to DrawFinalScreen.
Instead, this change adds a new argument `present` to FlushCommands to
present the screen explicitly at the end of the frame.
Closes #2386
2022-10-15 01:54:46 +09:00
Hajime Hoshi
f15536e8de
ebiten: refactoring: remove imageDumperGame
...
This enables passing the user's Game to internal/ui without wrapping.
This is necessary to check whether the user's Game implements an
optional function or not.
Updates #2046
2022-10-14 02:58:31 +09:00
Hajime Hoshi
25ae96db89
internal/ui: move screenScaleAndOffsets to the ebiten package
...
Updates #2046
2022-10-14 01:58:07 +09:00
Hajime Hoshi
03621e22c6
internal/ui: remove unnecessary mutex
...
Now (*context).updateFrame and (*context).adjustPosition are not called
in parallel even though the goroutines might be different.
2022-10-14 01:47:52 +09:00
Hajime Hoshi
4bd3a9ef8f
internal/ui: refactoring: move the screen rendering logic to ebiten package
...
Updates #2046
2022-10-14 00:34:40 +09:00
Hajime Hoshi
08e6f5af86
internal/graphicsdriver: remove FramebufferYDirection
2022-10-14 00:05:59 +09:00
Hajime Hoshi
c23af8fa3a
internal/ui: remove unnecessary comments
2022-10-13 12:28:32 +09:00
Hajime Hoshi
30088cf602
internal/ui: refactoring: reduce uniform variable
...
This might degrade performance, but can demonstrate how to get the
scale of the screen.
Updates #2046
2022-10-13 00:59:51 +09:00
Hajime Hoshi
91275e8fc2
internal/ui: add comments
...
Updates #1431
2022-10-12 02:46:08 +09:00
Hajime Hoshi
99e777b0c5
internal/atlas: do not adjust pixels for DrawTriangles(Shader)
...
Adjusting pixels is needed to avoid strainge rendering to avoid unexpected
rendering (#1171 ). However, this adjustment caused unexpected holes
especially in a thick stroke.
This change moves the logic of adjusting pixels from atlas to
graphics.QuadVertices so that adjusting works only for DrawImage and
DrawRectShader.
Updates #1171
Updates #1843
2022-10-11 02:09:20 +09:00
Hajime Hoshi
a310b7c5bb
internal/builtinshader: fix comments
2022-10-10 13:14:37 +09:00
Hajime Hoshi
cb79e4eabe
internal/restorable: improve pixelsForRestore usages
...
Updates #2375
2022-10-06 15:54:54 +09:00
Hajime Hoshi
c6b37e9809
internal/restorable: use pixelsForRestore only when restoring is needed
...
Updates #2375
2022-10-06 15:09:21 +09:00
Hajime Hoshi
34562c3337
internal/restorable: clear pixelsForRestore at Dispose
...
Updates #2375
2022-10-06 15:04:12 +09:00
Hajime Hoshi
e66bac5c3f
internal/restorable: reuse byte slices for restoring
...
Updates #2375
2022-10-06 14:52:20 +09:00
Hajime Hoshi
85d8a5889a
Revert "internal/restorable: reuse bytes instead of allocations"
...
This reverts commit 8cf3c31cf6
.
Reason: This didn't improve the situation.
Updates #2375
2022-10-06 14:11:09 +09:00
Hajime Hoshi
8cf3c31cf6
internal/restorable: reuse bytes instead of allocations
...
Updates #2375
2022-10-06 12:41:47 +09:00
Hajime Hoshi
69cdd2b178
internal/graphicsdriver/metal: refactoring
2022-10-04 00:29:18 +09:00
Hajime Hoshi
b489548963
internal/builtinshader: fix comments
2022-10-03 01:09:28 +09:00
Hajime Hoshi
61cabbf2e7
internal/atlas: optimization
2022-10-03 00:06:50 +09:00
Hajime Hoshi
72983d966b
all: remove unused conditions
...
Now Kage shaders are always used.
The situtation is different from when we fixed for #1355 , so we removed
the fast path for #1335 . We have to re-check the current performance.
Updates #1355
2022-10-02 23:50:48 +09:00
Hajime Hoshi
534d82c17d
internal/builtinshader: move Filter and Address from internal/graphicsdriver
2022-10-02 23:24:15 +09:00
Hajime Hoshi
9c07b20f2b
internal/ui: remove an odd cast
2022-10-02 23:20:16 +09:00
Hajime Hoshi
efd91c8b86
internal/ui: remove unused arguments from DrawTriangles
...
Closes #2369
2022-10-02 23:10:27 +09:00
Hajime Hoshi
d823e22bed
internal/mipmap: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 23:06:32 +09:00
Hajime Hoshi
361a1059ee
internal/buffered: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 23:06:29 +09:00
Hajime Hoshi
3da30b3b78
internal/atlas: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 23:06:27 +09:00
Hajime Hoshi
de8f85651d
internal/restorable: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 22:51:34 +09:00
Hajime Hoshi
0ae2b1bc24
all: remove unnecessary conditions
...
Now a Kage shader is always used.
2022-10-02 22:30:59 +09:00
Hajime Hoshi
6fca8edc1b
internal/graphicscommand: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 22:21:11 +09:00
Hajime Hoshi
080d936d42
internal/graphics: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 22:13:31 +09:00
Hajime Hoshi
6fc9d9316d
internal/graphicscommand: remove unnecessary conditions
...
Now a Kage shader is always used.
2022-10-02 22:11:20 +09:00
Hajime Hoshi
a9574627e8
internal/graphicsdriver/directx: remove the built-in shaders
...
Updates #2369
2022-10-02 21:35:23 +09:00
Hajime Hoshi
033997d928
internal/graphicsdriver/opengl: remove the built-in shaders
...
Updates #2369
2022-10-02 21:26:13 +09:00
Hajime Hoshi
5f7db485f2
internal/graphicsdriver/metal: remove the built-in shaders
...
Updates #2369
2022-10-02 20:34:38 +09:00
Hajime Hoshi
0b45ca7057
ebiten: reduce duplicated shader compilations
2022-10-02 20:33:50 +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
311aa7dcf8
all: use Kage shaders in internal packages
...
Updates #2369
2022-10-02 19:17:09 +09:00
Hajime Hoshi
f293a03ab6
internal/mipmap: reland: do not consider filter to determine mipmap level
...
This is a reland of 42833614fb
.
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 19:14:23 +09:00
Hajime Hoshi
bcb9844395
Revert "internal/mipmap: bug fix: do not consider filter to determine mipmap level"
...
This reverts commit 42833614fb
.
Reason: test failure: TestImageEdge
2022-10-02 18:53:28 +09:00
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
Hajime Hoshi
963eb2756a
all: fix TODO comments
2022-09-16 02:02:02 +09:00
Hajime Hoshi
b13fa2817c
internal/gamepad: clean up codes for Darwin
...
* Removes redundant assignments.
* Fixes types for the Apple libraries.
Updates #1162
2022-09-16 00:25:51 +09:00
TotallyGamerJet
4a569be6f6
internal/gamepad: remove Cgo on darwin ( #2330 )
...
Updates #1162
2022-09-16 00:11:59 +09:00
Hajime Hoshi
5404e4d68a
all: replace io/ioutil
with io
and os
...
Closes #1770
2022-09-15 02:54:25 +09:00
Hajime Hoshi
d0556af8a4
internal/atlas: refactoring
2022-09-15 01:52:05 +09:00
Hajime Hoshi
31945563d8
internal/atlas: optimize adjustDestinationPixel
...
```
go test -bench=BenchmarkAdjustPixel -run=^$ -count=5 ./internal/atlas/
```
```
name old time/op new time/op delta
AdjustPixel-8 2.59ns ± 1% 2.12ns ± 1% -18.16% (p=0.008 n=5+5)
```
2022-09-15 01:50:47 +09:00
Hajime Hoshi
9319266c01
internal/atlas: add a benchmark for adjustDestinationPixel
2022-09-15 01:25:26 +09:00
Hajime Hoshi
2cbc5e7b60
internal/cocoa: remove IsIOS
...
Use `runtime.GOOS == "ios"` instead.
Closes #1415
2022-09-15 01:04:37 +09:00
Hajime Hoshi
619a2ee4dd
internal/gamepaddb: use runtime.GOOS instead of a build tag
...
Updates #1415
2022-09-15 00:27:11 +09:00
Hajime Hoshi
655cd4bf68
all: remove the build tag
...
Updates #1415
2022-09-15 00:23:40 +09:00