Commit Graph

1634 Commits

Author SHA1 Message Date
Hajime Hoshi
b579bd7fd0 graphics: Remove GraphicsContext.Invalidated 2019-04-07 10:08:55 +09:00
Hajime Hoshi
6cdcd1ee62 input: Refactoring: Remove input dependencies from ui 2019-04-06 23:42:55 +09:00
Hajime Hoshi
a980de8326 ui: Take the Input driver 2019-04-06 23:29:13 +09:00
Hajime Hoshi
de9f54fd9d driver: Add Input 2019-04-06 21:48:54 +09:00
Hajime Hoshi
bf165ae9d4 devicescale: Refactoring 2019-04-03 23:20:45 +09:00
Hajime Hoshi
0d0b347411 devicescale: Use more runtime.KeepAlive for Windows 2019-04-03 11:57:00 +09:00
Hajime Hoshi
8005682786 devicescale: Use runtime.KeepAlive for Windows
This might be related to the bug #832
2019-04-03 11:53:23 +09:00
Hajime Hoshi
d56668bfdb input: Use sync.Once 2019-03-31 20:38:46 +09:00
Hajime Hoshi
f5c68d2a61 input: Refactoring 2019-03-31 20:20:52 +09:00
Hajime Hoshi
80dcec865d ui: Refactoring: Remove pollEvents 2019-03-31 19:51:53 +09:00
Hajime Hoshi
c21fb4d390 input: Move Touch to driver package 2019-03-31 18:58:43 +09:00
Hajime Hoshi
e273618081 input: Rename Reset -> ResetForFrame 2019-03-31 18:49:00 +09:00
Hajime Hoshi
9e5261c156 input: Change touches type 2019-03-31 17:15:27 +09:00
Hajime Hoshi
64d3e26fb0 input: Rename UpdateTouches -> SetTouches 2019-03-31 16:30:03 +09:00
Hajime Hoshi
06219db2cc input: Replace Touches with TouchIDs and TouchPosition 2019-03-31 02:59:48 +09:00
Hajime Hoshi
0536efd95f ui: Remove AdjustedCursorPosition 2019-03-31 02:06:42 +09:00
Hajime Hoshi
dec6be1a11 ui: Remove AdjustedTouches 2019-03-31 02:03:59 +09:00
Hajime Hoshi
5d6f66935a ui: Remove UpdateTouches 2019-03-31 01:54:38 +09:00
Hajime Hoshi
43ec1e7fb3 input: Refactoring: Make Touch a struct 2019-03-31 01:14:49 +09:00
Hajime Hoshi
853dbdf19d input: Refactoring 2019-03-31 00:45:52 +09:00
Hajime Hoshi
486a6134e4 Bug fix: compilation error on browsers and mobiles 2019-03-30 23:59:17 +09:00
Hajime Hoshi
7dca1889a1 input: Move Key to driver package 2019-03-30 23:39:56 +09:00
Hajime Hoshi
e5b1aa8742 png: Update for Go 1.12 2019-03-30 23:27:09 +09:00
Hajime Hoshi
c5a8c88e2d input: Move MouseButton and GamepadButton to driver package 2019-03-30 23:19:52 +09:00
Hajime Hoshi
7445144194 Move graphicsdriver.GrapahicsDriver to driver.Graphics 2019-03-30 22:38:02 +09:00
Hajime Hoshi
747d1be54e driver: Move getting actual drivers to ebiten package 2019-03-30 22:19:21 +09:00
Hajime Hoshi
f2e42c3ea1 ui: Remove dependencies on driver package 2019-03-30 21:59:11 +09:00
Hajime Hoshi
d6d57fdadf ui: Refactoring 2019-03-28 03:36:31 +09:00
Hajime Hoshi
8ec7ae4c08 Rename drivers -> driver 2019-03-28 01:48:45 +09:00
Hajime Hoshi
5e38f81462 Create packages drivers having actual drivers 2019-03-25 00:29:56 +09:00
Hajime Hoshi
92193b2362 input: Remove unnecessary empty slices 2019-03-24 23:44:36 +09:00
Hajime Hoshi
dbc3461628 ui: Use flexbox for centering 2019-03-20 01:44:36 +09:00
Hajime Hoshi
1392129e41 devicescale: Cache scale values 2019-03-12 01:31:18 +09:00
Hajime Hoshi
a3882dbc37 ui: Bug fix: devicescale.GetAt must be called on the main thread 2019-03-12 00:28:37 +09:00
Hajime Hoshi
f56c3bd096 ui: Unexport SetWindowResizable (#320) 2019-02-25 02:19:47 +09:00
Hajime Hoshi
ea7c2f8da3 ui: Bug fix: Wrong assumption that the position was always >= 0 2019-02-24 23:34:36 +09:00
Hajime Hoshi
ba59cdbc5f ui: Bug fix: The window must be shown on the current monitor (#829) 2019-02-24 23:26:07 +09:00
Hajime Hoshi
d4a522d9da glfw: Bug fix: Do not pass Go's int pointer
Go's int can be 64bit or 32bit, while C's int is always 32bit on
Windows in Ebiten usage. For C's int argument, do not pass Go's
int pointer or broken values are set.

Related to #829
2019-02-24 23:10:18 +09:00
Hajime Hoshi
288e0a33ba ui: Bug fix: SetSizeCallback must be effective only when the window is resizable
This is not a perfect solution but at least this fixes the
regression.

Fix #819
2019-02-24 03:25:38 +09:00
Hajime Hoshi
f19d7a29b8 graphicsdriver/metal: Do not release a nil texture (screen) 2019-02-22 00:37:49 +09:00
Hajime Hoshi
dbe4f27d5f shareable: Add comments
Oops, 0dcb53d290 did not make sense.
2019-02-21 10:58:40 +09:00
Hajime Hoshi
0dcb53d290 shareable: Bug fix: Node-leak when extending a page
This is very rare and not so serious I think, but is still a bug.
2019-02-21 10:49:23 +09:00
Hajime Hoshi
0bf911905a Revert "graphicsdriver/opengl: Call glFinish before glReadPixels"
This reverts commit 04dc1faa9c.

Reason: True fix for #814 is 82178794c3
2019-02-19 10:55:06 +09:00
Hajime Hoshi
82178794c3 shareable: Bug fix: Unlock after filling
Fixes #820
2019-02-19 10:16:27 +09:00
Hajime Hoshi
ccacf015c2 Revert "restorable: Bug fix: Guard images by mutex"
This reverts commit 7967f68073.

Reason: Wrong fix (syncing should be done at shareable package)
2019-02-19 10:15:23 +09:00
Hajime Hoshi
7967f68073 restorable: Bug fix: Guard images by mutex
The map must be guarded by mutex since this can be accessed by
multiple goroutines, including finalizer goroutine.

Fixes #820
2019-02-19 10:10:46 +09:00
Hajime Hoshi
d724e17032 graphicsdriver/metal: Bug fix: Wrong usage of RenderPipelineState for screen 2019-02-17 21:41:47 +09:00
Hajime Hoshi
84b1c282ff graphicsdriver/opengl: Refactoring by reduing unused variables 2019-02-17 20:22:03 +09:00
Hajime Hoshi
3aa6eb3a66 graphicsdriver: Optimize shaders for the case of FILTER_SCREEN
Assume a color matrix or color vertex values are not used when
the filter is FILTER_SCREEN.
2019-02-17 19:40:52 +09:00
Hajime Hoshi
cbb0a1da95 graphicsdriver: Refactoring
This improved FPS on mobiles a little bit. Maybe now texture2D is
called only when necessary, but not sure.
2019-02-17 17:37:11 +09:00
Hajime Hoshi
742bbb4ccd graphicsdriver: Simplify clamping color values
For negative values, OpenGL (and Metal) should take care of them
so we don't have to care.
2019-02-17 15:09:05 +09:00
Hajime Hoshi
3d8a45a770 graphicsdriver/opengl: Refactoring 2019-02-17 14:30:32 +09:00
Hajime Hoshi
d927241223 graphicsdriver/opengl: Remove unnecessary function calls 2019-02-17 11:44:50 +09:00
Hajime Hoshi
3ecb00f717 graphicsdriver: Optimize shaders
Simplified the case when a color matrix is not used.
2019-02-16 23:53:22 +09:00
Hajime Hoshi
a8b97c9755 graphicsdriver: Optimize shader (skip color matrix calculation)
Skip multiplying with a color matrix when possible.
2019-02-16 17:33:12 +09:00
Hajime Hoshi
815ed8cda2 graphicsdriver: Optimize shader by removing 'if' 2019-02-16 16:39:02 +09:00
Hajime Hoshi
1f46299870 graphicsdriver/opengl: Bug fix: source_size can be optimized out with nearest filter 2019-02-16 15:14:48 +09:00
Hajime Hoshi
b1b8d0b4b1 graphics: Move texel-region adjustment from shaders to program
This reduces GPU burden.
2019-02-16 14:50:03 +09:00
Hajime Hoshi
09ca873c41 graphicsdriver/opengl: Use glBindAttribLocation instead of glGetAttribLocation
Attribute variables are often optimized out and it is really hard
to prevent this.

Instead of implicit indices of attribute variables, use explicit
indices by glBindAttribLocation.

Bug: #816
2019-02-16 14:35:53 +09:00
Hajime Hoshi
7ff99d3965 graphicsdriver/opengl: Remove glGetError calls
As glGetError doesn't tell where the error happens, this is not
useful.

Fixes #815
2019-02-16 10:00:27 +09:00
Hajime Hoshi
fc329bd215 graphicsdriver/metal: Use template specialization 2019-02-15 09:46:58 +09:00
Hajime Hoshi
3f28592700 graphics: Refactoring: Remove PutVertex 2019-02-15 00:22:32 +09:00
Hajime Hoshi
7c506bc5bc restorable: Refactoring: Add (*Image).QuadVertices/PutVertex 2019-02-15 00:18:12 +09:00
Hajime Hoshi
a06a2b65c1 shareable: Fix semantically incorrect function usage
In this case, the size equals to the internal size, so this is not
a bug fix.
2019-02-14 23:23:52 +09:00
Hajime Hoshi
fd250c8d8c graphics: Rename NextPowerOf2Int -> InternalImageSize and add image size adjustment
There is a minimum internal image size on some system like old iOS
devices. This change adds adjustment of the size.

Issue: #810
2019-02-14 23:06:01 +09:00
Hajime Hoshi
a2fe3d5962 restorable: Refactoring: Use InternalSize instead of NextPowerOf2Int 2019-02-14 22:39:19 +09:00
Hajime Hoshi
4e8c7f0a75 restorable: Rename SizePowerOf2 -> InternalSize 2019-02-14 20:56:38 +09:00
Hajime Hoshi
a6d3a1e0cb graphicsdriver/metal: Refactoring: Use NextPowerOf2Int 2019-02-14 11:09:16 +09:00
Hajime Hoshi
a1b1bce43a graphicsdriver/metal: Bug fix: Some tests failed due to wrong source size 2019-02-14 11:06:30 +09:00
Hajime Hoshi
7a76a5b42d graphicsdriver/metal: Remove while loop in shader programs 2019-02-14 10:54:32 +09:00
Hajime Hoshi
5c7f34827f graphicsdriver/metal: Use template specialization 2019-02-14 09:57:47 +09:00
Hajime Hoshi
04dc1faa9c graphicsdriver/opengl: Call glFinish before glReadPixels
It looks like glFlush is not enough at least on Travis CI.

Fixes #814
2019-02-14 02:03:05 +09:00
Hajime Hoshi
0546783ad5 restorable: Don't call (*graphicscommand.Image).Pixels twice (2) 2019-02-14 01:00:27 +09:00
Hajime Hoshi
3faa674e32 restorable: Don't call (*graphicscommand.Image).Pixels twice 2019-02-14 00:54:02 +09:00
Hajime Hoshi
3952474690 graphics/metal: Fix comments 2019-02-13 23:36:45 +09:00
Hajime Hoshi
81101e0f48 graphicsdriver/metal: Reduce 'if' from shader programs (#762) 2019-02-13 23:28:17 +09:00
Hajime Hoshi
27dbf1bbb7 restorable: Record more drawing image history items
Fixes #813
2019-02-13 10:45:08 +09:00
Hajime Hoshi
6930176fbb restorable: Add restorable.Pixels 2019-02-13 00:46:24 +09:00
Hajime Hoshi
93d0b0dd09 restorable: Add Fill
This is useful to reduce opportunity to make the image stale.
2019-02-13 00:46:24 +09:00
Hajime Hoshi
40f728a326 shareable: Call (*restorable.Image).Clear() when possible
This is a kind of relanding of c68c36b0b7.
Clearing the restorable.Image state can reduce the operations for
restoring.
2019-02-13 00:41:26 +09:00
Hajime Hoshi
5fed3d3bed shareable: Add MakeVolatile 2019-02-13 00:41:24 +09:00
Hajime Hoshi
5147bbde9d restorable: Add MakeVolatile 2019-02-13 00:39:54 +09:00
Hajime Hoshi
f613cd1407 restorable: Remove Pixels that is not used anywhere 2019-02-13 00:31:00 +09:00
Hajime Hoshi
c2c3579cde graphicsdriver/opengl: Reduce 'if' in shader programs
Fixes #812
2019-02-12 12:46:18 +09:00
Hajime Hoshi
6c4260d0e1 Revert "graphicsdriver/opengl: Use GL_RGBA8 as the internal format at glTexImage2D"
This reverts commit f5044f3d8f.

Reason: This doesn't work on some iOS machines
2019-02-12 03:34:06 +09:00
Hajime Hoshi
4273f1982d devicescale: Bug fix: Need to consider Y axis direction on macOS
Fixes #807
2019-02-10 23:34:15 +09:00
Hajime Hoshi
8e42484294 graphicscommand: Add 'address' to (*DrawImageCommand).String 2019-02-10 14:27:49 +09:00
Hajime Hoshi
6f428c584d shareable: Add comments 2019-02-10 14:13:00 +09:00
Hajime Hoshi
339155f63d shareable: Use CompositeModeSourceOver when possible at Fill 2019-02-10 14:08:59 +09:00
Hajime Hoshi
1150fc69d0 shareable: Use color vertex values instead of ColorM
This is an optimization: using ColorM might cause graphics command
separation.
2019-02-10 14:02:01 +09:00
Hajime Hoshi
f5044f3d8f graphicsdriver/opengl: Use GL_RGBA8 as the internal format at glTexImage2D
Related: #810
2019-02-09 21:27:46 +09:00
Hajime Hoshi
815f2a6b35 shareable: Improve panic messages 2019-02-09 19:47:45 +09:00
Hajime Hoshi
a5421de8ab mainthread: Add comments 2019-02-08 20:32:00 -10:00
Hajime Hoshi
87b4b8b1b4 mainthread: Disable panic temporarily
Fixes #809
2019-02-08 20:11:48 -10:00
Hajime Hoshi
a3eddeb50f Improve panic messages 2019-02-06 23:43:03 -10:00
Hajime Hoshi
9d291f601e graphicsdriver/metal: Bug fix: Make all the tests pass 2019-02-06 23:42:54 -10:00
Hajime Hoshi
207ae08c9d graphicsdriver/metal: Give up reusing buffers
It was inevitable to rely on reference counts, which was too hacky.
Besides, reusing buffers doesn't improve performance.
2019-02-05 03:22:50 +09:00
Hajime Hoshi
19079ae7a2 graphicsdriver/metal: Fix comments 2019-02-05 03:09:40 +09:00
Hajime Hoshi
f29337dc93 graphicsdriver/metal: Add comments 2019-02-03 23:58:45 +09:00
Hajime Hoshi
882d0c0bc8 graphicsdriver/metal: Reuse MTLBuffer instead of re-creating (#762) 2019-02-03 22:55:29 +09:00