Commit Graph

428 Commits

Author SHA1 Message Date
Hajime Hoshi
c7330883ef restorable: Remove Fill and make (*ebiten.Image).Fill available for sub-images
Now a scissor (a clipping region) can be specified, we don't have to
worry about the rendering results out of the specified region.
Replace the implmenetation of the Fill with just a DrawTriangles with
an empty white image.

As a side effect, SubImage is avilable for Fill.

Fixes #1416
2020-11-08 02:50:06 +09:00
Hajime Hoshi
ed028110cf ebiten: Allow rendering on a sub-image by scissor test
Fixes #1255
2020-11-08 00:58:44 +09:00
Hajime Hoshi
a8f96ee9af graphicsdriver/metal: Add Sync to sync CPU and GPU asynchronously
Fixes #1414
2020-11-07 04:09:47 +09:00
Hajime Hoshi
48b46345d7 restorable: Refactoring 2020-11-04 02:03:47 +09:00
Hajime Hoshi
831c7ca6f4 restorable: Refactoring: Use the smaller empty image 2020-10-31 03:06:44 +09:00
Hajime Hoshi
fa53160e18 mipmap: Stop using negative mipmaps
Negative mipmaps tend to allocate extremely big images.

Instead, encourage to use images with explicit padding when enlarging
the image.

Fixes #1400
2020-10-31 02:52:40 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
f3ef2e2af5 Performance optimization for the path without a shader
Fixes #1355
2020-09-21 05:43:24 +09:00
Hajime Hoshi
7329880f40 restorable: Make the image stale when volatile state changes 2020-08-19 21:13:05 +09:00
Hajime Hoshi
8aef1f9080 restorable: Enable to set the 'volatile' state later
Updates #1309
2020-08-19 00:57:23 +09:00
Hajime Hoshi
64a6b39240 Revert "restorable: Do not record pixels if restoring is not requried"
This reverts commit 5e1f263d6d.

Reason: Issue #1304
2020-08-17 00:00:12 +09:00
Hajime Hoshi
5e1f263d6d restorable: Do not record pixels if restoring is not requried
Fixes #1022
2020-08-16 20:07:17 +09:00
Hajime Hoshi
36e9803cea shader: Enable to get pixels from multiple images
Updates #1193
2020-07-19 02:33:43 +09:00
Hajime Hoshi
e0d5763a60 shader: Use the fixed number of images for shaders
This changes uses arrays rather than slices in order to avoid heap
allocations.

Updates #1193
2020-07-18 18:27:47 +09:00
Hajime Hoshi
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
d217bc6033 ebiten: Sparate textures from uniforms at DrawTrianglesWithShader
Updates #1193
Updates #1239
2020-07-09 01:59:21 +09:00
Hajime Hoshi
b83f0acc4d Remove source-region information from vertices
Fixes #1210
2020-07-02 23:38:39 +09:00
Hajime Hoshi
71c9e7ac40 driver: Add Region and sourceRegion parameter at Draw
This is a preparation to remove source-region information from
vertices.

Updates #1210
2020-07-02 03:26:05 +09:00
Hajime Hoshi
4c640d2500 buffered, restorable: Remove copying pixels
Instead, the callers (ebiten.NewImageFromImage and
(*ebiten.Image).ReplacePixels) have responsibility to copy the
pixels now. This change should reduce unnecessary copying pixels.

Updates #1222
2020-07-01 02:56:40 +09:00
Hajime Hoshi
dea3785750 shareable, restorable, graphicscommand: Remove making arrays at DrawTriangles
Updates #1220
2020-06-29 13:37:37 +09:00
Hajime Hoshi
a1abe6b728 restorable: Add padding when renderingn the empty image 2020-06-26 14:01:49 +09:00
Hajime Hoshi
2a63512c6e driver: Add AddressUnsafe
This skips the source-region check and reduces 'if' branches from
shader programs.

AddressUnsafe is internal only so far. We might expose this value
later.

