Hajime Hoshi
ea52aa52bb
shareable: Fix tests
2019-09-21 03:58:50 +09:00
Hajime Hoshi
d491cab465
restorable: Remvoe unused arguments
2019-09-21 03:44:45 +09:00
Hajime Hoshi
9e78d8c656
graphicscommand: Bug fix: Fix tests
2019-09-21 03:36:48 +09:00
Hajime Hoshi
6fa7d59468
shareable: Remove lock from (*Image).PutVertex
...
Updates #941
2019-09-21 02:17:14 +09:00
Hajime Hoshi
70a38dc09a
graphicscommand: Move pixel->texel conversion to graphicscommand
2019-09-20 23:59:04 +09:00
Hajime Hoshi
915ed91f25
restorable: Remove (*Image).PutVertices
2019-09-20 23:44:09 +09:00
Hajime Hoshi
93dc9ad589
restorable: Refactoring: Remove (*Image).internalSize()
2019-09-20 01:55:18 +09:00
Hajime Hoshi
e0790ee950
Revert "graphics: Delay draw commands and execute them only when needed"
...
This reverts commit 0c70823f27
.
Reason: Switching apps on Android sometimes broke the screen
2019-09-19 01:18:53 +09:00
Hajime Hoshi
0c70823f27
graphics: Delay draw commands and execute them only when needed
...
This change introduces a queue for delayed graphics commands.
When an image's pixels are retrieved or the screen is rendered,
Ebiten calculates the set of the necessary draw commands and
execute them.
This reduces the number of draw calls especially for the launching
phase.
Fixes #921
2019-09-19 01:09:48 +09:00
Hajime Hoshi
845f2bdeb8
Remove unneeded comments
2019-09-18 10:49:20 +09:00
Hajime Hoshi
439599a145
mobile/ebitenmobileview: Bug fix: ebitenmobile should be ignored on non-mobile platforms
2019-09-18 10:46:35 +09:00
Hajime Hoshi
695c93efd6
event: Add a converting function from driver.Event to event.Event
...
Update #926
2019-09-12 21:59:13 +09:00
Hajime Hoshi
529ab5f191
event: Auto-generate event definitions ( #935 )
...
As event package needs to depend on driver package, and drvier
package needs to emit events, we need event definitions in both
side. This change add a generator for event definitions.
Updates #926
2019-09-12 11:32:20 +09:00
Hajime Hoshi
3fb9c02e2f
graphicsdriver/metal: Bug fix: Use correct pixel format for the screen
2019-09-08 03:52:29 +09:00
Hajime Hoshi
52900fac79
Move back driver getters to ebiten package
2019-09-03 01:46:11 +09:00
Hajime Hoshi
25a2bf3c1f
event: Add Modifier
...
Modifier keys are selected of a common set of GLFW keys [1] and Web
API keys [2].
This change also renames the member Modifiers to Modifer to
follow the convension (e.g., [3]).
Updates #926
[1] https://www.glfw.org/docs/latest/group__mods.html
[2] https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState
[3] https://godoc.org/golang.org/x/tools/go/packages#Config
2019-09-03 01:12:50 +09:00
Hajime Hoshi
05f4ca2a4d
input: Refactoring: nameToJSKeyCodes -> nameToJSKeyCode
2019-09-02 00:30:17 +09:00
Hajime Hoshi
83b2d4b112
input: driver.Key now distinguishes left/right modifier keys
...
This is a preparation for event package, that will have key enum.
Updates #926
2019-09-01 23:49:00 +09:00
Hajime Hoshi
19103dcfeb
graphicscommand: Bug fix: Adjust vertices to avoid jaggy
...
If vertices are (almost) half-integer values, adjust them to avoid
jaggy.
Fixes #929 .
2019-08-27 23:18:08 +09:00
Hajime Hoshi
22c31da6c1
restorable: Bug fix: Do not include emptyImage into the dependency graph
...
Instead, add baseColor to Pixels and use it when restoring.
Fixes #928 .
2019-08-27 08:17:14 +09:00
Hajime Hoshi
76330c492c
shareable: Refactoring
2019-08-26 00:32:30 +09:00
Hajime Hoshi
d2312f1450
shareable: Lock before BeginFrame
...
This make package shareable more consistent. The mutex is lock
after EndFrame and before BeginFrame, and the similar rule will be
applied at launching (BeginFrame unlocks the lock in any cases).
Instead, package ebiten queues image operations if BeginFrame and
doesn't create provisional non-shared images. This should improve
performance at launching since this reduces the number of draw
calls, especifally for creating new images.
Updates #879 .
Updates #921 .
2019-08-25 18:12:04 +09:00
Hajime Hoshi
7907bb43ce
shareable: Refactoring: reduce sync.Once
2019-08-25 17:32:32 +09:00
Hajime Hoshi
b53279b1e1
shareable: Remove InitializeGraphicsDriverState
2019-08-25 17:28:59 +09:00
Hajime Hoshi
3960a4bbdf
restorable: Add (*Image).Fill
...
This resets the infomation for restoring if possible. This makes
it more efficient to use offscreens.
2019-08-25 02:57:44 +09:00
Hajime Hoshi
856e2df1ec
web: Bug fix: compile error on browsers
2019-08-25 02:40:28 +09:00
Hajime Hoshi
b8eeded538
graphics: Remove 'resetRestoringState'
...
This is basically a revert of 2d079b123f
As filling can happen on a part of a shared image, resetting the
restoring state was wrong.
2019-08-25 02:18:51 +09:00
Hajime Hoshi
e931494c66
shareable: Allocate the screen framebuffer image lazily
...
This improves consistency.
2019-08-25 00:43:29 +09:00
Hajime Hoshi
ef56d0a535
Refactoring: isRunning -> isImageAvailable
2019-08-25 00:14:37 +09:00
Hajime Hoshi
42c70e48ff
uidriver/mobile: No need to use sync.Once
...
devicescale.At is already locked by a mutex and keeps values in its
cache.
2019-08-19 02:32:53 +09:00
Hajime Hoshi
2c23860226
uidriver/mobile: Prefer sync.Once to sync.Mutex
2019-08-19 02:25:01 +09:00
Hajime Hoshi
d7aa24c295
uidriver/glfw: Bug fix: Wrong usage of RWLock
2019-08-19 01:47:55 +09:00
Hajime Hoshi
4d0e23c460
uidriver/glfw: Reduce mutex to avoid potential deadlock
2019-08-19 01:01:43 +09:00
Hajime Hoshi
25ac788ee6
uidriver/mobile: Reduce mutex to avoid potential deadlock
2019-08-19 00:32:52 +09:00
Hajime Hoshi
6cd74a9f4d
uidriver/mobile: Simplify updating logic
2019-08-19 00:13:56 +09:00
Hajime Hoshi
ccacc4a0b8
restorable: Refactoring: Make (*Image).Size() available even after disposing
2019-08-16 02:36:27 +09:00
Hajime Hoshi
6ba6cdc721
restorable: Bug fix: Dispose all the image before start restoring
...
A current texture ID and a new texture ID can be duplicated.
Disposing part of textures and creating textures at the same time
can make contradicted situation.
2019-08-16 01:00:09 +09:00
Hajime Hoshi
2cb1ea6fb4
restorable: Remove unnecessary call of clearImage
...
clearImage is already called in any cases.
2019-08-15 22:40:37 +09:00
Hajime Hoshi
0cbf126b80
restorable: Set nil to the image after disposing
...
This prevents a bug that a disposed image is used by clearImage.
2019-08-15 22:35:28 +09:00
Hajime Hoshi
9467a67136
restorable: Bug fix: Skip clearImage on emptyImage when restoring
2019-08-15 21:53:43 +09:00
Hajime Hoshi
01297fe015
graphicsdriver: Fix a panic message
2019-08-15 21:29:37 +09:00
Hajime Hoshi
900af20617
shareable: Misspelling
2019-08-15 12:59:50 +09:00
Hajime Hoshi
f835c8ce7f
uidriver/mobile: Convert a panic to an error for handling
...
This is a dirty hack but there is no other way to handle panics to
report to Crashlytics.
2019-08-13 11:30:50 +09:00
Hajime Hoshi
4373bd8b89
restorable: Unify locks with shareable's backendsM and fix the deadlock
...
This change should make Image operations cuncurrent safe.
Updates #913
Fixes #915
2019-08-13 00:49:47 +09:00
Hajime Hoshi
14ce0c1bcb
restorable: Bug fix: Lock before resolving stale states
2019-08-12 23:31:17 +09:00
Hajime Hoshi
9dd501720e
restorable: Bug fix: Unlocking should happen after restoring
2019-08-12 23:19:03 +09:00
Hajime Hoshi
1f66c155ae
shareable: Bug fix: Lock when backends are allocated
2019-08-12 22:48:48 +09:00
Hajime Hoshi
cbf36734f8
shareable: Bug fix: mutex should not be used at finalizers
...
Updates #913
2019-08-12 21:01:33 +09:00
Hajime Hoshi
28dd2f6e19
shareable: Refactoring: only finalizers have to be cared
...
Only finalizers are problematic since they can stop everything,
but other things are not. Let's care finalizers and just use
regular locks.
Updates #913
2019-08-12 20:17:40 +09:00
Hajime Hoshi
eb5ab57cdc
shareable: Bug fix: Defer Dispose so that ClearPixels doesn't affect other images later
...
Updates #913
2019-08-12 19:37:23 +09:00
Hajime Hoshi
613b9bc02a
restorable: Panic if an image is stale when restoring
2019-08-12 17:45:43 +09:00
Hajime Hoshi
1156dfdc7e
restorable: Lock At operation between frames
...
Updates #913
2019-08-12 16:54:17 +09:00
Hajime Hoshi
d2719188b4
restorable: Do not call resolveDeferred at the end of a frame
...
This does not make sense.
2019-08-12 16:48:04 +09:00
Hajime Hoshi
628a8d559a
restorable: Bug fix: Dispose should be deferred between frames (again)
...
Updates #913
2019-08-12 16:27:07 +09:00
Hajime Hoshi
4717baa840
restorable: Bug fix: Dispose should be deferred between frames
...
Updates #913
2019-08-12 16:26:07 +09:00
Hajime Hoshi
1a2a0aeb76
restorable: Defer operations between the end and the beginning of frames
...
Updates #913
2019-08-12 16:08:21 +09:00
Hajime Hoshi
df8fdc855a
Bug fix: Compile error on GOOS=linux CGO_ENABLED=0
2019-08-01 08:17:58 +09:00
Hajime Hoshi
2003b7d292
Fix misspellings
2019-08-01 01:07:23 +09:00
Hajime Hoshi
de915a1736
Move driver getters to graphicsdriver/uidriver packages
...
This enables to add internal functions to these packages so that
the driver selector logics can be modified.
2019-08-01 00:40:59 +09:00
Hajime Hoshi
4a9a7f936d
Make go vet a little happier on macOS
...
Updates #889
2019-07-22 20:16:22 +09:00
Hajime Hoshi
e6a88a7d1f
uidriver/glfw: Add panic in the case of Windows Remote Desktop
...
Updates #903
2019-07-21 23:41:55 +09:00
Hajime Hoshi
b348223297
restorable: Refactoring
...
Reduces accesses to Image member from outside.
2019-07-21 16:44:00 +09:00
Hajime Hoshi
434802af6e
restorable: Reland: Refactoring
...
This is reland of 7917b423f4be9494125c8de76a8a3def15561594
Fixed a bug that an image passed to Apply might not be initialized,
and there was no correct way to treat such an image. Now Apply
accepts only an initialized image.
2019-07-21 14:18:27 +09:00
Hajime Hoshi
a3b35e5fba
Revert "restorable: Refactoring"
...
This reverts commit 777cab5cc3
.
Reason: Test failures: https://travis-ci.org/hajimehoshi/ebiten/builds/561553656
2019-07-21 14:03:14 +09:00
Hajime Hoshi
777cab5cc3
restorable: Refactoring
2019-07-21 11:05:02 +09:00
Hajime Hoshi
0cf11d9af8
graphicscommand: Improve debug messages
...
This change also enables to dump volatile images.
2019-07-20 14:31:28 +09:00
Hajime Hoshi
2d079b123f
restorable: Add ResetRestoringState to reset the state
...
After Fill command, the image doesn't have to keep the restoring
information. Now Fill command is as same as DrawTriangles, there
is no way for restorable.Image to know whether it can reset the
state or not. ResetRestoringState clears the state explicitly.
2019-07-20 14:04:02 +09:00
Hajime Hoshi
3f6628f1cc
restorable: Replace Fill with Clear
2019-07-20 05:00:05 +09:00
Hajime Hoshi
0dc1d0eba5
graphics: Clear/Fill is now implemented with DrawImage
...
Only clearing the screen still requires the special method.
2019-07-20 04:34:42 +09:00
Hajime Hoshi
0bf12d5519
graphics: Unify dumping logic
2019-07-20 01:46:33 +09:00
Hajime Hoshi
d78db1738d
graphicscommand: Fix comments
2019-07-20 01:22:13 +09:00
Hajime Hoshi
94852b07b2
graphics: Use ID for dumped internal images
...
Updates #900
2019-07-19 23:41:56 +09:00
Hajime Hoshi
0793d35c40
graphicscommand: Improve debug messages
...
Fixes #900
2019-07-19 23:35:13 +09:00
Hajime Hoshi
38a1ee7f57
restorable: Split pixel records into regions
...
Fixes #897
2019-07-19 10:59:48 +09:00
Hajime Hoshi
b4dddd330a
restorable: Refactoring: Use width/height instead of length at Pixels
2019-07-17 23:20:03 +09:00
Hajime Hoshi
efb6f9c453
graphicscommand: Remove CopyPixels command
...
This is an optimization. This change enables to avoid reading
pixels from GPU when extending an image.
Updates #897
2019-07-17 23:19:57 +09:00
Hajime Hoshi
736a840d53
restorable: More restricted Extend
...
As a side effect, ReplacePixels always record pixels even when
restoring is not needed. As CopyPixels reads pixels in any cases,
this shortcut was originally useless.
2019-07-17 22:15:37 +09:00
Hajime Hoshi
353d81fd58
restorable: Rename NewImageFromImage to Extend
2019-07-17 03:32:08 +09:00
Hajime Hoshi
91a4329f0d
restorable: Disallow ReplacePixels for a part after Fill
...
This simplifies Pixels struct. This is a preparation to change
how to record pixels.
Updates #897
2019-07-17 03:15:03 +09:00
Hajime Hoshi
2735f4eddc
restorable: Fix comments
2019-07-17 02:42:26 +09:00
Hajime Hoshi
349a290aa3
restorable: Refactoring
2019-07-16 03:08:26 +09:00
Hajime Hoshi
8ae2fef817
restorable: Refactoring: Do not have to update basePixels in some cases
...
If there is no draw-traiangles command, the image can keep its
basePixels.
2019-07-16 02:48:52 +09:00
Hajime Hoshi
6d20e3f951
restorable: Add assertion at fillImage
2019-07-16 02:18:52 +09:00
Hajime Hoshi
2b632d0707
restorable: Remove Pixels.Slice()
2019-07-16 02:03:15 +09:00
Hajime Hoshi
f3fa535afb
restorable: Refactoring: Disallow nil at ReplacePixels
2019-07-16 01:44:56 +09:00
Hajime Hoshi
84aabd075f
restorable: Use DrawTriangles to restore the image
...
This can avoid allocating a big byte slice.
2019-07-15 05:03:46 +09:00
Hajime Hoshi
7e4e9cc893
restorable: Refactoring
2019-07-15 04:17:52 +09:00
Hajime Hoshi
701c4eeb7c
restorable: Fix comments
2019-07-15 03:24:18 +09:00
Hajime Hoshi
a7e7e007ca
restorable: Bug fix: PutQuadVertices should take the source image
...
Fixes #898
2019-07-15 03:10:03 +09:00
Hajime Hoshi
aee26eec1e
restorable: Refactoring: Replace CopyPixels with NewImageFromImage
2019-07-15 02:04:23 +09:00
Hajime Hoshi
fd9e376ff6
restorable: Add ClearPixels
...
This hides the implementation details of allocating byte slice.
This change also adds comments about #897 .
2019-07-10 02:39:36 +09:00
Hajime Hoshi
5ec2f66524
shareable: Bug fix: Updated maxSize wrongly
...
Updates #892
2019-07-04 01:57:04 +09:00
Hajime Hoshi
3a0dbd3977
graphicsdriver/opengl: Use sync.Once for concurrent safety
2019-07-04 01:15:51 +09:00
Hajime Hoshi
6b7f21f0c8
driver: Add Graphics.MaxImageSize and use it
...
There are some devices that cannot accept 4096x4096 pixels
textures. Get the maximum size and use it.
Fixes #892
2019-07-04 01:10:11 +09:00
Hajime Hoshi
51951d6087
glfw: Take a byte pointer instead of a uintptr at the callback
...
Make 'go vet' happy on Windows.
2019-06-27 22:57:44 +09:00
Hajime Hoshi
9a0cefedce
glfw: Bug fix: Missed to initialize a member of VidMode on Windows
2019-06-27 03:38:14 +09:00
Hajime Hoshi
480c5527a3
ui/mobile: Move 'DoWork' logic to ui/mobile package
...
This simplifies driver.Graphics interface, and will make it easy
to use another graphics driver than OpenGL.
2019-06-27 00:32:37 +09:00
Hajime Hoshi
e499535728
graphics: Move functions to the package ebiten
2019-06-26 22:23:09 +09:00
Hajime Hoshi
ed09406655
graphicscommand: Bug fix: wrong adjustment of texels
...
Fixes #887
2019-06-26 11:45:09 +09:00
Hajime Hoshi
f40798b586
graphics: Move const definitions to driver package
...
Let's keep 'graphics' package as a package for utility functions
or testable functions as much as possible.
2019-06-26 01:05:13 +09:00