Commit Graph

4214 Commits

Author SHA1 Message Date
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
Hajime Hoshi
961c34efb5 internal/ui: use a small buffer image for anti-alias
Closes #2399
2023-02-19 17:35:43 +09:00
Hajime Hoshi
8479fee606 internal/ui: refactoring 2023-02-18 18:23:57 +09:00
Hajime Hoshi
0e57fc4c5f internal/processtest: set timeout
Updates #2571
2023-02-18 17:36:31 +09:00
Hajime Hoshi
56597800dd internal/ui: refactoring: add bigOffscreenImage
Updates #2399
2023-02-18 02:32:41 +09:00
Hajime Hoshi
7018d1aebe internal/processtest: fix the timeout logic
Updates #2571
2023-02-15 22:41:18 +09:00
Hajime Hoshi
a65b65110b Revert "internal/processtest: prevent parallel process testing"
This reverts commit 397da70815.

Reason: This did not resolve the issue: https://github.com/hajimehoshi/ebiten/actions/runs/4180959132/jobs/7242421909

Updates #2571
2023-02-15 15:13:57 +09:00
Hajime Hoshi
7315044dcf internal/ui: remove a redundant call to close a window
glfw.Terminate should close the window too. This might fix the issue
so let's wait and see.

Updates #2551
2023-02-15 14:36:28 +09:00
Hajime Hoshi
397da70815 internal/processtest: prevent parallel process testing
Updates #2571
2023-02-14 18:13:27 +09:00
TotallyGamerJet
93537650c0
internal/goglfw: use platform agnostic functions for context_windows.go (#2570)
context_windows.go is used for all the platforms. However, it used syscall.Syscall which behaves differently on macOS
and Windows as well as windows.BytePtrToString which isn't available on Linux or macOS.

This commit replaces syscall.Syscall with purego.SyscallN and windows.BytePtrToString with a copied version called
bytePtrToString.

Updates #2546
2023-02-10 02:35:17 +09:00
TotallyGamerJet
b359985e97
internal/goglfw: separate windows specific struct from common structs (#2567)
Many of the structs found in internal.h (internal_windows.go) contain defines such as GLFW_WIN32_WINDOW_STATE
which gets replaced with a struct defined in win32platform_windows.go (win32_platform.h).

Originally, these structs where directly placed inside of internal_windows.go. However, to make it easier to add macOS
and Linux these cannot be in this file.

This commit separates the windows specific structs into the respective windows file and updates the field to be named
state.

Updates #2546
2023-02-08 03:05:46 +09:00
Hajime Hoshi
8864ce1291 all: update comments 2023-02-07 12:05:43 +09:00
Hajime Hoshi
f4371991fe internal/gamepad: refactoring 2023-02-02 22:33:01 +09:00
Hajime Hoshi
628418d88e internal/gamepaddb: update the database 2023-02-02 22:00:34 +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
f009dd8dd2 ebiten: implement DroppedFiles to replace AppendDroppedFiles
Closes #2552
2023-01-25 14:27:11 +09:00
Hajime Hoshi
aa52402a90 internal/graphicsdriver/metal: fix a comment 2023-01-24 02:22:35 +09:00
Hajime Hoshi
16e49e0499 internal/ui: fix a potential out-of-range error 2023-01-24 00:32:08 +09:00
Hajime Hoshi
7f39b9c5b6 internal/graphicsdriver/metal: use supportsFeatureSet: as a fallback
This change is a fix for a regression that happened on macOS High Sierra.

Closes #2553
2023-01-23 23:44:56 +09:00
Hajime Hoshi
84e32c2e4e internal/ui: more precise detection of directory on browsers
Updates #1868
2023-01-22 18:28:34 +09:00
Hajime Hoshi
8c25fac860 ebiten: add AppendDroppedFiles
Closes #1868
2023-01-22 17:22:25 +09:00
Hajime Hoshi
b79f0394cc internal/ui: refactoring: allow slices in InputState 2023-01-22 01:28:57 +09:00
Hajime Hoshi
d53803615a internal/ui: merge a window-closing state into an input state 2023-01-21 23:42:48 +09:00
Hajime Hoshi
35e25a3636 rename internal/glfwwin -> internal/goglfw
Updates #2546
2023-01-21 22:09:21 +09:00
Hajime Hoshi
06bc569b73 internal/shader: bug fix: wrongly typed constants were unexpectedly used
Closes #2549
2023-01-20 02:26:39 +09:00
Hajime Hoshi
f054a7634a ebiten: deprecate (*Image).Size
Closes #2351
2023-01-20 01:26:37 +09:00
Hajime Hoshi
96a44eceaf internal/glfwwin: remove unused functions 2023-01-14 17:04:46 +09:00
Hajime Hoshi
72f026e254 internal/graphicsdriver/opengl/gl: bug fix: searching GL libraries failed on some machines
On a Debian machine, LD_LIBRARY_PATH might not be set and libGL.so might
not exist (libGL.so.1 exists instead). In this case, searching for a GL
library fails

This change fixes the issue by not using LD_LIBRARY_PATH and also including
`libGL.so.*` files as candidates for dlopen.

Closes #2539
2023-01-13 15:08:06 +09:00
Hajime Hoshi
08fba564f8 internal/ui: refactoring: define global sel_ objects 2023-01-09 01:41:13 +09:00
divVerent
abece041f4
internal/graphicsdriver/opengl: fix state tracking of glBindTexture / glActiveTexture interaction (#2526)
After switching texture units using glActiveTexture, a different texture may
be bound. For now, let's just force the active texture state variable to zero
so the next glBindTexture call isn't skipped.

Closes #2525
2023-01-07 23:13:14 +09:00
Hajime Hoshi
95f1ef0fb9 internal/ui: bug fix: recover the cursor shape when the cursor is visible
Closes #2527
2023-01-07 20:03:21 +09:00
Hajime Hoshi
86fa9366f7 internal/ui: use 'set' instead of 'push' for cursors
We don't need to use a cursor stack.
2023-01-07 19:16:41 +09:00
Hajime Hoshi
847d1cae73 internal/graphicsdriver/opengl/gl/: refactoring 2023-01-07 17:01:00 +09:00
Hajime Hoshi
d615c2f42a internal/graphicsdriver/opengl/gl: bug fix: isES was not set 2023-01-07 03:46:30 +09:00
Hajime Hoshi
869ca1e01f internal/graphicsdriver/opengl/gl: fix a wrong comment 2023-01-07 03:41:02 +09:00
Hajime Hoshi
983e8abd46 internal/graphicsdriver/opengl/gl: bug fix: an unavailable library name might be chosen
Instead, let's try all the names with dlopen.

Updates #2523
2023-01-07 03:06:12 +09:00
Hajime Hoshi
df7b7b731e internal/graphicsdriver/opengl/gl: bug fix: libGL.so might not exist in Steam
Instead, libGL.so.1 might exist. Use LD_LIBRARY_PATH and list the
candidates.

Closes #2523
2023-01-07 00:03:07 +09:00
Hajime Hoshi
b860d8dc61 internal/graphicsdriver/metal/mtl: bug fix: test failures 2023-01-05 14:14:42 +09:00
Hajime Hoshi
c5848455f5 internal/graphicsdriver/metal: use MTLGPUFamily instead of MTLGPUFeatureSet 2023-01-05 13:37:37 +09:00
Hajime Hoshi
cf76e3c646 internal/graphicsdriver/opengl: better place to reset uniform variables
Updates #2517
2023-01-04 01:36:04 +09:00
Hajime Hoshi
599be725b9 internal/graphicsdriver/metal: fix comments 2023-01-03 23:16:01 +09:00
Hajime Hoshi
7418576c16 internal/ui: re-enable skipping to render the final screen when possible
With Metal, nextDrawable could return immediately when a command buffer
is empty. To avoid high CPU usage, this change adds a slight sleep in
this case.

With DirectX, Present waits for a while even though nothing is updated,
then that's fine.

Updates #2341
Updates #2342
Updates #2520
2023-01-03 23:09:28 +09:00
Hajime Hoshi
edb952c9e7 internal/graphicsdriver/metal: add comments 2023-01-03 22:10:33 +09:00
Hajime Hoshi
365740aca9 internal/ui: update comments
Updates #2521
2023-01-03 21:39:34 +09:00
Hajime Hoshi
67c9d65d82 internal/ui: refactoring 2023-01-03 21:17:47 +09:00
Hajime Hoshi
0bdfeec610 internal/ui: use a separate render thread for Nintendo Switch
Updates #2512
2023-01-03 21:12:18 +09:00
Hajime Hoshi
312dce950c internal/ui: bug fix: compile failures with -tags=nintendosdk
Needed to use NativeDisplayType for eglGetDisplay.
2023-01-03 20:38:45 +09:00
Hajime Hoshi
6344273b7c internal/ui: bug fix: compile failures with -tags=nintendosdk 2023-01-03 20:29:05 +09:00
Hajime Hoshi
73985c6c96 internal/ui: bug fix: compile failures with -tags=nintendosdk 2023-01-03 20:12:36 +09:00
Hajime Hoshi
723a44a822 internal/ui: rename ebitengine_Init -> ebitengine_Initialize 2023-01-03 19:23:38 +09:00
Hajime Hoshi
0e0205b2d0 internal/ui: use -overlay to provide the implementation for Nintendo Switch
Closes #2372
2023-01-03 19:10:15 +09:00
Hajime Hoshi
edf35b02cb internal/graphicsdriver/opengl: record last uniform variables and reset them before swapping buffers
This is basically a revert of 6b4c696b31.
This change resets the last uniform variables before swapping
buffers.

Updates #2517
2023-01-03 03:13:46 +09:00
Hajime Hoshi
da97657afb Revert "internal/ui: refactoring: remove unnecessary hack for unfocusing"
This reverts commit 3f753b7086.

Reason: this was actually necessary.

Updates #982
Updates #987
Closes #2521
2023-01-03 02:06:55 +09:00
Hajime Hoshi
70bcec189d internal/ui: refactoring 2023-01-03 01:43:55 +09:00
Hajime Hoshi
e4b15faefe internal/ui: bug fix: wrong condition 2023-01-03 01:28:51 +09:00
Hajime Hoshi
bbc82ef2db internal/ui: skip rendering onto the final framebuffer only for OpenGL
This was reverted at a049acd94e but now
I've confirmed this is not problematic only with OpenGL.

Updates #2341
Updates #2342
2023-01-03 01:24:53 +09:00
Hajime Hoshi
6b4c696b31 internal/graphicsdriver/opengl: bug fix: needed always to set uniform variables
Before this fix, setting uniform variables could be skipped when the
values were the same. This caused some issues when a number of drawing
commands were much small than usual (e.g. SetScreenClearedEveryFrame
with false).

This change fixes this by not doing such optimization. Unfortunately
it was impossible to create a minimum reproducible unit test since
we cannot test the final screen framebuffer's states so far.

Closes #2517
2023-01-03 00:43:10 +09:00
Hajime Hoshi
a049acd94e internal/ui: disable the optimization to skip rendering offscreen
This caused some issues in various environments. Until we find a good
solution, let's disable this.

Updates #2341
Updates #2342
Closes #2518
2023-01-02 23:14:03 +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
b4d8519f97 internal/packing: remove unused functions 2023-01-02 18:21:21 +09:00
Hajime Hoshi
471237b701 internal/ui: bug fix: ignore ERROR_BUSY when deleting a GL context
Closes #2518
2023-01-02 15:05:16 +09:00
Hajime Hoshi
7018318546 internal/ui: bug fix: compile error on the testing CI 2023-01-01 18:01:14 +09:00
Hajime Hoshi
bba32bc06e internal/ui: refactoring 2023-01-01 17:45:20 +09:00
Hajime Hoshi
fd1a90411a internal/nintendosdk: refactoring 2023-01-01 17:36:27 +09:00
Hajime Hoshi
afbd1aebf1 internal/ui: use -overlay to provide the implementation for Nintendo Switch
Updates #2372
2023-01-01 01:35:05 +09:00
Hajime Hoshi
58692f6d85 internal/gamepad: refactoring 2023-01-01 00:58:42 +09:00
Hajime Hoshi
77f32bd088 internal/gamepad: use -overlay to provide the implementation for Nintendo Switch
Updates #2372
2022-12-31 18:08:28 +09:00
Hajime Hoshi
34941ca083 all: separate the rendering thread from the main thread
Updates #1704
Closes #2512
2022-12-30 22:57:34 +09:00
Hajime Hoshi
0fc21470e2 internal/ui: move some context-dependent processes to updateFrameImpl
This is a preparation to introduce an independent thread for rendering.

Updates #2512
2022-12-30 22:06:36 +09:00
Hajime Hoshi
b9fb4e9f50 internal/ui: remove an unnecessary hack for macOS
Now macOS always uses the native fullscreen even for a transparent
window, we no longer need a hack to call SwapBuffers explicitly.

Updates #1004
2022-12-30 16:25:05 +09:00
Hajime Hoshi
0a03df297b internal/ui: make it explicit to call swapBuffers only w/ OpenGL 2022-12-30 15:44:01 +09:00
Hajime Hoshi
0e137e8dd7 internal/ui: bug fix: compile error on mobiles 2022-12-30 15:44:01 +09:00
Hajime Hoshi
8902d95b2d internal/ui: remove unused function runOnAnotherThreadFromMainThread 2022-12-30 13:52:05 +09:00
Hajime Hoshi
e1992347b7 internal/graphicscommand: rename SetRenderingThread -> SetRenderThread 2022-12-30 13:51:32 +09:00
Hajime Hoshi
fa4916d063 internal/ui: refactoring 2022-12-30 13:28:00 +09:00
Hajime Hoshi
3f753b7086 internal/ui: refactoring: remove unnecessary hack for unfocusing
The sleeping for an unfocused state also happens in (*userInterfaceImpl).update().

Updates #982
Updates #987
2022-12-30 00:41:46 +09:00
Hajime Hoshi
7e7deeab22 internal/ui: bug fix: SetWindowIcon crashed in the single-thread mode
Updates #1468
Closes #2513
2022-12-30 00:01:11 +09:00
Hajime Hoshi
b597ed1e27 internal/ui: remove unnecessary swapBuffer call
This was introduced at 9e161864f6, the
background is now unclear. Things work even without this hack.

Updates #157
Updates #158
2022-12-29 21:48:37 +09:00
Hajime Hoshi
42c08698fb internal/ui: give up re-rendering on resizing the window
It seems difficult to implement this correctly as long as the rendering
thread is the same as the main thread.

Closes #2144
Updates #2512
2022-12-29 21:27:44 +09:00
Hajime Hoshi
dd853050e9 internal/ui: refactoring 2022-12-29 21:09:30 +09:00
Hajime Hoshi
4d89b5de07 internal/ui: refactoring 2022-12-29 20:47:32 +09:00
Hajime Hoshi
e5b9569142 internal/ui: bug fix: the env variable should be used only when the library is not specified
Updates #2378
2022-12-29 15:44:55 +09:00
Hajime Hoshi
8d020ad414 internal/graphicsdriver/metal: refactoring 2022-12-29 15:27:51 +09:00
Hajime Hoshi
5e17791e4e internal/ui: bug fix: an offscreen was broken with SetScreenClearedEveryFrame(false)
Updates #2500
Closes #2510
2022-12-29 14:57:07 +09:00
Hajime Hoshi
cba6905c57 internal/glfwwin: bug fix: MapVirtualKeyW is not defined on Xbox 2022-12-29 00:53:03 +09:00
Hajime Hoshi
0756be0b68 cmd/ebitenmobile: use an independent thread for rendering on iOS
Closes #2508
2022-12-28 23:37:13 +09:00