Commit Graph

365 Commits

Author SHA1 Message Date
Hajime Hoshi
7f3cff5e7c internal/restorable: revive pixelsForRestore
pixelsForRestore was removed at 09e0320309
as the regions for restoring were minimized. However, this caused a
regression and increased allocations on Android.

This fix revives pixelsForRestore, but as a map with region keys and
byte slice values. pixelsForRestore no longer represents a byte slice
for an entire image.

Updates #2375
2023-03-08 14:52:44 +09:00
Hajime Hoshi
e5bb89aa35 internal/restorable: use a special shader to clear an image
This reduces one extra internal texture.
2023-03-01 15:47:03 +09:00
Hajime Hoshi
42aa5fa604 internal/restorable: bug fix: an extended image has a wrong state (especially with OpenGL ES) 2023-02-28 08:48:25 -08:00
Hajime Hoshi
62e08e7356 internal/restorable: fix comments 2023-02-26 12:26:22 +09:00
Hajime Hoshi
110ba5403d internal/buffered: remove redundant pixel data if possible 2023-02-26 01:55:43 +09:00
Hajime Hoshi
df944fdf90 internal/restorble: clear pixels when possible to save memory 2023-02-26 00:12:34 +09:00
Hajime Hoshi
f04d9d6925 internal/restoring: avoid using staleRegions when alwaysReadPixelsFromGPU is true
Updates #2582
2023-02-25 23:26:28 +09:00
Hajime Hoshi
965fd4cac8 internal/restoring: bug fix: stop keeping pixel data on 32bit architecture
Updates #4259
2023-02-25 23:11:42 +09:00
Hajime Hoshi
a0a80bbc1f internal/restorable: do not reset basePixels at makeStale
This information is still available even after context-lost happens,
so this doesn't have to be reset.
2023-02-25 21:13:35 +09:00
Hajime Hoshi
aca42e4046 internal/restorable: use sparate regions instead of a big unified region 2023-02-25 15:40:48 +09:00
Hajime Hoshi
09e0320309 internal/restorable: minimize a region for restoring 2023-02-25 15:10:32 +09:00
Hajime Hoshi
ff926b2e9f internal/restorable: reland (2nd): use a smaller size rectangle for staleRegion 2023-02-24 21:25:47 -08:00
Hajime Hoshi
ec6f425fa0 Revert "internal/restorable: reland: use a smaller size rectangle for staleRegion"
This reverts these commits:

* 0755523776
* e36007a3a3

