Commit Graph

4200 Commits

Author SHA1 Message Date
Hajime Hoshi
da55397420 internal/restorable: remove empty regions at appendRegionsForDrawTriangles 2023-03-08 16:32:41 +09:00
Hajime Hoshi
f298b9541b internal/restorable: use a cache for pixels at readPixelsFromGPU
Updates #2375
2023-03-08 16:27:38 +09:00
Hajime Hoshi
7f182e7814 internal/restorable: skip basePixels.Clear when the region is empty 2023-03-08 16:21:45 +09:00
Hajime Hoshi
e4fffaf963 internal/restorable: reduce allocations
Updates #2375
2023-03-08 16:07:41 +09:00
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
divVerent
06c141475c
internal/gamepad: native standard layout for Linux (#2587)
Implements native standard layout for Linux gamepads by using the kernel-provided button IDs, thereby expanding
support to gamepads not listed in gamecontrollerdb.txt.

Linux's docs: https://www.kernel.org/doc/Documentation/input/gamepad.txt
SDL2's source: https://fossies.org/linux/SDL2/src/joystick/linux/SDL_sysjoystick.c#l_1740

Note that I am NOT 100% convinced about the X/Y swap between Xbox and PlayStation controllers - the Xbox
compatible pad I have however does have BTN_NORTH and BTN_WEST swapped (and thus BTN_X and BTN_Y
assigned right), which confirms SDL's logic and opposes the kernel docs.

Tested with this gamepad: "20d6:2802 BDA Xbox ONE Core controller", label says "PowerA Model 1508491-02" - even
after clearing out gamecontrollerdb.txt, examples/gamepad shows a 100% correct mapping.

Closes #2052
2023-03-04 01:47:24 +09:00
Hajime Hoshi
6ccdc6382c internal/graphicsdriver/metal/mtl: bug fix: fix a vet error 2023-03-04 01:37:45 +09:00
Hajime Hoshi
36bd3329b3 internal/graphicsdriver/metal: bug fix: compile error 2023-03-04 01:25:43 +09:00
Hajime Hoshi
7998e4d31d update purego to v0.3.0-alpha
There are breaking changes between purego v0.2.0 and v0.3.0-alpha.
2023-03-04 01:22:54 +09:00
divVerent
809ad991c2
internal/gamepad: refactor standard layout support to allow remapping in the per-platform implementations. (#2588)
Refactors native standard layout so standard axes and buttons can be implemented using any of axes, buttons or hats.

This is required to be able to implement a native standard layout mapping for Linux, as e.g. shoulder buttons can be
backed either by an analog or digital input.

Precedes #2587

Updates #2052
2023-03-03 23:29:04 +09:00
Hajime Hoshi
051b0c7238 internal/ui: bug fix: a big-offscreen size could be 0
Closes #2589
2023-03-03 22:34:43 +09:00
Hajime Hoshi
b278e5521f internal/gamepad: rename variables 2023-03-03 21:17:47 +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
7c10e48afd internal/atlas: add an assertion
Updates #2586
2023-03-02 18:24:22 +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
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
8f3974eeba internal/restorable: add TestDrawTrianglesAndExtend 2023-02-28 09:06:41 -08: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
a5a5de2f3f internal/graphicsdriver/directx: reduce memory usages for writing pixels
Updates #2294
Updates #2582
2023-03-01 00:11:34 +09:00
Hajime Hoshi
264f0bad42 internal/graphicsdriver/directx: reduce memory usages when reading pixels
Updates #2294
Updates #2582
2023-02-28 22:55:21 +09:00
Hajime Hoshi
707a44e367 internal/packing: fix the comment 2023-02-28 21:45:58 +09:00
Hajime Hoshi
6b957063d4 internal/packing: bug fix: node's links were not synced correctly
Closes #2584
2023-02-28 20:31:39 +09:00
Hajime Hoshi
5e4652c4f8 internal/atlas: bug fix: wrong size setting 2023-02-28 13:19:27 +09:00
Hajime Hoshi
62e08e7356 internal/restorable: fix comments 2023-02-26 12:26:22 +09:00
Hajime Hoshi
c48d0fbb7a internal/buffer: refactoring 2023-02-26 02:20:07 +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
ff1621885d internal/processtest: use a semaphore for sub-tests
Updates #2571
2023-02-25 16:19:15 +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
f58d7e1ab5 internal/graphicsdriver/directx: bug fix: getting pixels with non-zero position might not work 2023-02-25 02:08:50 +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
Hajime Hoshi
d947cf0da0 internal/atlas: refactoring: use moveTo to make an image isolated
This reduces backend allocations by &backend{...}.

Updates #2581
2023-02-23 02:23:03 +09:00
Hajime Hoshi
0720ec2251 internal/packing: allow initialization with a rectangle size
Updates #2327
2023-02-23 00:45:42 +09:00
Hajime Hoshi
b08b740914 internal/buffered: bug fix: functions were not concurrent-safe
Before this change, `delayedCommandsFlushed` was set as 1 BEFORE
buffered commands were flushed. This meant that a function call and
a command being flushed were not concurrent-safe.

This change fixes this issue by changing the timing of setting
`delayedCommandsFlushed` as 1 to the later time after flushing the
buffered commands.

Closes #2580
2023-02-21 20:38:06 +09:00
Hajime Hoshi
ea7d007df9 internal/ui: bug fix: dstRegion should not exceed the image region
Closes #2577
2023-02-21 14:15:39 +09:00
Hajime Hoshi
ad7d5a86f9 internal/shader: bug fix: check the type for composite literal
Closes #2348
2023-02-20 23:07:11 +09:00
Hajime Hoshi
d91b8cae88 internal/ui: reland: refactoring: improve anti-alias logic
* Remove the image extension. The image is always flushed when necessary.
* Use a small offscreen image whichever the blend is.

Updates #2399
2023-02-19 23:49:32 +09:00
Hajime Hoshi
3aa8448511 Revert "internal/ui: refactoring: improve anti-alias logic"
This reverts commit 41f8295611.

Reason: test failures: https://github.com/hajimehoshi/ebiten/actions/runs/4216421788/jobs/7318236488
2023-02-19 22:46:37 +09:00
Hajime Hoshi
41f8295611 internal/ui: refactoring: improve anti-alias logic
* Remove the image extension. The image is always flushed when necessary.
* Use a small offscreen image whichever the blend is.

Closes #2399
2023-02-19 22:14:23 +09:00