Commit Graph

8510 Commits

Author SHA1 Message Date
Eric H
1fdc45e652
example: add a mouse capture example (#2642)
Closes #2641
2023-04-19 13:02:02 +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
65afb51d73 audio/wav: refactoring 2023-04-18 22:27:22 +09:00
Hajime Hoshi
74a79461e9 update dependencies 2023-04-18 01:57:27 +09:00
Hajime Hoshi
053617405b update purego to v0.4.0-alpha.4 2023-04-18 01:56:21 +09:00
Hajime Hoshi
eb6a773d3f internal/graphicscommand: remove unnecessary space chars 2023-04-18 01:19:28 +09:00
Hajime Hoshi
bf18a5e998 examples/shader: bug fix: normalize pos correctly 2023-04-17 22:36:31 +09:00
Hajime Hoshi
820548ed68 example/shader: make default.go more deterministic 2023-04-17 22:27:27 +09:00
Hajime Hoshi
df32901dce internal/shader: refactoring 2023-04-16 18:37:06 +09:00
Hajime Hoshi
e6d79889f9 update purego to v0.4.0-alpha.3 2023-04-14 01:06:30 +09:00
Hajime Hoshi
1c14ba8eeb examples/shader: add comments
Updates #1431
2023-04-13 14:16:55 +09:00
Hajime Hoshi
0776a54712 examples/shader: remove comments 2023-04-13 14:10:34 +09:00
Hajime Hoshi
2d6e13cda4 examples/shader: bug fix: wrong usages of position
Closes #2638
Updates #1431
2023-04-13 02:02:15 +09:00
Hajime Hoshi
ebbd0fc07d update purego 2023-04-11 09:32:01 +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
aeca79494f audio: bug fix: compile error 2023-04-08 19:40:59 +09:00
Hajime Hoshi
85f8423345 audio: rename constants
Updates #2630
2023-04-08 19:14:28 +09:00
Hajime Hoshi
6e22ebb73a update purego to v0.4.0-alpha.2 2023-04-06 01:20:25 +09:00
Hajime Hoshi
f59322257b .github/workflows: update Go versions 2023-04-05 02:48:28 +09:00
Hajime Hoshi
7bd29c0eb6 update purego 2023-04-03 23:55:02 +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
3564a44638 examples/windowsize: add a new flag -runnableonunfocused 2023-04-01 03:13:47 +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