Commit Graph

201 Commits

Author SHA1 Message Date
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
Hajime Hoshi
b2b09ccec0 restorable: Avoid memory allocating when an entire image is cleared 2018-10-30 11:08:38 +09:00
Hajime Hoshi
ce1c616f69 Merge graphics and graphicsutil 2018-10-28 23:03:06 +09:00
Hajime Hoshi
ff54d3b681 Move CompositeMode to graphics package 2018-10-28 21:49:47 +09:00
Hajime Hoshi
06f2052817 Add graphics package and move Filter to graphics 2018-10-28 20:25:52 +09:00
Hajime Hoshi
2da5192510 Rename graphics -> graphicscommand 2018-10-28 20:10:05 +09:00
Hajime Hoshi
690c3cf981 graphics: Embed 'scale' part of the color matrix
If the color matrix includes only 'scale' part, they are embedded
into vertices in order to reduce draw calls.

Fixes #662
2018-08-10 23:20:55 +09:00
Hajime Hoshi
1aabdd58f1 restorable: Fix comments 2018-08-09 01:27:38 +09:00
Hajime Hoshi
3daaef2cab restorable: Refactoring: Use ReplacePixels(nil, ...) for clearing an image 2018-08-09 01:16:46 +09:00
Hajime Hoshi
c68c36b0b7 restoreable: Add ClearState to clear the state explicitly
Fixes #566
2018-08-09 00:12:45 +09:00
Hajime Hoshi
77e905eb25 Revert "graphics: Embed color matrices values to vertices (#655)"
This reverts commit 5a9235aaf9.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
d7d02e6d6a Reland: graphics: mipmap images should be volatile when the base image is volatile
This is not a bug fix, but should improve performance.
2018-07-30 00:26:36 +09:00
Hajime Hoshi
5be58086b5 Revert "graphics: Bug fix: mipmap images should be volatile when the base image is volatile"
This reverts commit 0f82330009.
2018-07-29 23:58:46 +09:00
Hajime Hoshi
0f82330009 graphics: Bug fix: mipmap images should be volatile when the base image is volatile 2018-07-29 23:54:46 +09:00
Hajime Hoshi
5a9235aaf9
graphics: Embed color matrices values to vertices (#655)
Fixes #531
2018-07-26 11:37:27 +09:00
Hajime Hoshi
5249afc06b graphicsutil: Add QuadIndices 2018-07-21 03:40:37 +09:00
Hajime Hoshi
6c8b7f8e9c graphics: Refactoring: Reduce error propagations 2018-07-12 03:08:50 +09:00
Hajime Hoshi
840c4d24df graphicsutil: Accept matrix parameters directly for performance 2018-06-19 00:19:32 +09:00
Hajime Hoshi
a3c754d2cc graphics: Restrict QuadVertices to allow only power of 2 sizes
Now QuadVertices can skip calculating power of 2 values.
2018-06-17 23:05:19 +09:00