Commit Graph

219 Commits

Author SHA1 Message Date
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
Hajime Hoshi
b89602d900 restorable: Add more comments 2019-02-02 19:19:03 +09:00
Hajime Hoshi
05d78b4232 mainthread: Cause panic when trying to run before initialization 2019-02-02 19:00:15 +09:00
Hajime Hoshi
bcd9db669d Revert "restorable: Don't record pixels when restoring is disabled"
This reverts commit aad7bdc64d.

Reason: This causes application freezing at least on macOS
2019-02-02 18:39:51 +09:00
Hajime Hoshi
aad7bdc64d restorable: Don't record pixels when restoring is disabled 2019-02-02 00:44:02 +09:00
Hajime Hoshi
2b0dff197e restorable: Fix comments (#793) 2019-01-22 23:33:56 +09:00
Hajime Hoshi
158f4fb3ed restorable: Bug fix: Reading pixels from a volatile image might fail
Fixes #793
2019-01-22 03:35:54 +09:00
Hajime Hoshi
ec08a75332 restorable: Add assertions 2019-01-21 02:17:09 +09:00
Hajime Hoshi
e2cfb2da6f restorable: Fix comments 2019-01-21 00:41:54 +09:00
Hajime Hoshi
eeb8fea778 restorable: Bug fix: dummyImage must be restored first
Fixes #791
2019-01-21 00:36:53 +09:00
Hajime Hoshi
4d05baf97c examples/contextlost: Bug fix: dummyImage must belong to theImages 2019-01-21 00:11:34 +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
Hajime Hoshi
9e11477d6c restorable: Bug fix: volatile image must be cleared when recovering from the context lost
This fixes the bug that examples/contextlost crashes.
2019-01-13 22:30:08 +09:00
Hajime Hoshi
90efddd6b3 restorable: Bug fix: Clearing a new image region was wrong 2019-01-12 16:16:50 +09:00
Hajime Hoshi
4a587f495d restorable: Bug fix: ReplacePixels might call DrawImage, which violates some assumptions 2019-01-10 23:22:59 +09:00
Hajime Hoshi
b34834a895 graphicscommand: Explicitly forbide ReplacePixels for a part after DrawImage 2019-01-06 05:15:27 +09:00
Hajime Hoshi
1cfd97cde0 restorable: Clearing is not needed after NewImage 2019-01-06 03:40:59 +09:00
Hajime Hoshi
25581b2be8 restorable: Fix comments 2018-12-27 03:12:30 +09:00
Hajime Hoshi
4ba47eee32 restorable: Refactoring 2018-12-27 03:06:44 +09:00
Hajime Hoshi
62cdb93105 restorable: Improve tests 2018-12-26 21:14:29 +09:00
Hajime Hoshi
fbf7007056 restorable: Pixels() should return immediately when it doesn't have to access GPU
Fixes #763
2018-12-26 20:25:40 +09:00
Hajime Hoshi
f1582c2d73 graphics: Add Address representing a sampler address mode
Fixes #761
2018-12-24 17:29:31 +09:00
Hajime Hoshi
ff62876552 Add Metal implementation
Fixes #621
2018-12-20 02:37:10 +09:00
Hajime Hoshi
5d0420cea0 graphicscommand: Simplify Image
First I thought Metal requried an initialization process by
replacing pixels, but now this is not needed. Initialize images by
the dummy texture.
2018-12-16 22:36:03 +09:00
Hajime Hoshi
f85a62c6a7 restorable: Rename dummyImage -> emptyImage 2018-12-01 21:49:41 +01:00
Hajime Hoshi
3f75da5f35 restorable: Refactoring: Remove newImageWithoutInit 2018-12-01 21:36:51 +01:00
Hajime Hoshi
c6dd0a75d9 graphicscommand: Optimize replace-image calls
Now ReplacePixels command is called only when necessary.

This also ensures that DrawImage must be called after ReplacePixels
is called since there is a potential problem that rendering images
on a texture without initializing by replacing pixels might cause
problems (escpecially on Metal. Perhaps #593 might be related).
2018-12-01 21:36:47 +01:00
Hajime Hoshi
247e4f5b6b restorable: Skip initializing the screen image 2018-11-30 00:19:52 +01:00
Hajime Hoshi
962a11468b restorable: Fix clearing logic
Fixes #740
2018-11-28 23:00:24 +01:00
Hajime Hoshi
1f538af440 restorable: Refactoring 2018-11-24 21:08:28 +09:00
Hajime Hoshi
14f5a03a79 Merge math and graphics packages 2018-11-17 20:23:12 +09:00
Hajime Hoshi
bc3ca38f76 opengl: Rename ResetGLState -> Reset and other functions 2018-11-01 03:02:08 +09:00