Reason: TestImageOptionsFill fails with OpenGL ES (https://github.com/hajimehoshi/ebiten/actions/runs/4264894196/jobs/7423561399)
2023-02-25 03:12:26 +09:00
Hajime Hoshi
0755523776 internal/restorable: bug fix: pixel info was unexpectedly lost 2023-02-25 02:43:58 +09:00
Hajime Hoshi
e36007a3a3 internal/restorable: reland: use a smaller size rectangle for staleRegion 2023-02-25 02:09:22 +09:00
Hajime Hoshi
185529f1cb Revert "internal/restorable: use a smaller size rectangle for staleRegion"
This reverts commit e4debfd466.

Reason: test failures on Windows: https://github.com/hajimehoshi/ebiten/actions/runs/4262488629/jobs/7418053241
2023-02-24 21:56:32 +09:00
Hajime Hoshi
e4debfd466 internal/restorable: use a smaller size rectangle for staleRegion 2023-02-24 21:33:39 +09:00
Hajime Hoshi
745a69aeaa internal/restorable: update comments 2023-02-24 18:25:17 +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
89c64f83e3 ebiten: performance improvement by reducing allocations of []float32 2022-12-03 21:53:56 +09:00
Hajime Hoshi
0a6813c17f internal/graphics: use flatten []float32 slice instead of [][]float32
Closes #2479
2022-12-03 20:23:58 +09:00
Hajime Hoshi
419bb4c1e9 all: use uint32 instead of float32 for uniform values
This is a preparation for other types of uniform values.

Updates #2305
2022-11-12 20:28:07 +09:00
Hajime Hoshi
fde964312c internal/packing: reland: refactoring
This change basically relands these commits:

 * e08078d84a
 * 8fa36cc7ef

but with a fix internal/restorable not to create too many images.

Updates #2327
2022-11-11 21:55:11 +09:00
Hajime Hoshi
f04e391cb4 all: rename emptyImage -> whiteImage 2022-10-21 15:26:56 +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
cb79e4eabe internal/restorable: improve pixelsForRestore usages
Updates #2375
2022-10-06 15:54:54 +09:00
Hajime Hoshi
c6b37e9809 internal/restorable: use pixelsForRestore only when restoring is needed
Updates #2375
2022-10-06 15:09:21 +09:00
Hajime Hoshi
34562c3337 internal/restorable: clear pixelsForRestore at Dispose
Updates #2375
2022-10-06 15:04:12 +09:00
Hajime Hoshi
e66bac5c3f internal/restorable: reuse byte slices for restoring
Updates #2375
2022-10-06 14:52:20 +09:00
Hajime Hoshi
85d8a5889a Revert "internal/restorable: reuse bytes instead of allocations"
This reverts commit 8cf3c31cf6.

Reason: This didn't improve the situation.

Updates #2375
2022-10-06 14:11:09 +09:00
Hajime Hoshi
8cf3c31cf6 internal/restorable: reuse bytes instead of allocations
Updates #2375
2022-10-06 12:41:47 +09:00
Hajime Hoshi
72983d966b all: remove unused conditions
Now Kage shaders are always used.

The situtation is different from when we fixed for #1355, so we removed
the fast path for #1335. We have to re-check the current performance.

Updates #1355
2022-10-02 23:50:48 +09:00
Hajime Hoshi
de8f85651d internal/restorable: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 22:51:34 +09:00
Hajime Hoshi
0ae2b1bc24 all: remove unnecessary conditions
Now a Kage shader is always used.
2022-10-02 22:30:59 +09:00
Hajime Hoshi
6fca8edc1b internal/graphicscommand: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 22:21:11 +09:00
Hajime Hoshi
311aa7dcf8 all: use Kage shaders in internal packages
Updates #2369
2022-10-02 19:17:09 +09:00
Hajime Hoshi
18fa00d25d internal/restorable: update comments 2022-09-14 02:20:11 +09:00
Hajime Hoshi
6179158812 internal/restorable: bug fix: no pixels were read only with DrawTriangles
Closes #2324
2022-09-14 02:17:14 +09:00
Hajime Hoshi
b36c21648f internal/restorable: refactoring: remove a redundant FlushCommands call
readPixelsFromGPU already flushes commands.
2022-09-13 08:43:02 -07:00
Hajime Hoshi
6b906bb813 internal/restorable: extend the staleRegion when the image is already stale on WritePixels
This is a kind of refactoring. There seems no case that this condition
change is really needed, but this is more logical.
2022-09-13 07:29:53 -07:00
Hajime Hoshi
243c224003 internal/restorable: bug fix: wrong panic on mixing DrawTriangles and WritePixels
When DrawTriangles is called and then WritePixels is called on a
sub-image, a panic happened. However, this panic actually happens
only when the graphics driver requires restoring (e.g. OpenGL ES
on Android). The situation was very limited, but this was a real
problem on Android.

This panic was introduced to prevent a rendering bug by a inmature
graphics drivers, but we should no longer need this. This change
just removes the panic.

Updates #292
2022-09-13 06:18:55 -07:00
Hajime Hoshi
40362aa62d internal/restorable: bug fix: readPixelsFromGPU might be called for a non-stale image
Actually readPixelsFromGPUIfNeeded can invoke this.

Closes #2322
2022-09-13 15:34:43 +09:00
Hajime Hoshi
4824cbc755 internal/graphicscommand: bug fix: IsInvalidated was not concurrent-safe
This function was not called actually, so this is not a real problem.
However, this could be a potential problem for a future GLES driver (#292).

Updates #292
Closes #2321
2022-09-13 12:23:19 +09:00
Hajime Hoshi
ae41530f1c internal/graphicscommand: move availableFilename to graphicscommand 2022-08-31 13:26:14 +09:00
Hajime Hoshi
fd5d142453 internal/restorable: bug fix: needed to copy the stale region when extending an image
Updates #2274
2022-08-27 23:29:50 +09:00
Hajime Hoshi
b2f874a244 image/rectangle: read pixels only for necessary parts
Closes #2274
2022-08-27 23:23:33 +09:00
Hajime Hoshi
af894d5c83 internal/restorable: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:16:26 +09:00
Hajime Hoshi
70f5e84098 internal/graphicsdriver: rename ReplacePixels to WritePixels
Updates #2236
2022-08-08 03:05:04 +09:00
Hajime Hoshi
bf5f7ee34d internal/restorable: refactoring: replace At with ReadPixels
Updates #1995
2022-08-05 23:37:27 +09:00
mattn
3cd0daac67
go generate ./... with Go 1.19 (#2228) 2022-08-03 20:48:02 +09:00