Hajime Hoshi
dbcb220742
ebiten: Add GamepadAxisValue replacing GamepadAxis
...
Updates #1718
Closes #1719
2021-07-19 01:22:35 +09:00
Hajime Hoshi
342bf6ae7e
Update GLFW: suppress joystick issue at PollEvents
...
Updates #1229
2021-07-15 11:19:39 +09:00
Hajime Hoshi
ec5b034cbf
Update GLFW: suppress joystick issue (again)
...
Updates #1229
2021-07-15 01:02:57 +09:00
Hajime Hoshi
66dbca7fdd
Update GLFW: suppress joystick issue
...
Updates #1229
2021-07-14 23:54:48 +09:00
Hajime Hoshi
50d2d7ed61
internal/graphicsdriver/opengl: Remove unused code using PBO
...
Updates #1678
2021-07-14 21:51:27 +09:00
Hajime Hoshi
99a6b1b03e
internal/driver: Change some functions to Append*
...
Updates #1692
2021-07-10 01:52:21 +09:00
Hajime Hoshi
5d2c8ad9be
internal/uidriver/mobile: Bug fix: Use mutex at RuneBuffers
2021-07-10 01:39:32 +09:00
Hajime Hoshi
853c1f2b92
internal/shaderir/glsl: Bug fix: Remove uncalled functions
...
Some built-in functions like dFdx is not available in a vertex shader,
then a function that calls such built-in function should not be in
a vertex shader.
Closes #1701
2021-07-09 20:22:40 +09:00
Hajime Hoshi
b0106e95b9
internal/restorable: Bug fix: Test failed on macOS (Metal)
2021-07-09 20:21:04 +09:00
Hajime Hoshi
4573883b03
internal/graphicsdriver/metal: Make FPS stable by 'presentsWithTransaction'
...
Closes #1196
2021-07-08 18:11:19 +09:00
Hajime Hoshi
ae0e30196b
internal/graphicsdriver/metal: Bug fix: The store action must always be 'store'
...
Closes #1700
2021-07-08 17:39:37 +09:00
Hajime Hoshi
337d8d5113
internal/graphicsdriver/metal: Separate GCing the buffers
...
Updates #1196
2021-07-08 02:10:26 +09:00
Hajime Hoshi
edc2f8b961
internal/graphicsdriver/metal: Delay to get a texture for nextDrawable
...
See https://developer.apple.com/documentation/quartzcore/cametallayer
> To avoid stalls in your app, request a new drawable only when you
> need it, and release any references to it as quickly as possible
> after you’re done with it.
Updates #1196
2021-07-08 01:56:14 +09:00
Hajime Hoshi
b314b6b9b6
Revert "internal/graphicsdriver/metal: Do not retain MTLCommandBuffer for MTLBuffer"
...
This reverts commit e0fbfc2bb0
.
Reason: Rendering issue
Closes #1699
2021-07-08 00:27:33 +09:00
Hajime Hoshi
6213c17abc
internal/driver: Add Graphics.Initialize
2021-07-07 13:58:42 +09:00
Hajime Hoshi
519363930a
internal/uidriver/glfw: Bug fix: Memory leak in Objective-C code
...
Use an autorelease pool block.
Closes #1698
2021-07-07 04:34:21 +09:00
Hajime Hoshi
e0fbfc2bb0
internal/graphicsdriver/metal: Do not retain MTLCommandBuffer for MTLBuffer
...
Before this change, a command buffer is retained indirectly by
a buffer, and this might extend the life of drawable unexpectedly.
This change stops using command buffers as a key of the buffers pool,
and use a counter increated by nextDrawable calls.
Updates #1196
2021-07-07 02:52:04 +09:00
Hajime Hoshi
80ac0646d5
internal/graphicsdriver/metal: Optimize the screen writing
2021-07-07 02:07:09 +09:00
Hajime Hoshi
5e83f409e6
internal/graphicscommand: Add a missing colon to a command string
2021-07-07 01:54:22 +09:00
Hajime Hoshi
38ce325958
internal/graphicsdriver/metal: Skip clearing the screen on Metal
2021-07-07 01:45:51 +09:00
Hajime Hoshi
9cb1ff9cea
internal/graphicsdriver/metal: Set framebufferOnly true
...
Updates #1196
2021-07-07 00:38:55 +09:00
Hajime Hoshi
bd3f16dbba
internal/graphicsdriver/metal: Change the order of GCed buffers
...
As a big buffer is likely reused, we should remove smaller buffers
first.
Updates #1196
2021-07-06 21:56:27 +09:00
Hajime Hoshi
09bd8b6f4a
internal/graphicsdriver/metal: Remove println
...
Updates #1196
2021-07-06 21:51:57 +09:00
Hajime Hoshi
ee2f891fcc
internal/graphicsdriver/metal: Reuse MTLBuffer objects
...
In Metal, MTLBuffer objects are not 'transient' and are expensive
to create. Reuse them whenever possible.
See also: https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Cmd-Submiss/Cmd-Submiss.html
Updates #1196
2021-07-06 21:48:54 +09:00
Hajime Hoshi
be1a0e90e7
internal/graphicsdriver/metal: Bug fix: TestImageEvenOdd failed
...
RenderCommandEncoder must be reset whenever the stencil mode is
'prepareStencil' in order to clear the stencil buffer.
2021-07-06 15:11:23 +09:00
Hajime Hoshi
3670b7dd62
internal/graphicsdriver/metal: Reuse DepthStencilState objects
...
In Metal, *State objects are not 'transient' and are expensive to
create. Reuse them whenever possible.
See also: https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Cmd-Submiss/Cmd-Submiss.html
2021-07-06 15:10:05 +09:00
Hajime Hoshi
ab26312108
internal/graphicsdriver/metal: Release objects appropriately
2021-07-06 14:20:19 +09:00
Hajime Hoshi
17d8cb5311
internal/graphicsdriver/metal: Bug fix: Crashed with METAL_DEVICE_WRAPPER_TYPE=1
...
Closes #1697
2021-07-06 14:06:06 +09:00
Hajime Hoshi
59fa689f22
internal/graphicscommand: Misspelling
2021-07-05 23:32:19 +09:00
Hajime Hoshi
5e1d6c06f1
internal/graphicscommand: Merge even-odd draw-triangles commands when possible
...
Closes #1685
2021-07-05 23:28:33 +09:00
Hajime Hoshi
63a00f6171
internal/graphicsdriver/metal/mtl: Bug fix: Test failure
...
Closes #1696
2021-07-05 21:28:25 +09:00
Hajime Hoshi
92b3dab33c
internal/graphicscommand: Refactoring: Use type assesion instead of interface
...
This was an optimization in GopherJS era. This change removes this
to simplify the implementation.
2021-07-05 21:16:04 +09:00
Hajime Hoshi
b2d4521e22
internal/graphicscommand: Log 'even-odd' property
2021-07-05 19:35:34 +09:00
Hajime Hoshi
674802d2f5
ebiten: Bug fix: Draw commands with EvenOdd should not be merged
...
Updates #1684
2021-07-05 18:08:55 +09:00
Hajime Hoshi
daa883d799
ebiten: Bug fix: Stencil buffers should not be cleared until all the vertices are rendered
...
Updates #1684
2021-07-05 17:41:06 +09:00
Hajime Hoshi
b466a0cbd7
ebiten: Add EvenOdd to DrawTrianglesOptions and DrawShaderTrianglesOptions
...
Updates #844
Closes #1684
2021-07-05 03:35:55 +09:00
Hajime Hoshi
5c4d3325f6
internal/graphicsdriver/opengl: Add APIs for stencil buffers
...
Updates #1684
2021-07-05 00:24:44 +09:00
Hajime Hoshi
b8bf277825
internal/graphicsdriver/metal/mtl: Add APIs for stencil buffers
...
Updates #1684
2021-07-05 00:11:25 +09:00
Hajime Hoshi
19f034e818
internal/graphicsdriver/metal: Refactoring
2021-07-04 20:35:56 +09:00
Hajime Hoshi
3ec02f767b
internal/graphicsdriver/metal: Refactoring
2021-07-04 18:37:14 +09:00
Hajime Hoshi
7f86761dde
internal/graphicsdriver/metal: Reuse RenderCommandEncoder when possible
2021-07-04 18:13:18 +09:00
Hajime Hoshi
7668052a6b
internal/graphicsdriver/metal: Update the view only when necessary
2021-07-04 17:24:39 +09:00
Hajime Hoshi
f6e210e086
internal/graphicsdriver/opengl: Refactoring: Remove redundant conversions
2021-07-03 22:39:48 +09:00
Hajime Hoshi
b0b7a24f89
internal/uidriver: Remove invalid comments
2021-07-03 19:49:12 +09:00
Hajime Hoshi
56f4e6b2d0
internal/graphicsdriver/opengl: Refactoring: Rename a variable
2021-07-03 02:41:37 +09:00
Hajime Hoshi
269ea7c489
internal/graphicsdriver/opengl: Refactoring: Reorder functions
...
glPixelStorei affects the result of glTexImage2D. This change makes
this fact more explicit.
2021-07-03 02:09:47 +09:00
Hajime Hoshi
6b95dd0d4d
internal/graphicsdriver/metal: Refactoring: Unify two drawTriangles* functions
2021-07-02 00:25:43 +09:00
Hajime Hoshi
ff2dd6fe7e
internal/graphicsdriver/opengl: Refactoring: Unify two drawTriangles* functions
2021-07-02 00:02:21 +09:00
Hajime Hoshi
e9b6237f61
internal/driver: Refactoring: Merge two Draw* functions
2021-07-01 15:55:48 +09:00
Hajime Hoshi
b9d52c0267
internal/driver: Change InvalidImageID/InvalidShaderID to 0
2021-07-01 14:58:55 +09:00
Hajime Hoshi
73bf1f36e5
internal/driver: Define InvalidImageID / InvalidShaderID
2021-07-01 13:56:42 +09:00
Enrico
3ef1d04935
internal/uidriver/glfw: Bug fix: do not execute loop function if init failed ( #1689 )
...
In `internal/uidriver/glfw/run_notsinglethread.go`, if the `UserInterface.init()` function returns an error, the `loop` is
executed regardless and the error is discarded. This behavior will hide the error returned by `init()` and might trigger
some crashes (see #1688 ).
A partial fix was implemented in 6c4edf8
, however that commit alone is not enough: the code now is correctly returning
the error via the `ch` channel, but it still executes the `loop()` function. This merge request skips `loop()` call if `init()`
had an error.
Updates #1688
2021-06-29 23:51:25 +09:00
Hajime Hoshi
6c4edf8605
internal/uidriver/glfw: Bug fix: Abort the game immediately on error
...
Updates #1688
2021-06-29 02:23:17 +09:00
Hajime Hoshi
9c5b7b56b2
internal/graphics: Reafctoring
2021-06-28 23:28:43 +09:00
Hajime Hoshi
817d176994
internal/graphicscommand: Misspelling at newShaderCommand.String
2021-06-27 23:20:27 +09:00
Hajime Hoshi
c725937cc6
internal/graphics: Reuse the vertices backend
...
This is basically a reland of 9cb631e30f
.
This change locks the vertices backend at the end-frame phase to
protect from vertices usages by other goroutines.
Updates #1546
Closes #1681
2021-06-27 02:31:01 +09:00
Hajime Hoshi
699bb095c3
internal/atlas: Better algorithm to release the temporary pixels
2021-06-26 23:29:45 +09:00
Hajime Hoshi
067e3c004d
Remove internal/web
2021-06-26 17:04:00 +09:00
Hajime Hoshi
8ff42f55a1
internal/graphicsdriver/opengl: Give up restorign on browsers
...
Using restorable images is expensive as this sometimes requires to
load pixels from GPU. On browsers, just reloading the application
should be fine when the context lost happens.
Closes #1603
2021-06-26 16:54:21 +09:00
Hajime Hoshi
38ce46328a
internal/atlas: Reuse byte array for ReplacePixels
...
This reduces memory allocation at ReplacePixels.
Updates #1681
2021-06-26 03:48:25 +09:00
Hajime Hoshi
414a64ce78
internal/atlas: Allow extending a texture atlas
...
As PBO is no longer used (#1678 ), using a big atlas with
ReplacePixels is no longer problematic.
Closes #1674
Updates #1675
2021-06-24 21:35:36 +09:00
Hajime Hoshi
2a8e8d0eb6
internal/graphicsdriver/opengl: Stop using PBO
...
PBO was introduced to improve the performance at ReplacePixels,
but we found that PBO can degrades the performance. Also, now
multiple glTexImage2Ds are called successively like a batch, so
the situation is now different from that time when PBO was
introduced.
Let's remove PBO usages and wait and see.
Closes #1678
2021-06-24 21:20:58 +09:00
Hajime Hoshi
7f60cd41eb
internal/graphicsdriver/opengl: Refactoring: Remove unused arguments from texSubImage2D
2021-06-24 12:06:28 +09:00
Hajime Hoshi
fa8e271f2a
internal/atlas: Bug fix: Set the minimum texture size to 8192px
...
Closes #1675
Updates #1674
2021-06-19 18:52:08 +09:00
Hajime Hoshi
43c964a3b8
internal/thread: Refactoring
2021-06-15 00:43:48 +09:00
Hajime Hoshi
49c3c30c79
ebiten: Add IsWindowBeingClosed / SetWindowClosingHandled / IsWindowClosingHandled
...
IsWindowBeingClosed reports whether the window is being closed by
the user.
SetWindowClosingHandled sets whether the window closing is handled
or not. If the state is true, the window is not closed immediately
by the user and the game can handle the closing state. In this case,
the Update function should return an error in order to end the game.
This change also adds examples/windowclosing.
Closes #1574
2021-06-14 02:29:11 +09:00
Hajime Hoshi
f989ce4e64
internal/uidriver/glfw: Rename variables
2021-06-13 23:25:24 +09:00
Hajime Hoshi
bceb512e78
internal/glfw: Bug fix: build failure with GOOS=js
...
Updates #1672
2021-06-13 22:59:57 +09:00
Hajime Hoshi
ed6756662a
internal/glfw: Clean up the code
...
Updates #1672
2021-06-13 22:48:27 +09:00
Hajime Hoshi
3c2d562967
internal/glfw: Bug fix: NewCallbackCDecl objects were leaked
...
Callbacks created by NewCallbackCDecl were never released and then
they are leaked, especially when the window size was changed by
SetWindowSize on Windows.
This change defines new callback ID types with uintptr, and reuse
the callbacks.
Closes #1672
2021-06-13 22:23:01 +09:00
Hajime Hoshi
0cea5f2f1a
internal/glfw: Remove one of go-vet warnings
2021-06-13 14:41:39 +09:00
Hajime Hoshi
584c6524ee
internal/graphicsdriver/opengl: Refactring
2021-06-13 14:19:33 +09:00
Hajime Hoshi
b54ad73a2b
Add go:build comments with go1.17beta1 fmt
2021-06-11 01:11:46 +09:00
Hajime Hoshi
a627c41217
Remove support of Go 1.13 and Go 1.14
...
Updates #1258
Updates #1415
Updates #1462
2021-06-07 21:44:22 +09:00
Hajime Hoshi
040fcd930f
Revert "Revert 2 commits using ColorM cache"
...
This reverts commit dd7a8bc497
.
Reason: DrawTriangles worked fine for the reporter's purpose.
Updates #1655
2021-05-30 15:17:11 +09:00
Hajime Hoshi
dd7a8bc497
Revert 2 commits using ColorM cache
...
This reverts commit 87c8625692
.
This reverts commit a6dd6196b4
.
Reason: Performance regression (#1655 )
Closes #1655
2021-05-30 03:10:00 +09:00
Hajime Hoshi
58843b68f9
internal/hooks: Enable to return error at suspend/resume audio
2021-05-04 23:09:01 +09:00
Tom Lister
bea5ab3335
internal/uidriver/glfw: Native macOS implementation for setting cursor shape ( #1624 )
...
Updates #1624
2021-05-02 14:50:50 +09:00
Hajime Hoshi
b509ce523d
internal/uidriver/js: Bug fix: SetFullscreen didn't work on Safari
...
Updates #1611
2021-04-28 23:28:58 +09:00
Tom Lister
5d3a76cbe6
internal/uidriver/js: Implement {Set,}Fullscreen for browsers ( #1623 )
...
Closes #1611
2021-04-27 23:58:32 +09:00
Hajime Hoshi
091e51ae4c
internal/uidriver/glfw: Avoid allocating a new slice
2021-04-25 00:57:06 +09:00
Hajime Hoshi
e2ceb7b3a6
internal/uidriver/glfw: Call fromGLFWPixels from the main thread
...
fromGLFWPixels can invoke driverScaleFactor, and then using the main
thread is safer.
2021-04-24 23:30:51 +09:00
Hajime Hoshi
b6364c46fe
internal/clock: Misspelling
2021-04-24 23:24:11 +09:00
Hajime Hoshi
2534b78755
internal/clock: Simplify the logic to calculate tick per frame
...
Updates #1444
Updates #1597
2021-04-24 23:06:27 +09:00
Hajime Hoshi
2e6ecc766d
internal/clock: Integrate 'now' implementations
...
The Go runtime already uses QueryPerformanceCounter at runtime.nanotime.
2021-04-24 22:32:47 +09:00
Hajime Hoshi
011a524ac7
internal/clock: Update comments
2021-04-24 22:10:00 +09:00
Hajime Hoshi
91f8347500
internal/uidriver/glfw: Avoid busy loop by sleeping
...
Updates #1580
2021-04-24 05:19:23 +09:00
Hajime Hoshi
3df31c0fce
internal/uidriver/glfw: Bug fix: Deadlock at FramebufferSize callback
...
glfw.PollEvents might invoke multiple FramebufferSize callbacks in
theory, this is very rare though. In this case, the sending an object
to the channel never ends.
This change fixes this deadlock by using 'select'.
Closes #1618
2021-04-24 02:22:51 +09:00
Hajime Hoshi
ac9a18931c
internal/uidriver/glfw: Fix comments
...
Updates #1618
2021-04-23 03:28:14 +09:00
Hajime Hoshi
d446aa39a9
internal/uidriver/glfw: Bug fix: Always wait for SetFramebuffer
...
In case when the callback is not called, let's use timeout.
Updates #1618
2021-04-23 03:02:12 +09:00
Hajime Hoshi
c4c331b0d5
Fix misspellings
2021-04-21 22:50:00 +09:00
Hajime Hoshi
4cb6cb9d6a
internal/uidriver/glfw: Misspelling
2021-04-21 22:29:54 +09:00
Hajime Hoshi
1013ca9c66
internal/uidriver/glfw: Bug fix: A window can never be 'maximized' on fullscreen
...
When the window is fullscreen, calling MaximizeWindow never returned.
Apparently the attribute glfw.Maximized can never be true on the
fullscreen mode.
This change fixes the issue by checking the fullscreen state.
2021-04-21 22:25:14 +09:00
corfe83
d24313e236
internal/devicescale: Fallback to simpler logic when trying to get DPI from monitor and failing ( #1600 )
...
Closes #1612
2021-04-21 11:43:23 +09:00
Hajime Hoshi
c7dd9a4107
internal/uidriver/glfw: Bug fix: Wait for Restore/Maximize/Iconify finishes explicitly
...
On Linux (and probably other UNIX OSes), glfwRestore, glfwMaximize,
and glfwIconify returns even though the window state has not changed.
Wait for its finish by a for loop and glfw.PollEvents.
Closes #1608
2021-04-21 00:52:06 +09:00
Hajime Hoshi
58572fb000
internal/uidriver/glfw: Bug fix: Unexpected small window size on Linux
...
At the initial phase, GLFW window's GetSize seems unreliable. Do not
call it on Linux. On the other hand, this is still necessary on macOS.
Updates #1606
Closes #1609
2021-04-20 23:38:34 +09:00
Hajime Hoshi
ec5b806241
Revert "internal/uidriver/glfw: Bug fix: Delay to enable SetSize callback"
...
This reverts commit fbe6961528
.
Reason: This doesn't fix the issue unfortunately
2021-04-20 23:01:02 +09:00
Hajime Hoshi
fbe6961528
internal/uidriver/glfw: Bug fix: Delay to enable SetSize callback
...
On Linux, the SetSize callback is invoked with an unexpected value
at the initial phase. Just delay it until the initialization
finishes.
2021-04-20 22:53:48 +09:00
Hajime Hoshi
47f569e473
internal/uidriver/glfw: Bug fix: setWindowSize could not accept a fullscreen size
2021-04-20 20:09:04 +09:00
Hajime Hoshi
ee8bfcd837
internal/uidriver/glfw: Bug fix: Disable the SetSize callback for most of GLFW window functions
...
Updates #1576
Updates #1585
Closes #1606
2021-04-20 18:32:39 +09:00