Updates #1210
2020-06-25 01:00:38 +09:00
Hajime Hoshi
2f843c49a6 shader: Fix the case when the source image is nil for shaders 2020-06-04 01:35:35 +09:00
Hajime Hoshi
c0cd7ec59c restorable: Update comments 2020-05-30 16:06:22 +09:00
Hajime Hoshi
f80719ef9a driver: Use slices for uniform variables instead of maps
Fixes #1172
2020-05-26 23:50:11 +09:00
Hajime Hoshi
7b9cc8deb4 restorable: Add tests to dispose shaders
When a shader is disposed, all the images depending on it should
become stale, i.e., discard its all the rendering history items,
because they cannot be restored due to the lack of data on the GPU.
2020-05-26 00:20:11 +09:00
Hajime Hoshi
8e6f19b37a restorable: Add a test using shaders with multiple sources 2020-05-25 23:57:55 +09:00
Hajime Hoshi
ca73f17dd4 restorable: Bug fix: Fill didn't invalidate its dependencies
Fixes #1170
2020-05-25 23:37:25 +09:00
Hajime Hoshi
732f288d20 restorable: Add Shader (WIP) 2020-05-25 00:50:01 +09:00
Hajime Hoshi
a4d419bab1 graphicscommand: Merge DrawTriangles and DrawShader 2020-05-24 02:36:09 +09:00
Hajime Hoshi
46601bb516 graphics: Fill the screenshot in black when the screen is not transparent
Fixes #997
2020-02-06 03:08:16 +09:00
Hajime Hoshi
b3bdf51905
graphicscommand: Return the error immediately (#1060)
Now grpahicscommand saves the error and shows the error after a
while. This was good to simplify the API but was the cause to hide
some issues.

This change fixes all the errors to be returned immediately, and
buffer this in the ebiten package instead.

Fixes #971
2020-01-19 01:18:56 +09:00
Hajime Hoshi
42056c2d61 restorable: Refactoring: Remove Clear
Fill now fills the whole texture.
2019-12-02 03:03:07 +09:00
Hajime Hoshi
e42cff071c restorable: Merge two 'copy' into one
Fixes #983
2019-11-16 02:10:53 +09:00
Hajime Hoshi
f1091910bd Revert "graphicscommand: Remove copying pixels"
This reverts commit 339a96b7e6.

Reason: this causes panic on extending textures
2019-11-16 00:43:22 +09:00
Hajime Hoshi
339a96b7e6 graphicscommand: Remove copying pixels
Now ReplacePixels takes the ownership.

Updates #983
2019-11-16 00:29:37 +09:00
Hajime Hoshi
9cb631e30f Reland: graphics: Reuse vertices backend and reduce allocating
This is a reland of 74f1e5519f.

The vertex slice is now copied before saving as the drawing
history items.
2019-09-29 01:36:00 +09:00
Hajime Hoshi
4feb0a4f3e restorable: Bug fix: indices has to be copied 2019-09-29 01:30:26 +09:00
Hajime Hoshi
0a872b342a shareable: Change the argument to color.RGBA at Fill
The argument will be copied explicitly.
2019-09-21 21:16:46 +09:00
Hajime Hoshi
1c2c932c6c graphics: Remove MakeVolatile/IsVolatile 2019-09-21 14:53:52 +09:00
Hajime Hoshi
3023cc69c3 restorable: Remove (*Image).Size() 2019-09-21 05:40:05 +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
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
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
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
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
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
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
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
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
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
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
0bf12d5519 graphics: Unify dumping logic 2019-07-20 01:46:33 +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
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
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
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
Hajime Hoshi
cce41e8152 graphics: Rename DrawImage -> DrawTriangles for consistency 2019-04-22 23:12:36 +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
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
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
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
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
Hajime Hoshi
ac24a8382f graphicsutil: Extract matrix applying for performance 2018-06-17 19:45:09 +09:00
Hajime Hoshi
95561bbf6b affine: Use float32 values for GeoM
float32 was slow on GopherJS, but not slow on Wasm.
2018-06-17 15:38:10 +09:00
Hajime Hoshi
b4ace53596 affine: Remove GeoM to avoid GeoM allocations on the heap 2018-06-17 00:59:50 +09:00
Hajime Hoshi
3ee76ffd8e graphicsutil: Move vertices.go to graphicsutil 2018-06-10 23:08:22 +09:00
Hajime Hoshi
9745ccee47 restorable: Make (*Image).DrawImage accept vertices and indices 2018-06-10 22:59:00 +09:00
Hajime Hoshi
97a54548df restorable: Rename vertices -> quadVertices 2018-06-10 20:41:17 +09:00
Hajime Hoshi
600983e028 restorable: Record indices for restoring 2018-06-10 20:17:48 +09:00
Hajime Hoshi
2e5e7e6e24 restorable: Remove merging commands for code simplicity 2018-06-10 20:06:17 +09:00
Hajime Hoshi
03079ba067 restorable: Refactoring 2018-06-10 18:40:46 +09:00
Hajime Hoshi
c782380a1c restorable: Specify indices from restorable package 2018-06-10 18:17:58 +09:00
Hajime Hoshi
916c7aac8a restorable: Fix comments 2018-04-29 13:49:33 +09:00
Hajime Hoshi
45afb6db67 Reland: restorable: Merge Clear to ReplacePixel 2018-04-29 13:40:18 +09:00
Hajime Hoshi
eb357f61b5 restorable: Bug fix: Calling At must resolve the image's stale state 2018-04-28 21:56:20 +09:00
Hajime Hoshi
0bc712422f restorable: Bug fix: Remove SetFinalizer for disposing
SetFinalizer causes concurrent issue
2018-04-27 12:08:59 +09:00
Hajime Hoshi
1cf4f30541 Revert "restorable: Merge Clear to ReplacePixels"
This reverts commit fb641d88cd.

Reason: When restoring the image where ReplacePixels is called,
dummyImage might not be restored since there is no record of
relationships between this image and dummyImage. Now pixels is not
nil when reverting by chance, but this would cause problems in the
future.
2018-04-25 22:31:48 +09:00
Hajime Hoshi
fb641d88cd restorable: Merge Clear to ReplacePixels
This can avoid unnecessary stale images that requires loading
pixels from GPU.
2018-04-25 01:30:57 +09:00
Hajime Hoshi
cc725b99af restorable: Replace emptyImage with dummyImage 2018-04-06 03:08:52 +09:00
Hajime Hoshi
7b5ad46e49 shareable: NewImage* now returns a cleared image 2018-04-06 02:08:12 +09:00
Hajime Hoshi
24e20306f2 restorable: Move 'putting random-colored dot' to restorable 2018-04-05 11:18:28 +09:00
Hajime Hoshi
97ce612785 Refactoring: Don't access restorable package directly from ebiten package 2018-03-25 23:37:32 +09:00
Hajime Hoshi
125e5c4f32 restorable: Bug fix: Image must be protected with locks (#567) 2018-03-25 22:31:51 +09:00
Hajime Hoshi
025fd00e6b restorable: Bug fix: Make the image stale when pixels are partly replaced 2018-03-25 20:39:06 +09:00
Hajime Hoshi
fc47d2843a restorable: Add TestRestoreChain2 2018-03-25 19:43:32 +09:00
Hajime Hoshi
c47b549fd1 restorable: Refactoring: Make functions more atomic 2018-03-25 18:21:43 +09:00
Hajime Hoshi
99f72a1b64 restorable: Bug fix: commands must be flushed at At 2018-03-25 01:26:43 +09:00
Hajime Hoshi
be4e3ab801 restorable: Bug fix: partial ReplacePixels broke the image state (#562) 2018-03-20 02:14:00 +09:00
Hajime Hoshi
9d37221743 restorable: Refactoring 2018-03-19 23:55:06 +09:00
Hajime Hoshi
b5d065151a restorable: Don't flatten vertices until actually needed 2018-03-18 23:54:45 +09:00
Hajime Hoshi
00d8e793d9 restorable: Remove MaxImageSize 2018-03-09 02:50:38 +09:00
Hajime Hoshi
4ae9d5780c graphics: Implement shared texture (#514) 2018-03-03 19:54:53 +09:00
Hajime Hoshi
d0592d30e0 graphics: Improve clearing the offscreen performance 2018-03-02 01:55:40 +09:00
Hajime Hoshi
dada2e060a restorable: Bug fix: Don't use graphics.Image for clearing framebuffer 2018-03-02 01:05:54 +09:00
Hajime Hoshi
cd8368deaf restorable: Add TODO comment 2018-03-02 00:00:09 +09:00
Hajime Hoshi
db738676ce restorable: Refactoring: clearIfVolatile 2018-03-01 23:13:23 +09:00
Hajime Hoshi
b8deabbd94 graphics: Reland: Bug fix: a too old frame was rendered at least on Android
Fixes #525
2018-03-01 23:05:28 +09:00
Hajime Hoshi
1a898dd1b9 Add comments 2018-03-01 02:49:45 +09:00
Hajime Hoshi
127f6c09c8 graphics: Specify rect to glTexSubImage2D 2018-03-01 01:58:09 +09:00
Hajime Hoshi
9f6fd0db9a graphics: Use the original width/height for glTexSubImage2D 2018-03-01 00:47:37 +09:00
Hajime Hoshi
02b4fc7917 graphics: Reduce num of Image.Clear() calls 2018-02-28 23:11:12 +09:00
Hajime Hoshi
9db042ae9e graphics: Refactoring: easier way to clear framebuffer 2018-02-28 22:46:57 +09:00
Hajime Hoshi
8ef0f1ac6a restorable: Avoid unneeded discarding images 2018-02-28 15:56:51 +09:00
Hajime Hoshi
2f1908b05c restorable: Use nil instead of empty affine.ColorM 2018-02-28 02:14:10 +09:00