Hajime Hoshi
4cbce71b2b
internal/graphicscommand: move the choice of graphics drivers to internal/ui
2022-03-20 02:51:31 +09:00
Hajime Hoshi
7d0f95e9be
internal/graphicsdriver: refactoring: replace Uniform with []float32
...
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
b22309a0e5
internal/graphicsdriver: replace Pixels with ReadPixels
...
Now preparing a byte slice is the caller's responsibility.
2022-02-27 20:03:13 +09:00
Hajime Hoshi
df60c4c92d
internal/driver: rename to internal/graphicsdriver
2022-02-06 20:41:32 +09:00
Hajime Hoshi
06f4142ca0
internal/driver: Optimization: Replace interface{} with driver.Uniform
...
Converting a value from/to interface{} can create a value in heap
and this is not efficient.
2021-10-30 02:58:28 +09:00
Hajime Hoshi
dbe101a8ef
internal/restorable: Remove draw-triangles-history items explicitly
...
Updates #1803
2021-09-09 12:57:50 +09:00
Hajime Hoshi
8f857daf3e
internal/restorable: Bug fix: Forbid NewImage before the graphics driver is ready
2021-09-09 03:58:58 +09:00
Hajime Hoshi
a3570331dd
internal/restorable: Delay initializing emptyImage
...
Now NeedsRestorable can always return a correct value.
2021-09-09 03:27:22 +09:00
Hajime Hoshi
18903db1c6
internal/atlas: Bug fix: Unexpected padding in screenshots
...
Closes #1736
2021-07-29 16:09:29 +09:00
Hajime Hoshi
21aa96f9f5
internal/affine: Refactoring: Make ColorM interface
2021-07-27 12:10:22 +09:00
Hajime Hoshi
b466a0cbd7
ebiten: Add EvenOdd to DrawTrianglesOptions and DrawShaderTrianglesOptions
...
Updates #844
Closes #1684
2021-07-05 03:35:55 +09:00
Hajime Hoshi
c725937cc6
internal/graphics: Reuse the vertices backend
...
This is basically a reland of 9cb631e30f
.
This change locks the vertices backend at the end-frame phase to
protect from vertices usages by other goroutines.
Updates #1546
Closes #1681
2021-06-27 02:31:01 +09:00
Hajime Hoshi
38ce46328a
internal/atlas: Reuse byte array for ReplacePixels
...
This reduces memory allocation at ReplacePixels.
Updates #1681
2021-06-26 03:48:25 +09:00
Hajime Hoshi
26b9fa20c1
internal/graphics: Bug fix: Race condition at QuadVertices
...
QuadVertices or verticesBackend.slice reused its backend slice.
This caused a race condition. QuadVertices can be accessed from
multiple goroutines, and resetting the head and copying the data
at internal/graphicscommand might not be synced.
This change fixes this issue by basically reverting
9cb631e30f
.
Closes #1546
2021-03-20 16:32:13 +09:00
Hajime Hoshi
6b3c51921c
internal/driver: Remove Image.Sync
...
Syncing is no longer needed for Metal, and additionally, OpenGL's sync
implementation was mock.
Updates #1508
2021-02-26 23:16:28 +09:00
Hajime Hoshi
9341d21614
internal/shareable: Call DrawTriangles instead of ReplacePixels at makeShared ( #1513 )
...
When context losts never happen, reading pixels and call replace-pixels command are not needed.
Closes #1508
2021-02-26 12:56:22 +09:00
Hajime Hoshi
44bb004cb7
internal/restorable: Avoid allocating new slices for drawTrianglesHistory
2021-01-30 19:13:03 +09:00
Hajime Hoshi
ed494dbf59
restorable: Reland: Do not record pixels if restoring is not requried
...
This change also remove the restrictions of operations on
graphicscommand.Image. For example, now DrawTriangles and
ReplacePixels can be mixed on the same image.
Fixes #1022
2020-11-14 15:00:16 +09:00
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