Commit Graph

60 Commits

Author SHA1 Message Date
Hajime Hoshi
fd2c79398e Revert "internal/atlas: refactoring: ensure ReadPixels to be processed in a frame"
This reverts commit 55702a7c28.

Reason: This didn't work with the single-thread mode.

Updates #1704
Closes #2939
2024-03-26 13:10:00 +09:00
Hajime Hoshi
64cb6cf8a9 internal/atlas: reduce test flakiness 2024-02-24 23:03:12 +09:00
Hajime Hoshi
24256af624 internal/atlas: bug fix: test flakiness due to GC 2024-02-15 03:00:49 +09:00
Hajime Hoshi
f74d66e89a internal/atlas: bug fix: fix GC tests
Updates #2897
2024-01-29 21:01:58 +09:00
Hajime Hoshi
d2a9e5b1e8 internal/atlas: bug fix: fix tests
Updates #2897
2024-01-29 20:52:43 +09:00
Hajime Hoshi
f37ebe549b internal/atlas: bug fix: fix tests
Updates #2897
2024-01-29 20:52:02 +09:00
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
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
c01ceeaa6a ebiten: replace (*Image).Dispose with Deallocate
Closes #2808
2023-11-03 17:45:39 +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
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
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
27fd10595b internal/ui: refactoring: reduce global functions and prefer Get() 2023-10-15 03:40:48 +09:00
Hajime Hoshi
4ca3fa5e57
internal/graphicsdriver: replace Region with image.Rectangle (#2791)
Closes #2790
2023-09-28 14:29:55 +09:00
Hajime Hoshi
534370f7b1 internal/graphics: enable to specify regions for each source image
This is a preparation to specify different sizes of source images.

Updates #1870
2023-08-27 21:15:01 +09:00
Hajime Hoshi
7ea3cd4738 internal/atlas: bug fix: copy the image slice before iterating it
Closes #2729
2023-08-23 16:41:34 +09:00
Hajime Hoshi
77fd15145b internal/atlas: add a test for a bug fix
Closes #2728
2023-08-19 01:36:05 +09:00
Hajime Hoshi
98cb77d94f internal/atlas: refactoring 2023-08-06 16:03:57 +09:00
Hajime Hoshi
0433dfac99 internal/atlas: reland: clarify the logic when to update usedAsDestination
This is a reland of 2c9f5d9dad.

As the name is `usedAsDestination`, this should be updated whenever
the image is used as a rendering destination.

Confirmed that this change didn't cause a performance regression
like #2586.

Updates #2586
Updates #2676
2023-08-06 15:59:11 +09:00
Hajime Hoshi
d2c991b774 all: refactoring: use image.Rectangle 2023-04-28 01:03:38 +09:00
Hajime Hoshi
27538135a7 internal/atlas: improve tests
This change fixes the test to reflect the fix for #2586.

Updates #2586
2023-03-02 20:16:26 +09:00
Hajime Hoshi
1c09ec5e44 internal/atlas: bug fix: too aggressive counting up destinationCount
Closes #2586
2023-03-02 18:58:29 +09:00
Hajime Hoshi
7c0fbce0cf internal/atlas: use texture atlases for rendering destinations
Before this change, texture atlases are created only for rendreing
sources.

This change enables to use texture atlases even for rendering
destinations, so that the number of textures will be drastically
reduced.

Closes #2581
2023-03-01 02:47:01 +09:00
Hajime Hoshi
110ba5403d internal/buffered: remove redundant pixel data if possible 2023-02-26 01:55:43 +09:00
Pierre Curto
4de807cc44
all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Hajime Hoshi
4d270de75e internal/atlas: renmae functions
Updates #2519
2023-01-02 20:18:05 +09:00
Hajime Hoshi
bb1021a549 internal/atlas: ensure the given sizes must be power of 2
Updates #2519
2023-01-02 19:17:27 +09:00
Hajime Hoshi
7c459c152b internal/atlas: bug fix: compile error 2022-10-16 20:02:42 +09:00
Hajime Hoshi
09a7d39874 internal/graphicsdriver: add Blend struct
This is a preparation to specify blend factors and blend operators.

Updates #2382
2022-10-16 01:08:26 +09:00
Hajime Hoshi
99e777b0c5 internal/atlas: do not adjust pixels for DrawTriangles(Shader)
Adjusting pixels is needed to avoid strainge rendering to avoid unexpected
rendering (#1171). However, this adjustment caused unexpected holes
especially in a thick stroke.

This change moves the logic of adjusting pixels from atlas to
graphics.QuadVertices so that adjusting works only for DrawImage and
DrawRectShader.

Updates #1171
Updates #1843
2022-10-11 02:09:20 +09:00
Hajime Hoshi
3da30b3b78 internal/atlas: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 23:06:27 +09:00
Hajime Hoshi
311aa7dcf8 all: use Kage shaders in internal packages
Updates #2369
2022-10-02 19:17:09 +09:00
Hajime Hoshi
31945563d8 internal/atlas: optimize adjustDestinationPixel
```
go test -bench=BenchmarkAdjustPixel -run=^$ -count=5 ./internal/atlas/
```

```
name           old time/op  new time/op  delta
AdjustPixel-8  2.59ns ± 1%  2.12ns ± 1%  -18.16%  (p=0.008 n=5+5)
```
2022-09-15 01:50:47 +09:00
Hajime Hoshi
9319266c01 internal/atlas: add a benchmark for adjustDestinationPixel 2022-09-15 01:25:26 +09:00
Hajime Hoshi
8ce84c6596 internal/atlas: rename ReplacePixels -> WritePixels 2022-08-08 03:24:46 +09:00
Hajime Hoshi
764ec8c794 internal/atlas: refactoring 2022-08-02 01:13:46 +09:00
Hajime Hoshi
afed6a83c6 internal/graphics: change the naming convention: Num -> Count
This change also renames ebiten.MaxIndicesNum -> ebiten.MaxIndicesCount.
2022-07-13 02:02:44 +09:00
Hajime Hoshi
8522bfd0bf internal/graphicscommand: bug fix: replacePixelsCommand should not read pixels
Reading pixels, writing pixels, and using the image as a source might
cause a flaky behavior with Metal. Stop reading pixels if possible.

Closes #2180
2022-07-05 23:30:26 +09:00
Hajime Hoshi
253f2757d1 internal/atlas: add a test to modify pixels after ReplacePixels call 2022-06-11 23:44:29 +09:00
Hajime Hoshi
37369a2f4b internal/atlas: add TestMaxImageSizeJust 2022-06-10 14:30:18 +09:00
Hajime Hoshi
03567f74f9 internal/atlas: bug fix: respect injected maxSize for testings 2022-06-10 14:25:08 +09:00
Hajime Hoshi
9e34103491 internal/atlas: refactoring: make paddingSize a method
Updates #2131
2022-06-10 00:23:25 +09:00
Hajime Hoshi
81f91658ff internal/atlas: refactoring: remove SetVolatile and SetIsolate
Pass an image type to NewImage instead.
2022-06-08 01:08:00 +09:00
Hajime Hoshi
34e23f5256 internal/restorable: treat texels instead of pixels
Updates #1820
2022-04-02 04:25:27 +09:00
Hajime Hoshi
b3f4d6c522 internal/atlas: add a new parameter specifying a mask for ReplacePixels 2022-03-21 03:56:04 +09:00
Hajime Hoshi
11ff0ab48c internal/atlas: refactoring: remove arguments from Pixels 2022-03-20 18:28:57 +09:00