Commit Graph

141 Commits

Author SHA1 Message Date
Hajime Hoshi
900af20617 shareable: Misspelling 2019-08-15 12:59: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
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
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
94852b07b2 graphics: Use ID for dumped internal images
Updates #900
2019-07-19 23:41:56 +09:00
Hajime Hoshi
353d81fd58 restorable: Rename NewImageFromImage to Extend 2019-07-17 03:32:08 +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
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
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
Hajime Hoshi
0cc49b6923 shareable: Refactoring 2019-06-23 11:33:17 +09:00
Hajime Hoshi
7a399c1b82 shareable: Update page sizes dynamically
Also, all the images cannot use the shareable backends before the
game starts, but it is expected that read-only images will use
shareable backends later.

Fixes #879
2019-06-22 23:05:28 +09:00
Hajime Hoshi
f48a72a43e shareable: Refactoring: Remove PutQuadVertices 2019-06-22 21:13:44 +09:00
Hajime Hoshi
5d4f150094 shareable: Add comments about highp
Updates #879
2019-06-22 17:41:19 +09:00
Hajime Hoshi
f3cdb0537b graphics: Move the vertices backend to ebiten package
Now restorable/sharable packages cannot use the same vertices
backend, but I think this won't affect the performance
significantly.
2019-06-22 00:02:22 +09:00
Hajime Hoshi
69ebc481e8 graphics: Refactoring: Unify PutVertex and PutQuadVertices implementation 2019-06-21 23:49:05 +09:00
Hajime Hoshi
008de78cec graphics: Refactoring: Change QuadVertices -> PutQuadVertices for consistency 2019-06-21 02:20:31 +09:00
Hajime Hoshi
b41a333230 restorable: Reland: Refactoring 2019-05-26 22:16:25 +09:00
Hajime Hoshi
da4fabeaa5 Revert "restorable: Refactoring"
This reverts commit 3c0cd47b1f.

Reason: Crash on macOS
2019-05-26 21:30:08 +09:00
Hajime Hoshi
3c0cd47b1f restorable: Refactoring 2019-05-26 21:24:44 +09:00
Hajime Hoshi
fcb5554aa1 driver: Add Graphics.NeedsRestoring 2019-05-26 19:46:12 +09:00
Acid147
21abd85a63 Small cleanup (#877)
* Remove unused variables and constants
* Remove redundant return statement
* Change flock.NewFlock to flock.New
2019-05-26 18:06:43 +09:00
Hajime Hoshi
f461ba2379 shareable: Misspelling 2019-05-12 17:53:18 +09:00
Hajime Hoshi
bc4e35a6c5 shareable: Make images shared when possible
Fixes #864
2019-05-12 00:36:15 +09:00
Hajime Hoshi
cce41e8152 graphics: Rename DrawImage -> DrawTriangles for consistency 2019-04-22 23:12:36 +09:00
Hajime Hoshi
5afcc65387 shareable: Add comments 2019-04-11 18:15:56 -07: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
82178794c3 shareable: Bug fix: Unlock after filling
Fixes #820
2019-02-19 10:16:27 +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
4e8c7f0a75 restorable: Rename SizePowerOf2 -> InternalSize 2019-02-14 20:56:38 +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
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
815f2a6b35 shareable: Improve panic messages 2019-02-09 19:47:45 +09:00
Hajime Hoshi
a3eddeb50f Improve panic messages 2019-02-06 23:43:03 -10:00
Hajime Hoshi
d3d56c076d shareable: Use CopyPixels
CopyPixels is basically Pixels and ReplacePixels, but executed
lazily while Pixels reads pixels from GPU immediately. Thanks to
this, restorable.Image no longer need to keep pixel data if not
needed.
2019-02-03 02:51:56 +09:00
Hajime Hoshi
107dfe5074 graphics: Improve Set speed
On GopherJS, copying a struct is very heavy. This change avoids
copying (color) structs when possible.
2019-01-14 04:25:43 +09:00