Commit Graph

190 Commits

Author SHA1 Message Date
Hajime Hoshi
9a8dde6503 internal/atlas: bug fix: a finalizer was never called
As the finalizer function had a reference to the target image, the
image's reference count never became 0. Then, the image was never
finalized.

This change fixes this issue by using a member function pointer instead
of an anonymous function.

Closes #2897
2024-01-29 20:39:44 +09:00
Hajime Hoshi
7f396f72de all: remove the comments about restorable 2024-01-13 20:00:01 +09:00
Hajime Hoshi
c404b448aa internal/restorable: integrate the implementation into internal/atlas
Closes #805
2024-01-13 19:59:57 +09:00
Hajime Hoshi
812cd494de internal/restorable: remove Image
Updates #805
2024-01-13 19:33:04 +09:00
Hajime Hoshi
59896e4447 internal/restorable: integrate Image functions into internal/atlas
Updates #805
2024-01-13 19:27:14 +09:00
Hajime Hoshi
6151fd313f internal/restorable: integrate Image.Extend into internal/atlas
Updates #805
2024-01-13 19:15:47 +09:00
Hajime Hoshi
6cc8150185 internal/restorable: integrate Image.WritePixels into internal/atlas
Updates #805
2024-01-13 19:05:19 +09:00
Hajime Hoshi
3ee905bc4d internal/restorable: integrate Image.DrawTriangles into internal/atlas
Updates #805
2024-01-13 18:52:06 +09:00
Hajime Hoshi
bfa2c460a2 internal/restorable: integrate Shader.Dispose into internal/atlas
Updates #805
2024-01-13 18:40:31 +09:00
Hajime Hoshi
2a465c2d0b internal/atlas: bug fix: do not pass nil to WritePixels 2024-01-13 18:33:02 +09:00
Hajime Hoshi
e804f9e58c internal/restorable: integrate ReadPixels into internal/atlas
Updates #805
2024-01-13 18:19:43 +09:00
Hajime Hoshi
c5d0ec3de7 internal/restorable: integrate some functions into internal/atlas
Updates #805
2024-01-13 18:05:42 +09:00
Hajime Hoshi
21ef462c37 internal/restorable: remove ImageType
Updates #805
2024-01-13 18:03:39 +09:00
Hajime Hoshi
3651d73e0b internal/atlas: move some functions in internal/restorable to internal/atlas
Updates #805
2024-01-13 14:05:24 +09:00
Hajime Hoshi
f610cb5724 internal/restorable: move SwapBuffers to internal/atlas
Updates #805
2024-01-09 04:55:26 +09:00
Hajime Hoshi
7c9266d8b6 internal/restorable: move DumpImages to internal/atlas
Updates #805
2024-01-09 04:50:22 +09:00
Hajime Hoshi
fdf36026ae internal/atlas: add special backends to theBackends for consistency 2024-01-09 04:39:15 +09:00
Hajime Hoshi
fe0b33db58 internal/atlas: improve deallocation 2024-01-09 04:31:23 +09:00
Hajime Hoshi
8c2d4e1408 internal/restorable: remove ImageTypeRestorable
Updates #805
2024-01-09 03:35:32 +09:00
Hajime Hoshi
4f3e00ec3a internal/restorable: remove unnecessary functions and variables around shaders
Updates #805
2024-01-09 03:23:13 +09:00
Hajime Hoshi
c08a2193a9 internal/restorable: remove the case when the restoring is needed
Updates #805
2024-01-09 00:20:35 +09:00
Hajime Hoshi
4895ae7f93 internal/graphicsdriver/opengl: refactoring: move some functions from internal/ui
Updates #2714
2023-12-23 22:30:13 +09:00
bsski
b8df1217c3
all: fix typos (#2864) 2023-12-17 22:42:34 +09:00
Hajime Hoshi
4e93efa5ac internal/graphicsdriver: reland: add FillRule and replace boolean values with this
Updates #2782
2023-11-04 19:09:50 +09:00
Hajime Hoshi
f695df5924 Revert "internal/graphicsdriver: add FillRule and replace boolean values with this"
This reverts commit 38cf964a3b.

Reason: build failure on Windows
2023-11-04 19:02:40 +09:00
Hajime Hoshi
38cf964a3b internal/graphicsdriver: add FillRule and replace boolean values with this
Updates #2782
2023-11-04 18:57:31 +09:00
Hajime Hoshi
0cbcf7e493 internal/atlas: refactoring: remove unused arguments 2023-11-04 18:31:22 +09:00
Hajime Hoshi
f2544a1bd9 internal/graphicsdriver: use []uint32 instead of []uint16 for indices
Updates #2612
2023-11-04 04:39:17 +09:00
Hajime Hoshi
ba93794a72 internal/atlas: images were not collected by GC 2023-11-04 04:37:40 +09:00
Hajime Hoshi
c01ceeaa6a ebiten: replace (*Image).Dispose with Deallocate
Closes #2808
2023-11-03 17:45:39 +09:00
Hajime Hoshi
8a44ef4f6c internal/atlas: bug fix: (*Image).Deallocate (*Shader).Deallocate were not concurrent-safe
Updates #2162
2023-11-03 17:12:04 +09:00
Hajime Hoshi
bdd8916bb1 ebiten: replace (*ebiten.Shader).Dispose with Deallocate
Updates #2808
2023-11-03 16:25:18 +09:00
Hajime Hoshi
97d1e073e2 internal/atlas: refactoring 2023-11-03 14:52:19 +09:00
Hajime Hoshi
258f0fd941 internal/atlas: remvoe 'disposed' state
Updates #2808
2023-11-03 14:35:57 +09:00
Hajime Hoshi
d72c4ec90b internal/atlas: refactoring 2023-11-03 14:19:59 +09:00
Hajime Hoshi
55702a7c28 internal/atlas: refactoring: ensure ReadPixels to be processed in a frame
This enables to call (*Image).At from HandleInput, which might be
called outside of a frame.

Updates #1704
2023-10-25 00:48:09 +09:00
Hajime Hoshi
b94c3fa9bb internal/atlas: split EndFrame into EndFrame and SwapBuffers
This enables to do something asynchronously while executing SwapBuffers
in a different goroutine.

This is a preparation for HandleInput.

Updates #1704
2023-10-24 00:22:04 +09:00
Hajime Hoshi
e80e981bf5 internal/atlas: let callers retry ReadPixels instead of blocking
This is a preparation to implement HandleInput, which might call
(*Image).At in its callback.

Updates #1704
2023-10-20 02:30:32 +09:00
Hajime Hoshi
913824beba internal/atlas: close channels on the sender side just in case 2023-10-19 12:14:54 +09:00
Hajime Hoshi
ad51e22252 internal/atlas: bug fix: ReadPixels crashed when inFrame was false
This change fixes the issue by letting ReadPixels return a channel
and executing this asynchronously when needed.

Closes #2815
2023-10-19 03:56:54 +09:00
Hajime Hoshi
7a921e03da internal/atlas: bug fix: inFrame was not correctly updated
Updates #2814
2023-10-19 02:08:28 +09:00
Hajime Hoshi
7d517bfb63 internal/buffered: move buffering to internal/atlas
Closes #2814
2023-10-19 01:56:18 +09:00
Hajime Hoshi
19ee79e2cb internal/buffered: remove unnecessary deferred functions for shaders 2023-10-18 23:36:41 +09:00
Hajime Hoshi
315450474a internal/atlas: add comments 2023-10-18 01:01:21 +09:00
Hajime Hoshi
27fd10595b internal/ui: refactoring: reduce global functions and prefer Get() 2023-10-15 03:40:48 +09:00
Hajime Hoshi
f269b61903 internal/atlas: introduce a managed byte slice pool
A managed byte slice from the new byte slice pool has a function
to release and put it back to the pool explicitly, and this doesn't
rely on GCs.

Updates #1681
Closes #2804
2023-10-09 20:32:32 +09:00
Hajime Hoshi
34d577a5ff Revert "internal/atlas: reintroduce a byte pool"
This reverts commit 7e17b25c56.

Reason: the current byte pool suppresses allocations to some extent, but doesn't suppress GCs.

Updates #1681
2023-10-09 14:40:05 +09:00
Hajime Hoshi
7e17b25c56 internal/atlas: reintroduce a byte pool
The old byte pool depnded on lifetimes of command queues, and this
was tricky.

The new byte pool uses runtime.SetFinalizer so this should be much
easier to use.

Updates #1681
2023-10-09 03:28:29 +09:00
Hajime Hoshi
6e5361c328 internal/restorable: use clearImage to avoid allocations
Bytes from a pool in a command queue is now pretty hard to use correctly
as the lifetime of a queue is not clear.

Remove the byte pools once. Let's reconsider pool usages later.

This change also removes imagesWithBuffers as this is no longer needed.
imagesWithBuffers was necessary to ensure all the bytes from the pool
of the command queue was used before the queue flushes the commands,
as the command queue cleared the pool after flushing. The lifetimes
were pretty ticky.
2023-10-09 00:42:58 +09:00
Hajime Hoshi
4ca3fa5e57
internal/graphicsdriver: replace Region with image.Rectangle (#2791)
Closes #2790
2023-09-28 14:29:55 +09:00