Hajime Hoshi
ea1c18d124
internal/ui: rename contextImpl -> context
2022-04-01 17:59:44 +09:00
Hajime Hoshi
09a548e055
internal/ui: consider the case when currentMonitor() returns nil
...
Closes #1887
2022-04-01 03:51:28 +09:00
Hajime Hoshi
07a7aca1b3
internal/gamepad: skip gamepads with more than 32 buttons
...
This change was removed at ef45058037
accidentally.
Updates #1173
Updates #2039
2022-04-01 02:24:15 +09:00
Hajime Hoshi
b5a9ff007c
internal/ui: bug fix: WindowPosition
/SetWindowPosition
didn't work on macOS fullscreen
...
Updates #1590
Closes #2043
2022-03-30 12:10:48 +09:00
Hajime Hoshi
172da82aa7
internal/ui: optimization: reduce u.t.Call
2022-03-30 03:28:18 +09:00
Hajime Hoshi
f2860bebed
internal/ui: remove an unnecessary hack to resize the window
...
The bug (#1606 ) is no longer reproducible even without the hack.
Updates #1606
Updates #1609
2022-03-30 02:48:39 +09:00
Hajime Hoshi
feb70963c6
internal/ui: force to put the window in the initial monitor
...
To make things simple, let's not put the window outside the initial
monitor.
Updates #1351
Closes #1575
2022-03-30 01:56:35 +09:00
Hajime Hoshi
07d6419dc6
internal/ui: bug fix: DeviceScaleFactor was not concurrent-safe before the main loop
...
Updates #1575
Closes #2042
2022-03-29 00:27:44 +09:00
Hajime Hoshi
2d912a2387
internal/shaderir/hlsl: bug fix: wrong offset of uniform array variables
...
Closes #2038
2022-03-27 01:49:52 +09:00
Hajime Hoshi
aef00a5235
internal/shader: bug fix: wrong type deduction at (scalar)*(matrix)
...
Updates #2037
2022-03-27 01:22:54 +09:00
Hajime Hoshi
6bd3c81e27
internal/graphicsdriver/directx, internal/graphicsdriver/metal: bug fix: uniform matrix-array variables were passed wrongly
...
Updates #2036
2022-03-27 00:32:30 +09:00
Hajime Hoshi
eaad959472
internal/graphicsdriver/metal: remove println
2022-03-27 00:12:34 +09:00
Hajime Hoshi
f6d87f6ee8
internal/graphicsdriver/directx, internal/graphicsdriver/metal: bug fix: uniform matrix variables were passed wrongly
...
Updates #2036
2022-03-26 23:58:48 +09:00
Hajime Hoshi
79e93d3b12
internal/graphicsdriver: introduce the DirectX driver
...
Closes #1007
2022-03-26 20:09:34 +09:00
Hajime Hoshi
a936ffc032
internal/shader: restrict the number of arguments for atan/atan2
2022-03-26 19:40:04 +09:00
Hajime Hoshi
d30a31b16c
internal/shaderir/hlsl: add function forward declarations
2022-03-26 19:10:03 +09:00
divVerent
1de1bfef55
internal/gamepad: fix uint16 underflow handling in gamepads. ( #2030 )
...
Fixes crash where Ebiten considers a keyboard a gamepad with way too many buttons.
Updates #2027
2022-03-26 15:41:59 +09:00
Hajime Hoshi
dcccd27629
internal/shaderir/msl: bug fix: mod for a vector and a scalar didn't work
...
Updates #2029
2022-03-26 02:57:38 +09:00
Hajime Hoshi
52376170a4
internal/shaderir: bug fix: float4x4(x) initialized all the components unexpectedly
...
See https://docs.microsoft.com/en-us/windows/win32/direct3d9/casting-and-conversion#parameter-value-modifiers
Updates #1007
2022-03-26 02:05:35 +09:00
Hajime Hoshi
cfd0de5c41
internal/shaderir: make outputs for unexpected operators consistent
2022-03-26 01:40:02 +09:00
Hajime Hoshi
4893b13acc
internal/shaderir: add internal/shaderir/hlsl
...
Updates #1007
2022-03-26 01:31:05 +09:00
Hajime Hoshi
9bfbbb6e9e
internal/ui: add graphicsDriverGetter.getDirectX()
...
Updates #1007
2022-03-25 19:43:38 +09:00
Hajime Hoshi
e4d0050452
internal/gamepad: bug fix: compile error
...
Updates #2027
2022-03-25 14:35:03 +09:00
Hajime Hoshi
b985689010
internal/gamepad: bug fix: crash when a too big button code is reported on Linux
...
Updates #2027
2022-03-25 14:28:09 +09:00
Hajime Hoshi
c61be3c532
internal/ui: bug fix: getMetal might return a nil pointer as a non-nil interface
2022-03-24 13:36:53 +09:00
Hajime Hoshi
eeb5687b73
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to pointers
...
On second thought, returning pointers is more natural. Handling
nil is a caller's responsibility.
2022-03-24 13:20:36 +09:00
Hajime Hoshi
7bb7e45522
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to interface
...
Converting a nil with a pointer type to an interface type is no longer
a nil-nil interface, and then comparing with nil causes an unexpected
results.
2022-03-24 03:24:58 +09:00
Hajime Hoshi
3074dca670
internal/ui: add the EBITEN_GRAPHICS_LIBRARY environment variable
...
The `ebitengl` build tag is gone instead.
Closes #2007
2022-03-24 02:23:37 +09:00
Hajime Hoshi
151dfffad6
internal/restorable: simplify canDetectContextLostExplicitly
...
This constant was set with some wrong assumptions:
1. On Android, recovering was needed.
2. On iOS, OpenGL ES was used when
a. The architecture was 386 or amd64 == an emulator is used
b. The build tag ebitengl was not specified
c. gomobile-build was used
3. On browsers, recovering was needed.
1., 2b, and 2c are correct.
2a. is not correct: Now emulators are available on all the
architectures with both Metal and OpenGL.
3. is not correct: Ebiten no longer recovers the contest lost.
Now, Ebiten can detect a context lost explicitly when
1. On Android
2. On iOS and on gomobile-build
(When gomobile-build is used, OpenGL should always be used)
Based on this fact, this change changes the constant to a variable,
and fixes the logic to set the variable.
2022-03-23 03:01:59 +09:00
Hajime Hoshi
85daef7436
internal/ui: bug fix: OpenGL must be used when gomobile-build is used
...
Now the logic of graphicsDriver() is updated, this can return a Metal
graphics driver on iOS even when gomobile-build is used.
This change fixes this issue.
2022-03-23 02:58:56 +09:00
Hajime Hoshi
09b0a0ffaf
internal/ui: refactoring: simplify the selection of graphics libraries
2022-03-23 02:21:53 +09:00
Hajime Hoshi
7e6e022065
cmd/ebitenmobile: support Metal for iOS simulators
2022-03-23 01:34:58 +09:00
Hajime Hoshi
a74e7b1578
Revert "internal/graphicsdriver/metal: refactoring"
...
This reverts commit 1c57393393
.
Reason: nothing is rendered on iOS.
Closes #2022
2022-03-23 01:22:39 +09:00
Hajime Hoshi
8e6907c64a
internal/ui: reduce the calls of graphicsDriver()
2022-03-22 02:17:41 +09:00
Hajime Hoshi
15548b4c74
internal/ui: add userInterfaceImpl.graphicsDriver
2022-03-22 00:13:22 +09:00
Hajime Hoshi
be1836339b
internal/ui: define the common struct UserInterface for all the environments
...
The existing UserInterface structs became userInterfaceImpl structs.
2022-03-21 23:10:27 +09:00
Hajime Hoshi
99437944bc
internal/ui: remove graphicsDrivre() calls from image.go
2022-03-21 22:49:47 +09:00
Hajime Hoshi
cd57bccbfc
internal/graphicsdriver: let some functions return an error
...
This is a preparation for the DirectX driver.
Updates #1007
2022-03-21 22:23:12 +09:00
Hajime Hoshi
0dcf43b350
internal/graphicsdriver: reorder the member
2022-03-21 22:05:21 +09:00
Hajime Hoshi
5e973ab419
Revert "internal/graphicscommand: clear the queue regardless of an error"
...
This reverts commit e21636fbb9
.
Reason: Simply this is no longer needed. We gave up testing when an error
occurs in a graphics command queue.
2022-03-21 21:57:59 +09:00
Hajime Hoshi
31104c4e79
internal/processtest: remove TestShaderNoMain and add shadernomain.go
...
A shader compilation error breaks the state of the graphics command
queue, and this cannot be reused. Thus, a process test is appropriated.
2022-03-21 21:52:38 +09:00
Hajime Hoshi
81b9f91f86
internal/graphicscommand: compile shaders lazily
...
With DirectX, the graphics driver cannot be determined until the
main loop starts, as a transparent window cannot be treated with
DirectX so far. On the other hand, compiling shaders requires a
graphics driver as it requires information about Y directions of
NDCs and framebuffers.
This change delays compiling shaders until the graphics commands
are actually executed in the main loop.
Updates #1007
Updates #2019
2022-03-21 21:09:02 +09:00
Hajime Hoshi
e21636fbb9
internal/graphicscommand: clear the queue regardless of an error
...
There was a potential issue that commands in the queue are never
reset when an error happens and the queue continues to send errors.
This is problematic especially for testings.
This change fixes the issue by Go's defer.
2022-03-21 20:10:03 +09:00
Hajime Hoshi
ad0e0e3e66
internal/graphicscommand: remove an unused member
2022-03-21 19:50:05 +09:00
Hajime Hoshi
9b1adf799d
internal/shader: move syntax tests to internal/shader
2022-03-21 19:31:06 +09:00
Hajime Hoshi
b5bb576a58
internal/ui: refactoring: unexport ConvertUniforms
2022-03-21 17:05:50 +09:00
Hajime Hoshi
f4ad12987d
internal/ui: bug fix: compile error with the cbackend tag
2022-03-21 16:59:53 +09:00
Hajime Hoshi
12ce5ae83a
internal/ui: remove the call of graphicsDriver() from the context
2022-03-21 16:48:33 +09:00
Hajime Hoshi
fc96eb30a1
internal/atlas: simplify the logic by adding paddings to the mask
2022-03-21 16:13:21 +09:00
Hajime Hoshi
870a18e8f5
internal/buffered: remove unnecessary conditions from resolvePendingPixels
2022-03-21 15:27:21 +09:00
Hajime Hoshi
4b31983b6d
internal/buffered: English
2022-03-21 15:20:52 +09:00
Hajime Hoshi
c316aaae72
internal/buffered: simplify the API
2022-03-21 15:19:06 +09:00
Hajime Hoshi
5c3f8915d1
internal/atlas: add an argument check
2022-03-21 15:11:38 +09:00
Hajime Hoshi
29f7a45ccc
internal/buffer: remove the graphics-driver argument from ReplacePartialRegionPixels
...
This is necessary to remove the graphics driver usage from
(*ebiten.Image).At. And this is necessary to determine the graphics
driver after the window becomes transparent or not.
Unfortunately, it is not obvious to make a transparent window with
DirectX. Then, the determination of a graphics driver should be delayed.
Updates #1007
2022-03-21 05:59:43 +09:00
Hajime Hoshi
4f070915b2
internal/atlas: bug fix: do not use the padding when a mask is specified
...
With paddings, a mask size was not appropriate.
As a simple solution, let's not use paddings when a mask is specified.
2022-03-21 05:50:31 +09:00
Hajime Hoshi
dfc9eeaaec
internal/restorable: bug fix: the parameter mask was not passed correctly
2022-03-21 05:40:13 +09:00
Hajime Hoshi
fbcbd2a001
internal/buffered: refactoring
2022-03-21 04:36:32 +09:00
Hajime Hoshi
b3f4d6c522
internal/atlas: add a new parameter specifying a mask for ReplacePixels
2022-03-21 03:56:04 +09:00
Hajime Hoshi
5c79b86412
internal/restorable: add a new parameter specifying a mask for ReplacePixels
2022-03-21 03:08:58 +09:00
Hajime Hoshi
e55dbbf3cd
internal/restorable: add more tests
2022-03-21 03:04:52 +09:00
Hajime Hoshi
72a6ab8da4
internal/restorable: add more tests
2022-03-21 02:44:48 +09:00
Hajime Hoshi
924f7ea932
internal/restorable: refactoring
2022-03-21 01:26:48 +09:00
Hajime Hoshi
5fe6791b5d
internal/graphicscommand: add a new paramter 'mask' to ReplacePixels
2022-03-21 01:11:01 +09:00
Hajime Hoshi
c1a0d83f8d
internal/restorable: simplify the implementation of rect
...
Allow overlapped regions at pixelsRecords.
This removes the members `last*` for caching. These were introduced
at 7e7751bd43
, and apparently these
are no longer needed.
2022-03-21 00:06:30 +09:00
Hajime Hoshi
ea81d4abf4
internal/buffered: refactoring
2022-03-20 19:03:41 +09:00
Hajime Hoshi
14c327c89b
internal/atlas: replace Pixels with At to reduce unnecessary slice allocations
2022-03-20 18:39:17 +09:00
Hajime Hoshi
11ff0ab48c
internal/atlas: refactoring: remove arguments from Pixels
2022-03-20 18:28:57 +09:00
Hajime Hoshi
367a9ec5bf
internal/atlas: refactoring
2022-03-20 18:07:29 +09:00
Hajime Hoshi
54b4e87506
internal/restorable: bug fix: ReplacePixels on a sub-image might panic on Android
...
If regions by ReplacePixel are overlapped, this can panics. This can
happen only on Android, where a context lost can happen.
Thus, a sub-image cannot call a direct ReplacePixels. internal/buffer
has to care this.
2022-03-20 18:01:37 +09:00
Hajime Hoshi
696bbc088f
internal/ui: rename variables
2022-03-20 16:51:23 +09:00
Hajime Hoshi
c3e855ab02
internal/buffered: refactoring
2022-03-20 16:44:11 +09:00
Hajime Hoshi
673556d03f
internal/ui: move the error handlings to the ui package
2022-03-20 16:26:26 +09:00
Hajime Hoshi
bd07f6246f
internal/buffered: remove mysterious comments
2022-03-20 05:17:43 +09:00
Hajime Hoshi
cc574ad67e
internal/atlas: rename functions: Area -> Region
2022-03-20 04:20:23 +09:00
Hajime Hoshi
b59dd45239
internal/buffered: separate ReplacePixels with the large-area and small-area versions
...
For the large-area version, this doesn't require a graphics driver.
This is necessary to ensure that ReplacePixels never needs a graphics
driver.
2022-03-20 04:13:31 +09:00
Hajime Hoshi
4cbce71b2b
internal/graphicscommand: move the choice of graphics drivers to internal/ui
2022-03-20 02:51:31 +09:00
Hajime Hoshi
1d9982ee6d
internal/ui: move the dependency on graphicscommand from ebiten to ui
2022-03-20 02:00:44 +09:00
Hajime Hoshi
e78f34aa26
internal/ui: add Image
...
This is a preparation for a refactoring. Image will be a proxy to
pass a graphics driver to the lower layer.
2022-03-20 01:39:05 +09:00
Hajime Hoshi
3e44a20b22
internal/graphicscommand: swap arguments
2022-03-20 00:09:17 +09:00
Hajime Hoshi
8e3576b404
internal/mipmap: remove unused functions
2022-03-19 23:45:15 +09:00
Hajime Hoshi
7c2300b352
internal/graphicscommand: reduce the usages of the graphicsDriver function
2022-03-19 23:03:34 +09:00
Hajime Hoshi
58366ce64d
internal/glfw: make the file operation atomic
...
If multiple Ebiten processes start at the same time, the file operation
can cause a race condition. Add a file lock to avoid this.
2022-03-18 20:32:25 +09:00
Hajime Hoshi
2e6bb8c4e2
internal/graphicsdriver/metal: add comments
2022-03-14 22:02:44 +09:00
Hajime Hoshi
a617576879
internal/shaderir: replace Mul with ComponentWiseMul and MatrixMul
...
This is a preparation for DirectX / HLSL.
Updates #1007
2022-03-13 19:17:46 +09:00
Hajime Hoshi
044d41dd2d
internal/shaderir: change Op from string to int
...
This is a preparation to distinguish Hadamard product and matrix
product for HLSL.
Updates #1007
2022-03-13 16:20:04 +09:00
Hajime Hoshi
7d0f95e9be
internal/graphicsdriver: refactoring: replace Uniform with []float32
...
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
35a5c88901
internal/graphics: rename constants
2022-03-12 04:01:48 +09:00
Hajime Hoshi
98e2d86ea3
internal/shaderir/msl: refactoring
2022-03-12 00:18:55 +09:00
Hajime Hoshi
5715539a0f
internal/shaderir/glsl, internal/shaderir/msl: refactoring
2022-03-11 15:18:38 +09:00
Hajime Hoshi
e63709a2a5
internal/shaderir/glsl: refactoring
2022-03-11 02:03:15 +09:00
Hajime Hoshi
6f00221051
internal/shaderir/msl: rename the package name
...
Updates #2010
2022-03-10 16:25:11 +09:00
Hajime Hoshi
5f97bdc1d3
internal/shader: fix typo
...
Updates #2011
2022-03-10 02:54:32 +09:00
Hajime Hoshi
5614e9d7eb
internal/shader: fix misspellings
2022-03-10 02:52:44 +09:00
Hajime Hoshi
880dd0682e
internal/shader: bug fix: fix some failing tests
2022-03-10 02:24:29 +09:00
Hajime Hoshi
d3b72d4ef9
internal/shader: add test files
...
Updates #2011
2022-03-10 01:02:51 +09:00
Hajime Hoshi
de05ede27e
internal/shader: bug fix: evaluate the builtin float/int functions in the pre-compile phase correctly
...
Closes #2011
2022-03-10 00:47:16 +09:00
Hajime Hoshi
47bfd0db9e
internal/shaderir/metal: rename to msl
...
Closes #2010
2022-03-10 00:14:06 +09:00
Hajime Hoshi
5e5e3c64ac
internal/shaderir/metal: remove a redundant case
2022-03-09 02:54:31 +09:00
Hajime Hoshi
15064dbdc1
internal/shaderir/glsl, internal/shaderir/metal: simplify function names
2022-03-09 01:43:36 +09:00
Hajime Hoshi
e4fba8b047
bug fix: compile error with Go 1.16 and older
2022-03-08 00:08:53 +09:00