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
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
93c31654da
graphicscommand: Refactoring
2019-06-25 23:55:33 +09:00
Hajime Hoshi
09d473ea1b
restorable: Add comments
2019-06-25 23:42:18 +09:00
Hajime Hoshi
cddb93b9f6
graphicscommand: Move the texel adjustment logic to graphicscommand package
...
This is a preparation for #879 . The value of the texel adjustment
depends on the graphics driver (GLSL float precisions), and this
can be accessed only after the run loop runs. The place where
graphics commands are executed seems an appropriate place.
Updates #879
2019-06-22 03:52:51 +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
ffb9871839
restorable: Bug fix: Skip the screen image to check invalidation
2019-05-28 11:29:34 +09:00
Hajime Hoshi
24822c0a10
restorable: Rename clear -> clearForInitialization
2019-05-26 23:13:54 +09:00
Hajime Hoshi
b41a333230
restorable: Reland: Refactoring
2019-05-26 22:16:25 +09:00
Hajime Hoshi
83254d30d9
restorable: Bug fix: semantic inconsistency at forceRestoring
2019-05-26 21:40:10 +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
cce41e8152
graphics: Rename DrawImage -> DrawTriangles for consistency
2019-04-22 23:12:36 +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
b1b8d0b4b1
graphics: Move texel-region adjustment from shaders to program
...
This reduces GPU burden.
2019-02-16 14:50:03 +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
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
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
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
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
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