Hajime Hoshi
a16a03c9db
internal/ui: refactoring
2023-10-15 16:38:05 +09:00
Hajime Hoshi
a89aaa0756
internal/ui: refactoring: remove fpsMode from globalState
2023-10-15 16:19:41 +09:00
Hajime Hoshi
beabe9c6ee
internal/ui: bug fix: compile failure with -tags=nintendosdk
2023-10-15 03:58:29 +09:00
Hajime Hoshi
27fd10595b
internal/ui: refactoring: reduce global functions and prefer Get()
2023-10-15 03:40:48 +09:00
Hajime Hoshi
69f1fa5f29
internal/ui: unify the receivers for UI
2023-10-15 02:51:23 +09:00
Hajime Hoshi
77bdbac244
Revert "internal/ui: remove an unused function"
...
This reverts commit df3a1c3cdd
.
Reason: compile failure: UpdateInputFromEvent was used from textinput
2023-10-15 02:23:27 +09:00
Hajime Hoshi
df3a1c3cdd
internal/ui: remove an unused function
2023-10-15 01:32:39 +09:00
Hajime Hoshi
2a8d8d71fc
internal/ui: merge init functions
...
The Go specification doesn't determine the order of init functions.
In order to reduce unexpected behavior, merge some init functions.
2023-10-15 00:17:09 +09:00
Hajime Hoshi
567e2fa04c
ebiten: add BlendOperationMin
and BlendOperationMax
...
Closes #2395
2023-10-13 01:56:33 +09:00
Hajime Hoshi
7018e7dfb1
internal/ui: rename files
2023-10-11 02:03:58 +09:00
Hajime Hoshi
54c6c6b728
internal/glfw: bug fix: always use draw.Draw for any images
...
Closes #2807
2023-10-11 01:03:06 +09:00
Hajime Hoshi
1e5086fd5a
internal/buffered: bug fix: enable TestGC again
...
The logic should be called in a game's Update explicitly.
Updates #2805
Closes #2806
2023-10-10 03:06:09 +09:00
Hajime Hoshi
4701a61e4b
internal/buffered: skip a flaky test
...
Updates #2805
2023-10-10 02:22:12 +09:00
Hajime Hoshi
cc5174f104
internal/buffered: bug fix: images created in init() were not GCed
...
Closes #2805
2023-10-10 00:31:44 +09:00
Hajime Hoshi
738f13f73f
internal/ui: remove unnecessary build tags
2023-10-09 23:39:06 +09:00
Hajime Hoshi
f269b61903
internal/atlas: introduce a managed byte slice pool
...
A managed byte slice from the new byte slice pool has a function
to release and put it back to the pool explicitly, and this doesn't
rely on GCs.
Updates #1681
Closes #2804
2023-10-09 20:32:32 +09:00
Hajime Hoshi
34d577a5ff
Revert "internal/atlas: reintroduce a byte pool"
...
This reverts commit 7e17b25c56
.
Reason: the current byte pool suppresses allocations to some extent, but doesn't suppress GCs.
Updates #1681
2023-10-09 14:40:05 +09:00
Hajime Hoshi
7e17b25c56
internal/atlas: reintroduce a byte pool
...
The old byte pool depnded on lifetimes of command queues, and this
was tricky.
The new byte pool uses runtime.SetFinalizer so this should be much
easier to use.
Updates #1681
2023-10-09 03:28:29 +09:00
Hajime Hoshi
2405b7e825
internal/restorable: remove unnecessary copying
...
After 6e5361c328
, WritePixels can
expect that the given pixel byte slice is always new, and now can
be assumed immutable. Do not copy the slice for restoring.
Actually, these copying were introduced at 38ce46328a
in order to reuse the same slice regions.
2023-10-09 01:17:43 +09:00
Hajime Hoshi
6e5361c328
internal/restorable: use clearImage to avoid allocations
...
Bytes from a pool in a command queue is now pretty hard to use correctly
as the lifetime of a queue is not clear.
Remove the byte pools once. Let's reconsider pool usages later.
This change also removes imagesWithBuffers as this is no longer needed.
imagesWithBuffers was necessary to ensure all the bytes from the pool
of the command queue was used before the queue flushes the commands,
as the command queue cleared the pool after flushing. The lifetimes
were pretty ticky.
2023-10-09 00:42:58 +09:00
Hajime Hoshi
cc8cf688f4
internal/restorable: use clearImage to avoid allocations
2023-10-08 23:59:31 +09:00
Hajime Hoshi
e768e8ad40
internal/graphicscommand: refactoring: add commandqueue.go
2023-10-08 19:54:28 +09:00
Hajime Hoshi
9ed3c89594
internal/graphicscommand: remove an image from imageWithBuffers whenever possible
2023-10-08 19:43:58 +09:00
Hajime Hoshi
810b62f83e
internal/graphicscommand: introduce commandQueuePool and commandQueueManager
...
This removes the restriction of the number of command queues.
Updates #1704
2023-10-08 19:23:57 +09:00
Hajime Hoshi
d2dd62b6db
internal/graphicscommand: remove unnecessary references to drawTrianglesCommand
2023-10-08 17:18:16 +09:00
Hajime Hoshi
fd1083808c
internal/graphicscommand: switch the queue before flushing
...
This is a preparation to do something (e.g. handling inputs) during
being blocked by Flush.
Updates #1704
2023-10-08 16:10:07 +09:00
Hajime Hoshi
53525342b1
internal/graphicscommand: bug fix: Flush didn't return error when sync=false
2023-10-08 04:30:14 +09:00
Hajime Hoshi
cede5027d3
internal/glfw: merge internal/cglfw into internal/glfw
...
Closes #2703
2023-10-07 23:59:55 +09:00
Hajime Hoshi
ad0b61c022
internal/cglfw: fix errors to be close to internal/glfw
...
Updates #2703
2023-10-07 22:48:44 +09:00
Hajime Hoshi
6dc375f7a6
internal/cglfw: let Terminate return an error
...
This change also removes flushErrors, which is only for GLFW
debuggings.
2023-10-07 22:35:40 +09:00
Hajime Hoshi
7bcefa1035
internal/cglfw: remove acceptError
2023-10-07 22:14:34 +09:00
Hajime Hoshi
98dc59c89f
internal/cglfw: let functions return errors
...
Updates #2703
2023-10-07 20:28:03 +09:00
Hajime Hoshi
ee1c179c83
internal/cglfw: let functions return errors in native_linbsd.go
...
Updates #2703
2023-10-07 20:28:03 +09:00
Hajime Hoshi
6a5d46dc43
internal/cglfw: use stderr for logs
2023-10-07 20:28:03 +09:00
Hajime Hoshi
82bceba847
internal/cglfw: let functions return errors in native_darwin.go and glfw_unix.go
...
Updates #2703
2023-10-07 18:37:06 +09:00
Hajime Hoshi
cb023af4b6
internal/cglfw: use stderr instead of log
2023-10-07 18:36:20 +09:00
Hajime Hoshi
aef7b0dd38
internal/glfw: rename files
...
Updates #2703
2023-10-07 17:23:33 +09:00
Hajime Hoshi
a971e32ec1
internal/cglfw: rename files
...
Updates #2703
2023-10-07 17:13:28 +09:00
Hajime Hoshi
82f2319020
internal/hook: rename hooks -> hook
2023-10-06 13:58:00 +09:00
Hajime Hoshi
e7ad5c52fe
internal/glfw: merge internal/goglfw into internal/glfw
...
This also changes APIs in internal/glfw to return errors.
Updates #2703
2023-10-05 03:09:51 +09:00
Hajime Hoshi
ef1e495aba
internal/winver: fix a panic message
2023-10-05 01:25:09 +09:00
Hajime Hoshi
aa55953c11
internal/ui: replace (*userInterface).err with (*globalState).err
2023-10-05 00:45:04 +09:00
Hajime Hoshi
0af42e6620
internal/vettools: bug fix: vettool itself failed with vettool check
2023-10-04 12:56:14 +09:00
Hajime Hoshi
73524d8df5
.github/workflows: move vettools to internal to avoid a nested module
2023-10-04 12:16:32 +09:00
Hajime Hoshi
0e722669ef
internal/glfw: add const definitions
...
This is one of the steps to merge internal/glfw and internal/goglfw.
Updates #2703
2023-10-04 03:04:47 +09:00
Hajime Hoshi
84030a3f77
internal/ui: refactoring: remove unused functions
2023-10-04 02:54:55 +09:00
Hajime Hoshi
491b578866
ebiten: add KeyF13 to KeyF24
...
Closes #2801
2023-10-04 00:45:49 +09:00
Hajime Hoshi
33c51eeee4
internal/goglfw: remove files for macOS
...
Updates #2776
2023-10-03 22:44:38 +09:00
Hajime Hoshi
b2a6e79a5a
internal/graphicsdriver/opengl/gl: rename procaddr_others.go to procaddr_linbsd.go
2023-10-02 01:02:51 +09:00
Hajime Hoshi
386bda3c84
internal/graphicsdriver/opengl/gl: add do-not-edit comment
2023-10-02 00:21:53 +09:00
Hajime Hoshi
50508e1a8d
internal/thread: add comments
2023-10-02 00:06:41 +09:00
Hajime Hoshi
95b4eeafce
all: remove unnecessary build tag restrictions
2023-10-01 23:27:57 +09:00
Hajime Hoshi
8c7eb70635
internal/ui: bug fix: wrong monitor was detected on fullscreen
...
Updates #2225
Updates #2794
2023-09-30 13:41:12 +09:00
Hajime Hoshi
22118ba962
internal/ui: add a comment
...
Updates #2796
2023-09-30 02:55:04 +09:00
Hajime Hoshi
dce18d7c23
internal/ui: bug fix: SetWindowIcon(nil) didn't reset the window icon
...
Closes #2796
2023-09-30 02:46:40 +09:00
Hajime Hoshi
13dfb28a98
internal/ui: copy a slice at SetIconImages
...
This changes makes ebiten.SetIconImages a little safer.
2023-09-30 01:46:01 +09:00
Hajime Hoshi
7204ca86e3
internal/ui: refactoring: remove an unused member
2023-09-30 01:39:34 +09:00
Hajime Hoshi
aab22f4c1e
internal/ui: bug fix: use correct regions at (*monitors).monitorFromPosition
...
Updates #2781
2023-09-30 00:30:06 +09:00
Hajime Hoshi
2fbef2106d
internal/ui: refactoring
...
Updates #2781
2023-09-30 00:11:15 +09:00
Hajime Hoshi
03d6811a65
internal/ui: bug fix: initialMonitorByOS could return nil on macOS
...
initialMonitorByOS could return nil when a cursor was at an extreme
position like the bottom of the display. Apparently, a cursor position
could take an inclusive range of the monitor size.
This change fixes this issue by fixing the comparison.
Even if initialMonitorByOS returns nil, a fallback primary monitor
should be used, so this is not a critical issue.
Updates #2794
2023-09-29 16:54:47 +09:00
Hajime Hoshi
14a2c703df
internal/ui: fix wrong panic messages
2023-09-29 15:36:43 +09:00
Hajime Hoshi
91abfe2c10
internal/ui: bug fix: compilie error on Windows
...
Updates #2794
2023-09-29 12:54:41 +09:00
Hajime Hoshi
0bcee31a6f
internal/ui: bug fix: wrong monitor initialization on macOS
...
This change fixes these issues:
* `currentMouseLocation()` returned a position in the macOS native
coordinate. This means the Y axis is upward, while the Y axis is
downward in the GLFW coordinate. This change adjusts the Y position.
* `(*monitors).monitorFromGLFWMonitor` always returned nil at least
on macOS. This change replaces this with a new method
`(*monitors).primaryMonitor`.
Updates #807
Closes #2794
2023-09-29 12:36:28 +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
94bf6a4cc1
internal/shaderir: performance optimization by reducing slices
2023-09-28 01:56:51 +09:00
Hajime Hoshi
7cb64ccffe
internal/ui: refactoring
2023-09-28 01:01:58 +09:00
Hajime Hoshi
a65a45586f
internal/ui: bug fix: need nil check at dipFromGLFWMonitorPixel
...
Updates #1878
2023-09-25 18:42:23 +09:00
Hajime Hoshi
58d3655597
internal/ui: remove unnecessary receivers from methods
2023-09-24 19:45:55 +09:00
Hajime Hoshi
b32575b7b2
internal/ui: refactoring: add (*Monitor).deviceScaleFactor
2023-09-24 19:41:37 +09:00
Hajime Hoshi
0e23045b90
internal/ui: refactoring: add (*monitors).monitorFromPosition
2023-09-24 19:41:28 +09:00
Hajime Hoshi
fab08bac92
internal/ui: use RLock/RUnlock whenever possible
2023-09-24 19:27:22 +09:00
Hajime Hoshi
4fb27adb9d
internal/ui: remove an old comment
...
Now Ebitengine allows to specify the initial monitor, having an
initial monitor is no longer a hack.
Updates #1575
Updates #1835
2023-09-24 19:24:23 +09:00
Hajime Hoshi
b5d0dc3686
internal/ui: change the initial window position adjustment
...
The window position should be posible if possible.
2023-09-24 19:07:21 +09:00
Hajime Hoshi
a23efac01c
internal/ui: refactoring: reduce member variables
2023-09-24 19:05:56 +09:00
Hajime Hoshi
c16bd1e249
internal/ui: refactoring: unify duplicated logics to initialize the window size and position
2023-09-24 18:55:45 +09:00
Hajime Hoshi
b95228a8a6
all: rename arguments in Kage
...
Closes #2767
2023-09-24 16:46:36 +09:00
Hajime Hoshi
915ed48f7a
internal/graphicsdriver/metal/mtl: bug fix: fail to resolve Metal.framework path with Xcode 15
...
Updates #2732
Closes #2784
2023-09-24 16:15:54 +09:00
Hajime Hoshi
c7d1d28582
internal/ui: move impls for device scale to internal/ui for desktops
...
This enables to remove restrictions for some functions to be called
from the main thread.
Updates #2423
2023-09-24 15:44:41 +09:00
Hajime Hoshi
458a415131
internal/ui: move impls for device scale to internal/ui for mobiles
2023-09-24 15:29:14 +09:00
Hajime Hoshi
b243dc0649
internal/devicescale: bug fix: this package cannot be compiled with GOOS=js
2023-09-24 03:35:54 +09:00
Hajime Hoshi
506a1de259
internal/ui: refactoring: move device-scale implementation to internal/ui for browsers
...
The returned value from internal/devicescale.At never changes for
browsers, so the detection of devicePixelRatio updates didn't work
in the first place. Also, there is not a good way to detect the
change [1].
This change moves the logic from internal/devicescale to internal/ui.
We aim to merge these packages as a device scale factor belongs to
a monitor and internal/ui manages monitors.
[1] https://crbug.com/123694
2023-09-24 03:19:31 +09:00
Hajime Hoshi
5d5e3c7c0b
internal/ui: refactoring: replace *glfw.Monitor with *Monitor
2023-09-24 02:39:53 +09:00
Hajime Hoshi
f72b8a4ced
internal/ui: refactoring: remove redundant Monitor members
2023-09-24 01:58:07 +09:00
Hajime Hoshi
121d6005cd
internal/ui: remove (*Monitor).Bounds
...
Updates #2780
2023-09-24 01:46:14 +09:00
Hajime Hoshi
01e2c92e56
internal/ui: remove unnecessary code
...
This was an old code when Ebitengine created a dummy invisible
window before creating the main window.
2023-09-24 01:42:39 +09:00
Hajime Hoshi
69e3a2b974
internal/ui: refactoring: (*monitors).update must be called from the main thread
...
In the current implementation, (*monitors).update is not called
from other threads, but the current code is fragile.
2023-09-24 01:37:11 +09:00
Hajime Hoshi
7664647ad1
internal/ui: bug fix: needed to wait before entering into fullscreen
...
Just after moving a window to another monitor, waiting a little while
was required before entering into fullscreen.
Closes #2778
2023-09-23 19:02:36 +09:00
Hajime Hoshi
4ef98b3ea9
internal/ui: bug fix: wrong calculation of the initial window position
...
Updates #2778
2023-09-23 18:51:58 +09:00
Hajime Hoshi
b3058b68a0
ebiten: change the unit of (*Monitor).Bounds
...
Monitors can have different device scale factors, and in this case,
it doesn't make sense to use device-independent pixels as unit for
monitor positions and sizes.
Updates #2778
2023-09-23 17:58:23 +09:00
Hajime Hoshi
d736a8cff7
internal/ui: bug fix: GetVideoMode must not be called from othere threads
...
Now setInitMonitor can be called from any other threads than the main
thread. Do not call this.
This change fixes the issue by using *Monitor instead of *glfw.Monitor.
2023-09-23 17:30:18 +09:00
Hajime Hoshi
e0cd031aea
internal/ui: bug fix: replace initWindowMonitor usages with initMonitor
...
There were two similar member variables internalWindowMonitor and
initMonitor, and when SetMonitor is called, probably there were
some inconsitency between them.
This change fixes the issue by not using initWindowMonitor.
Closes #2779
2023-09-23 17:17:38 +09:00
Hajime Hoshi
2702c6b228
internal/processtest: suppress issue2475 test for Windows
...
The result seems flaky unfortunately.
2023-09-23 00:18:41 +09:00
Hajime Hoshi
0e27a8a30b
internal/shader: bug fix: spaces around a compiler directive should be allowed
...
Closes #2771
2023-09-22 01:45:11 +09:00
Hajime Hoshi
2f835a0ee2
internal/graphics: fix wrong comments
2023-09-21 01:59:20 +09:00
Hajime Hoshi
20ef839e03
all: rename arguments in Fragment
...
Updates #2767
2023-09-21 01:35:57 +09:00
Hajime Hoshi
2c8a2a584f
internal/gamepaddb: update the database
...
This adopts the commit e72ff9cb76
Closes #2766
2023-09-18 21:20:10 +09:00
Hajime Hoshi
0dcfa5f54b
Revert "internal/gamepaddb: update the database"
...
This reverts commit 4375fffcbe
.
Reason: test failures
2023-09-18 19:23:45 +09:00
Hajime Hoshi
4375fffcbe
internal/gamepaddb: update the database
...
This adopts the commit 8adb15e0a2
2023-09-18 19:07:01 +09:00
Hajime Hoshi
14f2ee198e
ebiten: add SetWindowMousePassthrough and IsWindowMousePassthrough
...
Closes #2511
2023-09-18 18:31:22 +09:00
Hajime Hoshi
c8d38f7f25
internal/glfw, interna/cglfw, internal/goglfw: add MousePassthrough
...
Work in progress
Updates #2511
2023-09-18 18:31:22 +09:00
Hajime Hoshi
777c575638
internal/goglfw: typo
...
Fortunately, this function is actually not called.
2023-09-18 18:30:43 +09:00
Hajime Hoshi
6f41a05264
Revert "internal/graphicsdriver/directx: remove tearing"
...
This reverts commit 78d3e4273b
.
Reason: tearing is potentially risky but needed for maximizing FPS.
Also, tearing is officially recommended by Microsoft (see [1])
Closes #2697
[1] https://github.com/microsoft/DirectX-Graphics-Samples/blob/master/Samples/Desktop/D3D12Raytracing/src/D3D12RaytracingHelloWorld/DeviceResources.cpp#L520
2023-09-18 03:30:34 +09:00
Hajime Hoshi
8a0aba45f5
internal/ui: update touches after the layout is determined on mobiles
...
Closes #2763
2023-09-17 21:56:26 +09:00
Hajime Hoshi
07d2706e63
internal/processtest: bug fix: allow some numerical errors for cursor positions
...
Updates #2475
2023-09-17 19:58:30 +09:00
Hajime Hoshi
fd689467c5
internal/processtest: add a test for capturing cursor and fullscreen
...
Updates #2475
2023-09-17 19:41:56 +09:00
Hajime Hoshi
02fd8cfb07
internal/ui: bug fix: preserve a captured cursor positions for toggling fullscreening for browsers
...
Closes #2475
2023-09-17 18:38:00 +09:00
Hajime Hoshi
a5aa721bda
internal/ui: update mouse and touch cursors after the layout is determined on browsers
...
Updates #2763
2023-09-17 16:30:47 +09:00
Hajime Hoshi
6ab509f221
internal/ui: reland: bug fix: preserve cursor positions for toggling fullscreening for desktops
...
Updates #2475
2023-09-17 15:54:39 +09:00
Hajime Hoshi
9d73e45677
Revert "internal/ui: bug fix: preserve cursor positions for toggling fullscreening for desktops"
...
This reverts commit 7ed4db90be
.
Reason: compile error on Windows
2023-09-17 15:43:38 +09:00
Hajime Hoshi
7ed4db90be
internal/ui: bug fix: preserve cursor positions for toggling fullscreening for desktops
...
Updates #2475
2023-09-17 15:26:08 +09:00
Hajime Hoshi
7becaa19e6
internal/ui: bug fix: native APIs must be called from the main thread
...
Updates #2763
2023-09-17 15:14:57 +09:00
Hajime Hoshi
0475baf9e2
internal/ui: update comments
...
Updates #2763
2023-09-17 14:59:43 +09:00
Hajime Hoshi
8c25b07336
internal/ui: call updateInputState after layoutGame
...
The cursor position is affected by the current layout. Then, input
states should be updated after layoutGame is called.
Updates #2763
2023-09-17 14:58:32 +09:00
Hajime Hoshi
a62b8a00e7
internal/ui: use float64 for cursor positions internally
2023-09-17 03:43:18 +09:00
Hajime Hoshi
226497a8a9
internal/cglfw: bug fix: Motif hints should be updated for functions and decorations at the same time
...
Updates #2289
Closes #2760
2023-09-17 00:40:17 +09:00
Hajime Hoshi
90ee615e00
internal/cglfw: disable a maximizing button when a max window size is specified
...
Closes #2289
2023-09-16 23:41:19 +09:00
Hajime Hoshi
7698ec0665
internal/cglfw: rename a file
...
Updates #2759
2023-09-16 23:17:17 +09:00
Hajime Hoshi
2737bd6d04
internal/cglfw: drop a native Wayland support
...
Closes #2759
2023-09-16 21:46:24 +09:00
Hajime Hoshi
45acc2c5d8
internal/ui: reland: bug fix: disable window size limitation on fullscreen
...
Closes #2260
2023-09-16 16:49:49 +09:00
Hajime Hoshi
40fc96d78c
internal/ui: forbid a green button when a max window size limit is specified
...
Updates #2260
2023-09-16 16:40:03 +09:00
Hajime Hoshi
128215eedd
Revert "internal/ui: bug fix: disable window size limitation on fullscreen"
...
This reverts commit 9a5ef1b553
.
Reason: we should disable the green button instead
Updates #2260
2023-09-16 03:23:34 +09:00
Hajime Hoshi
657e4c2541
internal/ui: update a comment
...
Closes #2240
2023-09-16 03:12:37 +09:00
Hajime Hoshi
619436a47b
internal/ui: refactoring: add monitor_glfw.go
2023-09-16 00:16:00 +09:00
Hajime Hoshi
dd2768d5f3
internal/ui: bug fix: introduce locks for monitors
...
Updates #1853
2023-09-15 03:59:13 +09:00
Hajime Hoshi
32bd565df9
internal/ui: bug fix: setWindowMonitor was processed even when the same monitor was specified
...
Updates #1835
2023-09-15 03:30:15 +09:00
Hajime Hoshi
b710ff17c8
internal/ui: bug fix: wait for a while after exiting fullscreen on macOS
...
Closes #2758
2023-09-15 03:19:37 +09:00
Hajime Hoshi
90accfba1e
internal/ui: bug fix: do not call PollEvents on Windows and Linux
...
Updates #2296
2023-09-15 03:11:58 +09:00
Hajime Hoshi
568e98ef1c
internal/ui: bug fix: call setOrigWindowPos on entering fullscreen
...
Closes #2757
2023-09-15 02:53:38 +09:00
Hajime Hoshi
f7a801d591
internal/ui: refactoring
2023-09-15 02:45:31 +09:00
Hajime Hoshi
9a5ef1b553
internal/ui: bug fix: disable window size limitation on fullscreen
...
Closes #2260
2023-09-15 02:19:20 +09:00
Hajime Hoshi
0e19cd10be
internal/shader: add type checks for a bitwise operator + assignment
...
Closes #2754
2023-09-13 04:17:46 +09:00
Hajime Hoshi
1f67518319
internal/shader: clean up tests
2023-09-13 03:57:20 +09:00
Hajime Hoshi
320cec8869
internal/shaderir: refactoring
2023-09-13 03:25:42 +09:00
Hajime Hoshi
19413c2805
internal/shader: refactoring: move type deduction to shaderir package
...
Updates #2754
2023-09-13 00:18:47 +09:00
Hajime Hoshi
5e30e1ee1d
internal/shader: refactoring
2023-09-12 03:27:30 +09:00
Hajime Hoshi
73e4423fe7
internal/shader: bug fix: bitwise operators with assignment didn't work
...
Closes #2752
Updates #2754
2023-09-12 03:15:28 +09:00
Hajime Hoshi
c13980158f
internal/shader: add type checks for bitwise operators
...
Updates #2754
2023-09-12 02:40:42 +09:00
Hajime Hoshi
41c7852c7d
internal/ui: sort selectors in alphabetical order
2023-09-11 02:15:42 +09:00
TotallyGamerJet
5dc293fe4f
internal/ui: use new OBJC API ( #2750 )
...
Updates #1162
2023-09-11 02:05:42 +09:00
Hajime Hoshi
55bfc02509
internal/processtest: use (*testing.T).TempDir
2023-09-06 11:37:27 +09:00
Hajime Hoshi
20ddfba983
internal/shader: bug fix: error in assinments to multiple variables
...
Closes #2747
2023-09-04 02:21:45 +09:00
Hajime Hoshi
1bbded8653
internal/shader: bug fix: wrong local variable index was used for assignments
...
Closes #2655
2023-09-04 01:23:03 +09:00
Hajime Hoshi
f82114e8eb
internal/shader: add parseFor
...
Updates #1897
2023-09-03 17:15:39 +09:00
Hajime Hoshi
f30a58a393
internal/ui: bug fix: disable global functions after the game termination
...
Closes #2743
2023-09-02 15:38:41 +09:00
Hajime Hoshi
6e968558b1
internal/ui: bug fix: setRunning(true) must be called after the main thread is set
...
Some functions like ebiten.SetCursorMode use `running` to detect
whether the game starts or not. If the game starts, the main thread
must exist, but there was a timing when `running` was true but the
main thread didn't exist.
This change fixes this issue by changing the timing to call
`setRunning(true)` after the main thread initialization and before
`initOnMainThread`. `initOnMainThread` assumes that `running` is
true.
Closes #2742
2023-09-02 04:24:51 +09:00
Hajime Hoshi
d9757138a7
internal/restorable: use clearImage to clear a region
...
This is an improvement for https://github.com/hajimehoshi/ebiten/issues/2676#issuecomment-1650325027
Updates #2676
2023-08-31 23:32:54 +09:00
Hajime Hoshi
e082ea73dc
internal/restorable: reuse empty byte slices for ClearPixels
...
This is an improvement for https://github.com/hajimehoshi/ebiten/issues/2676#issuecomment-1650325027
Updates #2676
2023-08-31 23:02:40 +09:00
Hajime Hoshi
7ed2d73406
internal/builtinshader: bug fix: wrong blending rate
...
The blending rate of colors in a square vertices should be calculated
by the lower-right point, not the upper-left point.
mix(a, b, rate) function calculates (1-rate)*a + rate*b, so a should
be weighted if rate is close to 0, and b should be weighted if rate
is close to 1. The current implementation was opposite.
Rendering results don't seem to be changed so much actually, but the
current implementation doesn't make sense.
2023-08-31 15:11:37 +09:00
Hajime Hoshi
009fb504ed
internal/builtinshader: remove adjustments for tie-breaking
...
This seems no longer needed with the pixel mode.
This was confirmed by this test:
```
go run . -run=TestImageLinearFilterGlitch2
```
The same change didn't work at b5ca404c42
but worked at 49582519c1
, which
introduced the pixel mode.
Updates #1212
2023-08-30 23:55:44 +09:00
Ketchetwahmeegwun T. Southall
60b7de6a3c
ebiten: add APIs to treat monitors ( #2597 )
...
This change adds these APIs:
* `type MonitorType`
* `func (*MonitorType) Bounds() image.Rectangle`
* `func (*MonitorType) Name() string`
* `func Monitor() *MonitorType`
* `func SetMonitor(*MonitorType)`
* `func AppendMonitors([]*MonitorType) []*MonitorType`
Closes #1835
2023-08-30 21:02:04 +09:00
Hajime Hoshi
98ead195c6
audio: bug fix: deadlock between a player and a context
...
Closes #2737
2023-08-29 14:52:48 +09:00
Hajime Hoshi
1269315f75
internal/shader: bug fix: forbid duplicated uniform variables
...
Closes #2648
2023-08-29 00:43:10 +09:00
Hajime Hoshi
446a6dc952
internal/graphics: deprecated some built-in functions
...
Updates #1870
2023-08-29 00:06:54 +09:00
Hajime Hoshi
db34930ae8
internal/graphics: add built-in Kage functions
...
This change adds these Kage functions:
* imageDstOrigin
* imageDstSrc
* imageSrcNOrigin
* imageSrcNSrc
and deprecates these functions:
* imageDstRegionOnTexture
* imageSrcRegionOnTexture
Closes #1870
2023-08-28 15:06:45 +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
dec08b9e4e
all: bug fix: relative paths for dlopen didn't work on macOS Sonoma
...
Closes #2732
2023-08-26 14:52:52 +09:00
Hajime Hoshi
592d6c57b7
internal/graphicsdriver/metal: improve an error message for Metal initialization
...
Updates #2732
2023-08-26 12:43:16 +09:00
Hajime Hoshi
4116fd3eb4
internal/debug: bug fix: add SwitchLogger to dump logs for each frame correctly
...
Closes #2731
2023-08-26 03:38:37 +09:00
Hajime Hoshi
b29fc5672c
internal/graphicscommand: use bufio to make dumping images faster
2023-08-26 00:50:45 +09:00
Hajime Hoshi
fd5e2d39c0
internal/graphics: add uniform variables for source image sizes
...
Updates #1870
2023-08-25 07:30:52 +09:00
Hajime Hoshi
a9b2f5f9ca
Revert "ebiten: panic if a non-existent uniform variable name is given"
...
This reverts commit 1b8580fab7
.
Reason: some existing applications don't work with this fix.
Updates #2710
2023-08-24 14:15:19 +09:00
Hajime Hoshi
3493358fd2
internal/graphics: use the terms 'image' and 'texture' appropriately
2023-08-24 02:36:51 +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
2de64088dc
internal/graphicscommand: reduce boundary checks
...
This can be confirmed by this command:
```
go build -gcflags="-d=ssa/check_bce" ./internal/graphicscommand/
```
Updates #2601
2023-08-21 03:15:31 +09:00
Hajime Hoshi
c00795416a
internal/graphicscommand: remove a redundant boundary check
...
The boundary is already checked the above 'copy' call. This can be
confirmed by the result of this command.
```
go build -gcflags="-d=ssa/check_bce" ./internal/graphicscommand/
```
2023-08-20 15:45:19 +09:00
Hajime Hoshi
407d7bd43f
internal/graphics: optimization: remove boundary checks
...
Before:
```
$ go build -gcflags="-d=ssa/check_bce" ./internal/graphics
internal/graphics/vertex.go:83:9: Found IsSliceInBounds
internal/graphics/vertex.go:85:5: Found IsInBounds
internal/graphics/vertex.go:86:5: Found IsInBounds
...
```
After:
```
$ go build -gcflags="-d=ssa/check_bce" ./internal/graphics
internal/graphics/vertex.go:83:11: Found IsSliceInBounds
internal/graphics/shader.go:134:37: Found IsSliceInBounds
```
Updates #2601
2023-08-20 15:38:07 +09:00
Hajime Hoshi
d9797423e5
ebiten, internal/builtinshader: use an array instead of a map
...
runtime.mapaccess2 is one of heavy function calls.
Updates #2601
2023-08-20 05:20:52 +09:00
Hajime Hoshi
10c9f489ce
internal/devicescale: use a slice instead of a map
...
runtime.mapaccess2 is one of heavy function calls.
Updates #2601
2023-08-20 05:00:46 +09:00
Hajime Hoshi
4f2327536c
internal/shaderir: improve FilterUniformVariables
...
```
name old time/op new time/op delta
Filter-8 31.7ns ± 1% 29.9ns ± 1% -5.60% (p=0.000 n=9+10)
```
Updates #2601
2023-08-20 03:21:46 +09:00
Hajime Hoshi
3b67b91bb2
internal/graphicscommand: remove redundant buffers
...
Now there are two command queues, uint32sBuffer doesn't have to have
two buffers.
2023-08-19 17:15:48 +09:00
Hajime Hoshi
fcec771f34
internal/graphicscommand: clear uniform variables explicitly
...
This change is a performance optimization.
(*uint32sBuffer).alloc doesn't clear the uniform values. Without
clearing the values explicitly, CanMergeWithDrawTrianglesCommand
might return false even though two commands can be merged.
2023-08-19 16:19:14 +09:00
Hajime Hoshi
a9d9143d90
internal/atlas: replace a map with a set with a slice
...
Updates #2601
2023-08-19 15:08:49 +09:00
Hajime Hoshi
3b2251a858
internal/atlas: refactoring: improve a comment
2023-08-19 05:24:20 +09:00
Hajime Hoshi
be68f50f96
internal/atlas: refactoring: rename a variable
2023-08-19 05:20:39 +09:00
Hajime Hoshi
3c49f81b5c
internal/atlas: replace a global map with a member
...
This should be a pure performance improvement.
Updates #2601
2023-08-19 05:02:35 +09:00
Hajime Hoshi
32f1436576
internal/atlas: refactoring: remove (probably) unnecessary logics
2023-08-19 04:36:40 +09:00
Hajime Hoshi
1e2a4cb4b1
internal/atlas: refactoring: remove unnecessary logics
...
Updates #2601
2023-08-19 04:06:43 +09:00
Hajime Hoshi
e1041ea20e
internal/atlas: replace a global map with a struct member
...
This should be a pure performance improvement.
Updates #2586
Updates #2601
2023-08-19 03:25:17 +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
ea1f596cda
internal/atlas: bug fix: possible overflowing on 32bit machines
2023-08-19 01:19:15 +09:00
Hajime Hoshi
e270dea460
internal/graphicsdriver: use []PixelsArgs for ReadPixels
...
Closes #2592
2023-08-17 03:06:48 +09:00
Hajime Hoshi
842c3cbfcd
internal/graphicscommand: use a slice to values instead of pointers
...
This should reduce heap allocations.
2023-08-16 23:23:30 +09:00
Hajime Hoshi
377b0b8502
internal/graphicscommand: rename WritePixelsArgs -> PixelsArgs
...
Updates #2592
2023-08-16 22:34:56 +09:00
Hajime Hoshi
2de54c556b
internal/shader: bug fix: wrong for-loop should fail compilation
...
Closes #2680
2023-08-08 23:38:01 +09:00
Hajime Hoshi
98cb77d94f
internal/atlas: refactoring
2023-08-06 16:03:57 +09:00
Hajime Hoshi
32ed22f91c
internal/atlas: refactoring
2023-08-06 15:59:15 +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
dcc8794883
Revert "internal/atlas: clarify the logic when to update usedAsDestination"
...
This reverts commit 2c9f5d9dad
.
Reason: test failures
2023-08-06 15:25:55 +09:00
Hajime Hoshi
2c9f5d9dad
internal/atlas: clarify the logic when to update usedAsDestination
...
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:23:19 +09:00
Hajime Hoshi
a50d9e6291
internal/atlas: check overflows
2023-08-06 13:46:41 +09:00
Hajime Hoshi
1ae5e022b6
internal/atlas: change when to count up usedAsDestinationCount
...
An image has a counter to count how many times an image is used.
Before this change, the counter was updated only when an image was moved
from a source backend to a destination backend. This seemed not enough,
and an image was likely moved to a source backend more often than
necessary (#2676 ).
However, there was also an issue that the counter was updated too
aggressively and the image was unlikely moved from a destination to
a source image (#2586 ).
In order to resolve this dilemma, let's adopt an intermediate way:
count up the counter at most once per frame.
Updates #2586
Updates #2676
2023-08-06 13:27:28 +09:00
Hajime Hoshi
6fa8c02d4a
internal/shader: bug fix: div between a matrix and a flaot failed
...
Closes #2719
2023-08-05 02:12:39 +09:00
Hajime Hoshi
d9acc57997
internal/goglfw: fix copyright texts
...
This change updates the copyright comment to respect the original
GLFW source comments.
2023-08-04 01:17:23 +09:00
Hajime Hoshi
56f37ed42b
internal/cglfw: change the license to Apache-2.0
...
Closes #2695
2023-08-04 01:09:48 +09:00
Hajime Hoshi
4158e206e6
internal/graphicsdriver/metal: rename files
2023-08-03 23:54:48 +09:00
Hajime Hoshi
120366c3ac
internal/cglfw: change the license of *.go files to Apache-2.0
...
Updates #2695
2023-08-03 23:52:53 +09:00
Hajime Hoshi
3dd2f15b64
internal/cglfw: remove GLFW_C_REVISION.txt
...
The source in internal/cglfw is no longer the same as the original one.
2023-08-02 02:02:30 +09:00
Hajime Hoshi
b2be456af8
internal/goglfw: change the license to Apache-2.0
...
Updates #2695
2023-08-01 23:57:05 +09:00
Hajime Hoshi
d410d740a3
internal/graphicsdriver/opengl/gl: change the license of default_cgo* to Apache-2.0
...
Updates #2695
2023-08-01 23:45:43 +09:00
Hajime Hoshi
d8630f940d
internal/shader: bug fix: forbide comparing non-scalar values
...
Closes #2718
2023-08-01 12:32:16 +09:00
Hajime Hoshi
63df6168d9
internal/shader: use plural forms for Kage compiler directives
...
This change renames
```
//kage:unit texel
//kage:unit pixel
```
to
```
//kage:unit texels
//kage:unit pixels
```
.
Closes #2717
2023-08-01 11:41:38 +09:00
Hajime Hoshi
ae9781cd53
internal/graphicscommand: add comments
2023-08-01 00:18:12 +09:00
Hajime Hoshi
ce25583438
internal/atlas: refactoring: move temporaryBytes to internal/graphicscommand
2023-08-01 00:11:40 +09:00
Hajime Hoshi
0fb1cdcfbd
internal/atlas: bug fix: there should be multiple temporaryBytes objects for pipelining
...
Closes #2716
2023-07-31 16:18:17 +09:00
Hajime Hoshi
f81dbd9288
internal/graphicsdriver: flush commands asynchronously whenever possible
...
Closes #2664
2023-07-30 22:44:13 +09:00
Hajime Hoshi
a7e4665f71
internal/graphicscommand: use multiple command queues
...
This is a preparation for asynchronous rendering.
Updates #2664
2023-07-30 22:42:58 +09:00
Hajime Hoshi
5a64f8299e
internal/thread: refactoring: add a common interface Thread
2023-07-30 22:42:24 +09:00
Hajime Hoshi
81b7fd7641
internal/graphicscommand: refactoring
2023-07-30 18:37:18 +09:00
Hajime Hoshi
d13bea29dc
internal/ui: refactoring
2023-07-30 03:52:54 +09:00
Hajime Hoshi
3869e2e4f6
internal/ui: refactoring: integrate the render thread usages into internal/graphicscommand
...
Updates #2664
2023-07-30 03:50:49 +09:00
Hajime Hoshi
246bd41695
internal/graphicscommand: fix a wrong comment
2023-07-30 01:56:58 +09:00
Hajime Hoshi
4df647a400
internal/shader: bug fix: forbid to have an initial value for uniform variables
...
Closes #2711
2023-07-29 20:51:02 +09:00
Hajime Hoshi
1b8580fab7
ebiten: panic if a non-existent uniform variable name is given
...
Closes #2710
2023-07-29 20:24:42 +09:00
Hajime Hoshi
0b1c7404d5
ebiten: use zero values for an unspecified uniform variable
...
Closes #2709
2023-07-29 19:11:49 +09:00
Hajime Hoshi
d0e4023d88
internal/ui: add a length check for uniform variables
2023-07-29 18:59:36 +09:00
Hajime Hoshi
5ddf1df423
internal/shaderir: remove ConstType
...
Closes #2550
2023-07-29 15:34:30 +09:00
Hajime Hoshi
7549f4fcd6
internal/shader: reduce ConstType usages
...
Updates #2550
2023-07-29 14:18:32 +09:00
Hajime Hoshi
e225f118fb
internal/shaderir: use ConstType just for an assetion
...
Updates #2550
2023-07-29 14:02:26 +09:00
Hajime Hoshi
900b687f40
internal/shader: add tests
...
Updates #2712
2023-07-28 01:59:31 +09:00
Hajime Hoshi
692d119818
internal/shader: refactoring: reduce ConstType usages
...
Updates #2550
2023-07-28 01:36:15 +09:00
Hajime Hoshi
88be4c5b7c
internal/shader: reland: bug fix: stricter type checks for the built-in cast-like functions
...
Closes #2712
2023-07-28 01:33:27 +09:00
Hajime Hoshi
be2123f7fd
Revert "internal/shader: bug fix: stricter type checks for the built-in functions"
...
This reverts commit 287545b02a
.
Reason: test failures
Updates #2712
2023-07-28 00:54:36 +09:00
Hajime Hoshi
287545b02a
internal/shader: bug fix: stricter type checks for the built-in functions
...
Closes #2712
2023-07-28 00:51:42 +09:00
Hajime Hoshi
ef08873f30
internal/shader: reland2: bug fix: int + ivec failed
...
Closes #2707
2023-07-26 01:23:02 +09:00
Hajime Hoshi
8aefa49510
Revert "internal/shader: reland: bug fix: int + ivec failed"
...
This reverts commit 1c4a0ac0dc
.
Reason: TestShaderUniformMatrix2 failed on Windows
Updates #2707
2023-07-26 00:30:17 +09:00
Hajime Hoshi
1c4a0ac0dc
internal/shader: reland: bug fix: int + ivec failed
...
Closes #2707
2023-07-25 23:02:06 +09:00
Hajime Hoshi
3d8d759976
Revert "internal/shader: bug fix: int + ivec failed"
...
This reverts commit a93908503a
.
Reason: test failures at TestShaderUniformMatrix2
Updates #2070
2023-07-25 22:53:02 +09:00
Hajime Hoshi
a93908503a
internal/shader: bug fix: int + ivec failed
...
Closes #2707
2023-07-25 22:42:06 +09:00
Hajime Hoshi
ad63d0842c
internal/shader: refactoring: check dimensions at AreValidTypesForBinaryOp
2023-07-25 13:46:44 +09:00
Hajime Hoshi
6b94de4ef6
internal/shader: refactoring: integrate type checks to shaderir.AreValidTypesForBinaryOp
2023-07-25 02:51:25 +09:00
Hajime Hoshi
b743b7ab50
internal/shader: bug fix: return true
for float must fail
...
Closes #2706
2023-07-25 02:51:18 +09:00
Hajime Hoshi
29545906c0
internal/shader: refactoring
2023-07-25 01:40:47 +09:00
Hajime Hoshi
c329eab1b2
internal/shader: refactoring
2023-07-24 12:29:27 +09:00
Hajime Hoshi
20123e8420
internal/shader: bug fix: unary operators should keep the type info
...
Closes #2705
2023-07-24 02:21:42 +09:00
Hajime Hoshi
5a1109e56a
internal/shader: refactoring
2023-07-24 02:06:54 +09:00
Hajime Hoshi
0657e67cef
internal/shader: add more tests for % op
2023-07-24 02:00:00 +09:00
Hajime Hoshi
d99da81203
internal/shader: refactoring
2023-07-24 01:49:37 +09:00
Hajime Hoshi
a8c3eb7167
internal/shader: bug fix: don't allow a binary op with different typed constants
...
Closes #2704
2023-07-24 01:41:22 +09:00
Hajime Hoshi
9ffbc51607
internal/shader: remove ConstType usages from canApplyBinaryOp
...
Updates #2550
2023-07-23 14:55:15 +09:00
Hajime Hoshi
94d1df8c7d
internal/shader: simplify canBeFloatImplicitly
...
Updates #2550
2023-07-23 14:06:18 +09:00
Hajime Hoshi
12e60b7273
internal/shader: reduce shaderir.ConstType usages
...
Updates #2550
2023-07-23 13:08:08 +09:00
Hajime Hoshi
a5af8f3b0b
internal/shaderir: remove isUntypedInteger
...
Updates #2550
2023-07-23 13:04:25 +09:00
Hajime Hoshi
8b4c744ca8
internal/ui: rename a file
...
Use `_linbsd.go` suffix for Linux and BSDs.
2023-07-23 02:29:57 +09:00
Hajime Hoshi
91e1c0ea29
ebiten: add more cursor shapes
...
This change adds these new cursor shapes:
* CursorShapeNESWResize
* CursorShapeNWSEResize
* CursorShapeMove
* CursorShapeNotAllowed
Closes #2476
2023-07-23 00:49:45 +09:00
Hajime Hoshi
269b557e38
internal/glfw: rename files
...
Updates #1162
2023-07-22 18:15:46 +09:00
Hajime Hoshi
3d41e8171e
internal/cglfw: refactoring: split build.go into each platform
2023-07-22 17:37:48 +09:00
Hajime Hoshi
47dea6fac4
move internal/glfw/glfw to internal/cglfw
2023-07-22 01:02:55 +09:00
Hajime Hoshi
c85c5b1884
internal/glfw: move Wayland files
2023-07-21 01:59:40 +09:00
Hajime Hoshi
0324db5657
internal/glfw/glfw: remove -l options
...
DLLs for OpenGL are loaded automatically and doesn't have to link them
when compiling.
DLLs for Vulkan are not used.
2023-07-21 01:09:25 +09:00
Hajime Hoshi
65bbfad84a
internal/glfw/glfw: remove null_platform.h
2023-07-21 01:04:08 +09:00
Hajime Hoshi
214f6094f8
internal/glfw/glfw: move osmesa_context.h
2023-07-21 00:09:17 +09:00
Hajime Hoshi
f6e5d2eca6
internal/glfw/glfw: remove unnecessary files
2023-07-21 00:03:26 +09:00
Hajime Hoshi
bccb33236f
internal/glfw/glfw: move xkb_unicode.* and X11 files
2023-07-20 23:37:44 +09:00
Hajime Hoshi
e10c5f5c59
internal/glfw/glfw: move and remove null_* files
2023-07-15 12:57:15 +09:00
Hajime Hoshi
31bad92c23
internal/glfw/glfw: move cocoa_* and nsgl_* files
2023-07-15 12:38:43 +09:00
Hajime Hoshi
647d2aca14
internal/glfw/glfw: move egl_context.* files
2023-07-15 12:30:12 +09:00
Hajime Hoshi
4d9ae2a815
./internal/glfw/glfw: move posix_*.* files
2023-07-13 03:39:12 +09:00
Hajime Hoshi
d8a8404fd4
internal/glfw/glfw/glfw/src: remove internal.h
2023-07-13 03:39:12 +09:00
Hajime Hoshi
a4c183c5d4
internal/glfw/glfw: move some C and H files
2023-07-13 03:08:09 +09:00
Hajime Hoshi
8ee3a6d0c1
internal/glfw/glfw/glfw/src: remove warnings for Wayland
2023-07-13 02:33:06 +09:00
Hajime Hoshi
5ddf75c4b3
internal/glfw/glfw/glfw/src: bug fix: build failure
2023-07-11 00:15:41 +09:00
Hajime Hoshi
72293d48b5
internal/glfw/glfw: unify c_glfw_bsd.go and c_glfw_linux.go
2023-07-11 00:05:33 +09:00
Hajime Hoshi
bf197e379b
internal/glfw/glfw: refactoring: remove glfw/include
2023-07-10 23:30:03 +09:00
Hajime Hoshi
4267e5d22e
internal/gamepad: bug fix: do not call GetRawInputDeviceList with the count 0
...
Updates #2696
2023-07-08 19:18:05 +09:00
Hajime Hoshi
bc2b373bca
internal/glfw/glfw: fix build tags
2023-07-08 14:04:30 +09:00
Hajime Hoshi
f8d8d7a231
examples/life, internal/graphicsdriver/opengl/gl: format copyright texts
2023-07-08 02:50:54 +09:00
Hajime Hoshi
c2b386a917
internal/glfw/glfw: refactoring
2023-07-08 02:34:56 +09:00
Hajime Hoshi
fafbe2711f
internal/glfw/glfw: refactoring
2023-07-08 02:16:39 +09:00
Hajime Hoshi
8039911bc8
internal/glfw/glfw: add license header comments
2023-07-08 02:15:47 +09:00
Hajime Hoshi
a4c2072c0f
internal/glfw/glfw: add 'static' to C functions
2023-07-08 00:37:20 +09:00
Hajime Hoshi
eba8713c64
internal/glfw/glfw: refactoring: reduce files
2023-07-08 00:33:20 +09:00
Hajime Hoshi
65fd352e3b
internal/glfw/glfw: remove unused files
2023-07-07 12:12:47 +09:00
Hajime Hoshi
7a7d4fd91f
internal/ui: bug fix: need to delay to capture a cursor
...
From the spec https://w3c.github.io/pointerlock/#extensions-to-the-element-interface ,
capturing a cursor might require a cooltime. This change adds a delay
to capture a cursor just after escaping from a capture.
Closes #2693
2023-07-07 01:24:02 +09:00
Hajime Hoshi
d0b6d2c41a
internal/glfw/glfw: remove implementation for joystick
...
Closes #2692
2023-07-06 23:24:34 +09:00
Hajime Hoshi
8052c5bdd5
internal/glfw/glfw: remove the Windows part
2023-07-06 00:08:48 +09:00
Hajime Hoshi
fbe732b378
copy github.com/go-gl/glfw/v3.3/glfw to internal/glfw/glfw
...
Closes #2546
2023-07-05 23:59:34 +09:00
guangwu
54e1263565
all: unnecessary use of fmt.Sprintf ( #2691 )
...
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-07-05 16:36:29 +09:00
Hajime Hoshi
eb5c1ee818
internal/ui: bug fix: the original cursor position was not scaled correctly
...
Updates #2690
2023-07-05 09:24:29 +09:00
Hajime Hoshi
929539b66e
add exp/textinput package
...
This works only for macOS and browsers so far.
Updates #1029
2023-07-05 02:09:04 +09:00
Hajime Hoshi
1d02d20879
internal/ui: fix comments
2023-07-04 23:34:00 +09:00
divVerent
b96aea70f1
internal/ui: compute antialias region size correctly. ( #2681 )
...
Closes #2679
2023-06-24 02:25:19 +09:00
Hajime Hoshi
8de08295e9
internal/restorable: refactoring
2023-05-26 01:44:13 +09:00
Hajime Hoshi
0f4066e7ac
internal/restorable: remove clearIfOverlapped
...
We found clearIfOverlapped could be a heavy task in some actual applications.
Instead of clearing existing data in the pixels records, add a new record
with a nil slice which indicates a cleared region.
2023-05-25 21:26:53 +09:00
Hajime Hoshi
47f19da710
internal/restorable: early return for an empty rectangle
2023-05-25 19:17:22 +09:00
Hajime Hoshi
90562ee84b
internal/goglfw: enable to build for GOOS=darwin
...
Updates #2546
2023-05-21 21:29:40 +09:00
Hajime Hoshi
0ab214b018
internal/goglfw: move updateWindowStyles call to win32window_windows.go
...
updateWindowStyles is originally a Windows-specific function in GLFW,
so this should be in win32window_windows.go.
2023-05-14 02:56:32 +09:00
the-goodies
12a179aab9
internal/goglfw: fix _GET_X_LPARAM and _GET_Y_LPARAM from api_windows.go ( #2665 )
...
Negative values should not disappear. For example, if _HIWORD returns 63000,
then _GET_Y_LPARAM should return -2536, but now it returns 63000.
This fixes that.
2023-05-10 09:27:40 +09:00
Hajime Hoshi
50b68a0427
internal/goglfw: refactoring: use unsafe.Add
2023-05-10 00:41:57 +09:00
Hajime Hoshi
1035b1d182
internal/shader: bug fix: wrong issue number
...
Updates #2590
Updates #2648
2023-05-09 01:40:33 +09:00
Hajime Hoshi
ad23ae81c1
internal/shader: bug fix: forbide assigning to a uniform variable
...
Closes #2648
2023-05-09 01:38:41 +09:00
Hajime Hoshi
0785502be3
internal/ui: refactoring
2023-05-09 00:35:54 +09:00
Hajime Hoshi
20edb04e5e
internal/restorable: refactoring: add EndFrame
2023-05-08 01:09:25 +09:00
Hajime Hoshi
befe990562
internal/shaderir: refactoring
2023-05-05 14:24:48 +09:00
Hajime Hoshi
ceb2bfc89c
internal/shaderir: refactoring: use the append pattern
2023-05-04 14:34:22 +09:00
Hajime Hoshi
e4c9d6705c
internal/shaderir: refactoring
2023-05-04 14:26:08 +09:00
Hajime Hoshi
ecf07ad09e
internal/graphicscommand: speed optimization: reduce boundary checks
...
Co-authored-by: Egon Elbre <egonelbre@gmail.com>
2023-05-04 12:55:53 +09:00
Hajime Hoshi
d16b591a35
internal/graphicsdriver/directx: bug fix: use an associated IDXGIFactory
...
In DirectX 11, if a device and a factory are independently created,
some functions like MakeWindowAssociation doe't work well.
This change fixes the issue by getting a factory from a device and
using it.
Closes #2661
2023-05-01 19:17:08 +09:00
Hajime Hoshi
b32258ab8c
internal/atlas: refactoring
2023-04-29 13:41:39 +09:00
Hajime Hoshi
e98acd3dc7
internal/graphicsdriver: refactoring: use image.Rectangle
2023-04-29 01:12:05 +09:00
Hajime Hoshi
d2c991b774
all: refactoring: use image.Rectangle
2023-04-28 01:03:38 +09:00
Hajime Hoshi
cdcffd7d4f
internal/restorable: refactoring: use image.Rectangle
2023-04-28 00:42:40 +09:00
Hajime Hoshi
d9a2b0922d
internal/atlas: refactoring: remove unnecessary calculations
2023-04-28 00:26:09 +09:00
Hajime Hoshi
9e61b52a70
internal/atlas: refactoring: use image.Rectangle
2023-04-27 23:55:11 +09:00
Hajime Hoshi
82c7436be5
internal/packing: refactoring: use image.Rectangle
2023-04-27 23:45:57 +09:00
Hajime Hoshi
6c5477adea
internal/atlas: remove borders at the upper and the left sides
...
Updates #2657
2023-04-27 09:06:05 +09:00
Hajime Hoshi
2a1d23d926
internal/shader: bug fix: panic when an assignment mismatch happens
...
Closes #2654
2023-04-26 22:09:25 +09:00
Hajime Hoshi
56b4cdc3c4
internal/graphics: use pixels for offsets
2023-04-26 00:38:23 +09:00
Hajime Hoshi
9d2178cf71
internal/shaderir: rename the built-in func to get a texel to __texelAt
2023-04-23 22:57:30 +09:00
Hajime Hoshi
49582519c1
all: add a compiler directive kage:unit
...
This change adds a new compiler directive 'kage:unit' to Kage. This
takes one of these two values: 'pixel' and 'texel'. The default value
is 'texel'.
With the pixel-unit mode, all the built-in functions treats pixels
instead of texels, and the texCoord argument of Fragment is in pixels.
This simplifies shader programs as programs no longer have the notion
of texels.
With the texel-unit mode, the behavior is the same as the current
behavior.
Closes #1431
2023-04-23 22:11:57 +09:00
Hajime Hoshi
b5ca404c42
internal/shader: bug fix: a swizzling 'r' didn't work for vec2
...
Closes #2652
2023-04-23 21:29:20 +09:00
Hajime Hoshi
00e45affe9
all: update OpenGL version from 2.1 to 3.2
...
'texelFetch' requires OpenGLSL 1.30, which requires OpenGL 3.0+.
macOS might not support OpenGL 3.0 and 3.1, so adopt 3.2.
Updates #1431
2023-04-23 14:25:36 +09:00
Hajime Hoshi
40c38eb9ee
internal/graphicsdriver/opengl: refactoring: remove contextPlatform
2023-04-22 21:52:20 +09:00
Hajime Hoshi
8926a4213e
internal/graphicsdriver/opengl: refactoring: move consts to gl
2023-04-22 21:20:34 +09:00
Hajime Hoshi
00ed6f08fc
internal/graphicsdriver/opengl/gl: refactoring: reduce types
2023-04-22 19:27:56 +09:00
Hajime Hoshi
504006fc22
internal/graphicsdriver/opengl/gl: refactoring: remove unused types
2023-04-22 16:18:18 +09:00
Hajime Hoshi
0495101450
internal/graphicsdriver/opengl/gl: bug fix: build error with GOOS=js
2023-04-22 16:10:49 +09:00
Hajime Hoshi
0542f9daa3
internal/graphicsdriver/opengl/gl: refactoring
2023-04-22 15:59:18 +09:00
Hajime Hoshi
4f69ca4ea9
internal/graphicsdriver/opengl: add a debug mode with a build tag ebitenginegldebug
...
In the debug mode, GetError is inserted in each GL function call.
Closes #2650
2023-04-22 13:17:08 +09:00
Hajime Hoshi
b40c5b1e99
internal/ui: catch an error at At at updateIconIfNeeded
...
Closes #2647
2023-04-20 00:59:14 +09:00
Hajime Hoshi
95709d9182
internal/graphicsdriver/opengl: update GLES version to 3.0
...
GLES 3.0 is required for GLSL ES 3.0
Updates #1431
2023-04-19 22:43:26 +09:00
Hajime Hoshi
7509c1d7f5
internal/graphicsdriver/opengl: remove the version es100
...
es300 is requried for 'texelFetch' [1].
[1] https://registry.khronos.org/OpenGL-Refpages/es3.0/html/texelFetch.xhtml
Updates #1431
2023-04-19 22:10:32 +09:00
Hajime Hoshi
2f55bb1b3d
internal/atlas, internal/graphicscommand: refactoring
2023-04-19 21:43:08 +09:00
Hajime Hoshi
6817be2594
internal/goglfw: ignore the invalid-handle error at DestroyWindow
...
Updates #2551
2023-04-18 23:53:26 +09:00
Hajime Hoshi
eb6a773d3f
internal/graphicscommand: remove unnecessary space chars
2023-04-18 01:19:28 +09:00
Hajime Hoshi
df32901dce
internal/shader: refactoring
2023-04-16 18:37:06 +09:00
Hajime Hoshi
c00579509a
internal/ui: bug fix: wrong mouse cursor movement calculation
...
Closes #2634
2023-04-10 15:25:04 +09:00
Hajime Hoshi
a56924b22f
internal/graphicsdriver/directx: refactoring
2023-04-09 16:49:52 +09:00
Hajime Hoshi
4473557e23
internal/graphicsdriver/directx: smooth rendering when resizing the window with DirectX 12
...
Updates #2615
2023-04-09 16:38:29 +09:00
Hajime Hoshi
2423733598
internal/graphicsdriver/directx: bug fix: wrong size was used when resizing
...
Updates #2633
2023-04-09 16:34:56 +09:00
Hajime Hoshi
2c088b9059
internal/graphicsdriver/directx: resize the swap chain after presenting is done
...
Updates #2633
2023-04-09 16:29:00 +09:00
Hajime Hoshi
730c7a2ad0
internal/graphicsdriver/directx: refactoring
2023-04-09 15:30:46 +09:00
Hajime Hoshi
78d3e4273b
internal/graphicsdriver/directx: remove tearing
...
This is basically a revert of 0035ba0bd1
.
I couldn't confirm that allowing tearing improved FPS. Rather, this
has a potential risk to cause an error at Present of the swap chain due
to an inconsistent argument, though I have not confirmed an actual issue.
Now the DirectX 11 driver was introduced, the situation has changed.
Updates #2034
Updates #2188
2023-04-09 14:47:51 +09:00
divVerent
cc24796270
internal/restorable: optimize removeDuplicatedRegions from O((n+m)^2) to O(n*m + m^2) ( #2631 )
...
This is achieved by replacing the function by one that only adds a single
new region, and only considers duplicates between the previously existing
region and the one newly added one, thereby removing previously redundant
checking of each previously existing region against each other.
This speeds up AAAAXY loading on a Moto G7 Play from 52.27 seconds to
8.15 seconds.
Closes #2626
2023-04-09 02:31:22 +09:00
Hajime Hoshi
ce71c31a27
internal/packing: refactoring: remove a redundant check of sizes
2023-04-09 01:13:44 +09:00
divVerent
574925cf7a
packing: remove redundant canAlloc checking and alloc allocating. ( #2629 )
...
By removing redundant work done in canAlloc and just calling alloc right away,
this removes 35% contribution to AAAAXY loading CPU time on the profile on
https://user-images.githubusercontent.com/251568/230496805-c5e32c19-9258-49c8-800b-a3f0bc3b072d.svg ,
or - as measured via stopwatch - brings loading time on Moto G7 Play from
17.22s to 14.94s after already applying #2627 .
This should be safe as there is no case in which alloc succeeds and the
allocated region isn't used; also, there is no case in which alloc mutates the
tree when it doesn't actually succeed (comment added in one place to justify
this).
Closes #2628
2023-04-08 22:03:16 +09:00
Hajime Hoshi
0d1f990338
internal/processtest: output a better error message when failing to compile a Go program
2023-04-01 04:01:39 +09:00
Hajime Hoshi
2875eb25f1
internal/processtest: add a test for #2620
...
Updates #2620
2023-04-01 03:59:00 +09:00
Hajime Hoshi
4e7db88829
internal/processtest: bug fix: timeout didn't work for go-run
...
Apparently timing-out for a go-run process didn't work well. Instead,
use CommandContext for the actual test binary which is already built.
2023-04-01 03:56:50 +09:00
Hajime Hoshi
09d2459f1c
internal/ui: a more robust fix for the unfocused-window loop
...
Depending on the member variable bufferOnceSwapped is a little fragile.
Detect whether the window is shown or not instead.
Updates #2620
2023-04-01 03:36:51 +09:00
Hajime Hoshi
db7c99fde8
internal/ui: bug fix: an unfocused window should not wait until buffers are swapped once
...
On macOS, a window is hidden until buffers are swapped once. If a game is
not runnable on unfocused, as the window is hidden and unfocused, the
waiting loop for a window never ends.
This change fixes the issue by changing the loop condition.
Closes #2620
2023-04-01 03:01:59 +09:00
Hajime Hoshi
f5e0496611
internal/goglfw: ignore invalid-window-handle error at DestroyWindow
...
Closes #2551
2023-03-31 23:59:11 +09:00
Hajime Hoshi
14b34a7b0a
internal/ui: typo
2023-03-31 03:21:48 +09:00
Hajime Hoshi
1999f8a024
internal/ui: use DirectX as a fallback for old Windows
...
Initializing OpenGL can fail [1], though this is pretty rare. For such
this case, try DirectX as a fallback.
[1] https://answers.microsoft.com/en-us/windows/forum/all/my-drivers-dont-support-opengl/a1ee0267-4dc8-4385-a185-6ed322d78329
Updates #2613
2023-03-31 03:15:52 +09:00
Hajime Hoshi
370b7599bc
internal/graphicsdriver/directx: use OpenGL as the default on old Windows
...
On old machines, CreateSwapChain might fail without a specific reasons.
Probably this is due to an issue in drivers, and if so, there is nothing
we can do. When choosing a graphics library, prefer OpenGL on such old
machines.
Updates #2613
2023-03-31 02:21:11 +09:00
Hajime Hoshi
182ac21866
internal/goglfw: separate the Windows version detection to a new package winver
2023-03-31 02:16:01 +09:00
Hajime Hoshi
c0adcee12c
Revert "internal/graphicsdriver/directx: initialize the refresh rate explicitly for Windows 7"
...
This reverts commit a4bfe8a869
.
Reason: This doesn't take any effects.
Updates #2613
2023-03-30 22:40:53 +09:00
Hajime Hoshi
a4bfe8a869
internal/graphicsdriver/directx: initialize the refresh rate explicitly for Windows 7
...
This is an experimental fix inspired by Chromium/ANGLE
https://source.chromium.org/chromium/chromium/src/+/main:third_party/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.cpp;l=491-492;drc=79aa846e38739138918891e8b334fac464dd9b83
Updates #2613
2023-03-30 22:22:26 +09:00
Hajime Hoshi
09250ff4f3
internal/graphicsdriver/directx: adjust buffer count
...
Apparently the buffer count should be 1 with a non-flipping swap effect.
Updates #2613
2023-03-30 21:09:41 +09:00
Hajime Hoshi
61ced5127b
internal/graphicsdriver/directx: limit d3dcompiler versions
...
For example, the verions 45/44 are alpha and should not be used.
Updates #2613
Updates #2618
2023-03-30 17:54:42 +09:00
Hajime Hoshi
99fb40f299
internal/processtest: skip tests on WSL
...
Closes #1864
2023-03-30 13:42:44 +09:00
Hajime Hoshi
d22158b156
internal/graphicsdriver/directx: use non-flip swap effect for old Windows
...
Updates #2613
Updates #2619
2023-03-30 12:33:08 +09:00
Hajime Hoshi
0cd832f096
internal/graphicsdriver/directx: check the DLL availability at NewGraphics
...
Updates #2613
Updates #2618
2023-03-30 01:45:31 +09:00
Hajime Hoshi
3e477d0bbb
internal/graphicsdriver/directx: bug fix: d3dcomipler_47.dll might be missing
...
Updates #2613
Closes #2618
2023-03-30 01:12:46 +09:00
Hajime Hoshi
6858e4b60b
internal/graphicsdriver/directx: use QueryInterface to cast IDXGISwapChain to IDXGISwapChain4
...
QueryInterface is better in terms of error messages than a dumb
pointer casting.
2023-03-30 00:44:39 +09:00
Hajime Hoshi
7fa65ae983
internal/graphicsdriver/directx: reduce unnecessary usages of IDXGISwapChain4
...
IDXGISwapChain is enough for DirectX 11.
Updates #2613
2023-03-30 00:14:04 +09:00
Hajime Hoshi
c9f1696a5b
internal/graphicsdriver/directx: use CreateDXGIFactory instead of CreateDXGIFactory2
...
CreateDXGIFactory2 is available in Windows 8.1 and newer. This is not
necessary for the current Ebitengine implementation. Use the old version
CreateDXGIFactory to support Windows 8 and older.
Updates #2613
2023-03-29 23:56:17 +09:00
Hajime Hoshi
fe67399022
internal/graphicsdriver/directx: use CreateSwapChain instead of CreateSwapChainForHwnd
...
This is a preparation to use IDXGIFactory instead of IDXGIFactory4.
Updates #2613
2023-03-29 23:37:08 +09:00
Hajime Hoshi
ad1bb4b2cb
internal/graphicsdriver/directx: remove unused functions
2023-03-29 23:21:08 +09:00
Hajime Hoshi
1017161c36
internal/graphicsdriver/directx: refactoring
2023-03-29 18:26:11 +09:00
Hajime Hoshi
0b0526a05b
internal/graphicsdriver/directx: bug fix: had to consider strides when copying resources
...
Closes #2617
2023-03-29 18:24:36 +09:00
Hajime Hoshi
0449126c5b
internal/graphicsdriver/directx: integrate EBITENGINE_DIRECTX and EBITENGINE_DIRECTX_FEATURE_LEVEL
2023-03-29 16:22:20 +09:00
Hajime Hoshi
129956d8f0
internal/graphicsdriver/directx: refactoring: remove graphic12.transparent
2023-03-29 15:56:33 +09:00
Hajime Hoshi
78d76945ad
internal/graphicsdriver/directx: implement DirectX 11 driver
...
Updates #2613
2023-03-29 15:52:33 +09:00
Hajime Hoshi
c8a2e5dc71
internal/graphicsdriver/directx: refactoring
...
This is a preparation for a DirectX 11 driver.
Updates #2613
2023-03-29 15:34:58 +09:00
Hajime Hoshi
4779bbc04d
internal/graphicsdriver/directx: refactoring: remove redundant adapter check
2023-03-29 15:32:49 +09:00
Hajime Hoshi
f23dd72fb4
internal/graphicsdriver/directx: reduce unnecessary settings of pipelines
2023-03-29 14:15:22 +09:00
Hajime Hoshi
c22957f678
internal/graphicsdriver/directx: dispose a screen image explicitly
...
A screen image in DirectX 12 should not include any buffers to release
so there is not a bug, but disposing it explicitly when resizing the
window should be polite.
2023-03-29 00:42:03 +09:00
Hajime Hoshi
f698f8fc69
internal/graphicsdriver/directx: refactoring
2023-03-28 02:32:01 +09:00
Hajime Hoshi
fe42c1f2b5
internal/graphicsdriver/directx: lower the shader version for feature levels 10.x
...
Updates #2613
2023-03-27 14:02:59 +09:00
Hajime Hoshi
dbb167c2d0
internal/graphicsdriver/directx: refactoring
2023-03-27 13:57:25 +09:00
Hajime Hoshi
549e6120b5
internal/graphicsdriver/directx: refactoring: reduce indentations
2023-03-26 22:56:15 +09:00
Hajime Hoshi
fe5c3354fc
internal/graphicsdriver/directx: bug fix: missing error checking
2023-03-26 18:52:55 +09:00
Hajime Hoshi
c9469a64ee
internal/graphicsdriver/directx: refactoring: add graphicsInfra
2023-03-26 18:31:42 +09:00
Hajime Hoshi
0b46d2b799
internal/graphicsdriver/directx: refactoring
2023-03-26 00:49:30 +09:00
Hajime Hoshi
902d7244eb
internal/graphicsdriver/directx: rename structs for a new DirectX 11 implementation
...
Updates #2613
2023-03-26 00:32:47 +09:00
Hajime Hoshi
d6525a2782
internal/graphicsdriver/directx: refactoring
2023-03-25 16:52:58 +09:00
Hajime Hoshi
c394bdcf7c
internal/graphicsdriver/directx: separate a part for images and shaders
2023-03-25 15:54:28 +09:00
Hajime Hoshi
4811386d8a
internal/graphicsdriver/directx: separate a part for DirectX 12
...
Updates #2613
2023-03-25 15:35:47 +09:00
Hajime Hoshi
488bce7e36
internal/graphicsdriver/directx: remove unnecessary comments
2023-03-25 13:53:00 +09:00
Hajime Hoshi
c1e83432c0
internal/graphicsdriver/directx: refactoring: split api_windows.go
2023-03-25 12:07:04 +09:00
Hajime Hoshi
4ec27262ed
internal/graphicsdriver/directx: refactoring
2023-03-25 01:34:29 +09:00
Hajime Hoshi
c7ca9cb321
ebiten: omit the exceeding part of vertices at Draw*
2023-03-23 21:23:33 +09:00
Hajime Hoshi
31273c875f
internal/graphics: rename constants
2023-03-23 20:48:39 +09:00
Hajime Hoshi
ce9274a29d
ebiten: remove the restriction for len(indices) at Draw*
...
Closes #2460
2023-03-23 20:01:15 +09:00
Hajime Hoshi
c7214ef6fb
internal/ui: use MaxVertexCount instead of IndicesCount
...
Updates #2460
2023-03-23 19:44:00 +09:00
Hajime Hoshi
81581df2b9
internal/graphicscommand: reland: add graphics.MaxVertexFloatCount and use it instead of IndicesCount
...
This change is reland of 54e2790a06
but with a fix for WebGL. Also, this changes the logic when len(vertices)
exceeds the maximum: just remove the last part.
Updates #2460
2023-03-23 18:01:09 +09:00
Hajime Hoshi
c59bcbdb5b
Revert "internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount"
...
This reverts commit 54e2790a06
.
Reason: test failures on browsers:
`GOOS=js GOARCH=wasm go test . -shuffle=1679547510163000000` failed
https://github.com/hajimehoshi/ebiten/actions/runs/4497182906/jobs/7912544699
2023-03-23 14:15:04 +09:00
Hajime Hoshi
54e2790a06
internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount
...
Updates #2460
2023-03-23 13:49:05 +09:00
Hajime Hoshi
3f2ac129d2
internal/graphicscommand: refactoring: remove unnecessary restrictions for indices
...
Updates #2460
2023-03-23 13:28:11 +09:00
Hajime Hoshi
90723025cc
internal/graphicsdriver/directx: reuse vertices/indices buffers whenever possible
2023-03-23 11:34:39 +09:00
Hajime Hoshi
e5525a04d5
internal/graphicsdriver/directx: refactoring: remove usages of graphics.IndicesCount
...
Updates #2460
2023-03-23 11:25:29 +09:00
Hajime Hoshi
a19ff07130
internal/graphicsdriver/opengl: bug fix: potential infinite loop
2023-03-23 02:47:23 +09:00
Hajime Hoshi
ad90ae3475
internal/graphicsdriver/directx: refactoring
2023-03-22 21:52:14 +09:00
Hajime Hoshi
034f9c2db8
internal/graphicsdriver/opengl: reland: refactoring: remove usages of graphics.IndicesCount
...
Updates #2460
2023-03-22 20:13:29 +09:00
Hajime Hoshi
61ee811579
internal/graphicsdriver: define Resetter
2023-03-22 18:35:46 +09:00
Hajime Hoshi
8cbf545e0f
internal/graphicsdriver/opengl: revert commits for graphics.Indices
...
This change reverts these commits:
* 13d3a0487b
* 4cd98d512e
Reason: this caused crashes on Android.
Updates #2460
Closes #2610
2023-03-22 17:28:45 +09:00
Hajime Hoshi
13d3a0487b
internal/graphicsdriver/opengl: refactoring: remove usages of graphics.IndicesCount
...
Updates #2460
2023-03-22 13:33:34 +09:00
Hajime Hoshi
4cd98d512e
internal/graphicsdriver/opengl: refactoring
2023-03-21 23:06:49 +09:00
Hajime Hoshi
23e90b7e39
internal/graphicsdriver/opengl: refactoring
2023-03-20 22:48:20 +09:00
Hajime Hoshi
8ae6ea5ff6
internal/graphicsdriver/opengl: update comments
2023-03-20 01:42:54 +09:00
Hajime Hoshi
cbff3555db
internal/graphicsdriver/opengl: drop WebGL 1 support
...
Closes #2191
2023-03-18 22:50:09 +09:00
Hajime Hoshi
22dfdfc418
internal/gamepad: bug fix: possible crash at iterating gamepads
...
Closes #2603
2023-03-17 11:40:24 +09:00
Hajime Hoshi
faca493fbc
go generate
2023-03-15 03:18:28 +09:00
Hajime Hoshi
39aaf7fe37
ebiten: update comments
...
Updates #2601
2023-03-14 13:07:40 +09:00
Hajime Hoshi
1656c47abf
internal/ui: bug fix: hiding a window decoration at initialization doesn't work on macOS
...
Closes #2600
2023-03-14 00:27:57 +09:00
Hajime Hoshi
3bcac70d1c
internal/graphicsdriver/metal: add comments
2023-03-13 22:21:55 +09:00
Hajime Hoshi
e93bcd9e55
internal/ui: bug fix: needed to wait for swapping buffers before entering fullscreen
...
Closes #2599
2023-03-13 21:40:40 +09:00
Hajime Hoshi
65fb9d56ba
internal/graphicsdriver/metal: refactoring
...
Updates #2599
2023-03-13 21:29:42 +09:00
divVerent
10c1b56e62
cmd/ebitenmobile: fix Xbox-ish gamepad axis assignment ( #2596 )
...
This commit mirrors https://github.com/libsdl-org/SDL/pull/7405
(6f1f586086
).
Note that for SDL, this code is used a lot less than for Ebitengine, as SDL
mostly migrated to HIDAPI and direct USB device access rather than using
Android's APIs. For Bluetooth devices, however, the Java APIs are used the
same way.
This was the remaining problem to be solved to automatically support standard
layout on most standard gamepads (this should cover most Xbox-ish and PS-ish
gamepads on the market).
In particular this covers gamepads with the following assignment:
- Left stick = X/Y, right stick = Z/RZ, triggers = LEFTTRIGGER/RIGHTTRIGGER
(which basically is what Android docs say and some PS gamepads do)
- Left stick = X/Y, right stick = RX/RY, triggers = Z/RZ
(Xbox gamepad style, apparently)
- Left stick = X/Y, right stick = RX/RY, triggers = LEFTTRIGGER/RIGHTTRIGGER
(Not sure if this exists, but it's conceivable)
As we found on the SDL pull request discussion, gamepads that offer flight
controls (e.g. THROTTLE and RUDDER) will likely not work well, before and
after this change.
Closes #2557
2023-03-12 22:32:30 +09:00
Hajime Hoshi
36e2d0ec40
internal/graphicsdriver/metal: bug fix: a path for CoreGraphics.framework didn't work
...
Closes #2595
2023-03-10 23:24:06 +09:00
Hajime Hoshi
84146510ce
internal/restorable: refactoring
2023-03-10 22:29:59 +09:00
Hajime Hoshi
46173ffec6
internal/restorable: refactoring
2023-03-10 01:57:07 +09:00
Hajime Hoshi
8f2097d55e
internal/restorable: reduce more duplicated regions
2023-03-09 23:17:02 +09:00
Hajime Hoshi
f3b49e6543
internal/restorable: reduce more duplicated regions
2023-03-09 22:57:57 +09:00
Hajime Hoshi
66db13ef74
internal/restorable: add tests
2023-03-09 21:54:41 +09:00
Hajime Hoshi
367606f274
internal/restorable: remove duplicated regions from i.staleRegions
...
Updates #2375
Updates #2581
2023-03-09 17:15:56 +09:00
Hajime Hoshi
22d74e78b2
internal/restorable: reduce allocations at readPixelsFromGPU
...
Updates #2375
2023-03-08 16:43:43 +09:00
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
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