Commit Graph

355 Commits

Author SHA1 Message Date
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
Hajime Hoshi
7bf179472b internal/restorable: change the naming convention: Num -> Count 2022-07-13 02:11:12 +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
6b814888b5 internal/atlas: always use DrawTriangles at putOnAtlas
DrawTriangles was introduced at #1508, and apparently there is no
reason we should use ReplacePixels here. So, simplify the logic by
using only DrawTriangles.
2022-06-10 02:58:04 +09:00
Hajime Hoshi
6b212d7642 internal/restorable: refactoring: add Image.needsRestoring 2022-06-08 02:24:10 +09:00
Hajime Hoshi
9f729cf5c3 internal/restorable: remove SetVolatile 2022-06-08 02:20:09 +09:00
Hajime Hoshi
b8e8d72377 internal/restorable: rename ImageTypeScreenFramebuffer -> ImageTypeScreen 2022-06-07 23:45:35 +09:00
Hajime Hoshi
73c893e977 internal/restorable: refactoring: unify NewScreenFramebufferImage and NewImage 2022-06-06 09:33:50 +09:00
Hajime Hoshi
31fd736ca5 internal/graphicscommand: refactoring: unify NewScreenFrameBufferImage and NewImage 2022-06-06 09:21:11 +09:00
Hajime Hoshi
cb0cbb4efa internal/restorable: refactoring: introduce ImageType 2022-06-06 09:13:55 +09:00