Commit Graph

3772 Commits

Author SHA1 Message Date
divVerent
47de8027b9
internal/gamepaddb: fix mapping support for e.g. dpleft:-a0. (#2335)
SDL interprets this as "map -1 to 1, map 0 to -1", so we should do the same.

This fix contains two parts:
* Fix the intended output range.
* Also fix the formula to map a range to a range.
The fix does not change behavior if a "-a" mapping isn't used, as in any other case max-min == 1 or max+min == 0.

Fixes #2334
2022-09-20 00:34:46 +09:00
Hajime Hoshi
c7fcfe5bf7 internal/graphicsdriver/directx: refactoring
This makes more explicit that the pixels are sent after the slice
for the pixels finishes modification.
2022-09-19 00:31:44 +09:00
Hajime Hoshi
cfdf59ef8d internal/graphicsdriver/directx: revert changes to remove GetCopyableFootprints
This reverts these commits
* ccddd4ee20
* 8e40c2ce7e
* 2eb1efe3cc

Without GetCopyableFootprints, the test results on 32bit Windows seemed
much more flaky. This didn't fix the memory issue like #2294 anyway.
2022-09-19 00:26:59 +09:00
Hajime Hoshi
ccddd4ee20 internal/graphicsdriver/directx: refactoring: make the lifetime of uploadingStagingBuffer more explicit 2022-09-19 00:16:53 +09:00
Hajime Hoshi
8e40c2ce7e internal/graphicsdriver/directx: refactoring 2022-09-19 00:06:43 +09:00
Hajime Hoshi
2eb1efe3cc internal/graphicsdriver/directx: stop using GetCopyableFootprints
GetCopyableFootprints seems very conservative and returns a quite
big memory size. Instead of using the info from GetCopyableFootprints
let's use our own minimum footprint.
2022-09-18 23:10:15 +09:00
Hajime Hoshi
cd9477491d internal/gamepad: refactoring 2022-09-18 20:09:10 +09:00
Hajime Hoshi
78802f18d9 internal/glfwwin: remove GetProcAddress 2022-09-18 18:04:02 +09:00
Hajime Hoshi
129f201be4 internal/gamepaddb: use go:embed
Updates #1258
2022-09-17 21:02:07 +09:00
TotallyGamerJet
043397c20e
internal/ui: remove Cgo on darwin in ui_glfw_darwin.go (#2329)
Updates #1162
2022-09-16 11:53:46 +09:00
Hajime Hoshi
45b2bd7b2b internal/graphicsdriver/metal/mtl: remove a TODO comment 2022-09-16 11:48:59 +09:00
Hajime Hoshi
53df5aaaf0 internal/cocoa: rename _cmd to cmd 2022-09-16 02:32:12 +09:00
Hajime Hoshi
963eb2756a all: fix TODO comments 2022-09-16 02:02:02 +09:00
Hajime Hoshi
b13fa2817c internal/gamepad: clean up codes for Darwin
* Removes redundant assignments.
* Fixes types for the Apple libraries.

Updates #1162
2022-09-16 00:25:51 +09:00
TotallyGamerJet
4a569be6f6
internal/gamepad: remove Cgo on darwin (#2330)
Updates #1162
2022-09-16 00:11:59 +09:00
Hajime Hoshi
5404e4d68a all: replace io/ioutil with io and os
Closes #1770
2022-09-15 02:54:25 +09:00
Hajime Hoshi
d0556af8a4 internal/atlas: refactoring 2022-09-15 01:52:05 +09:00
Hajime Hoshi
31945563d8 internal/atlas: optimize adjustDestinationPixel
```
go test -bench=BenchmarkAdjustPixel -run=^$ -count=5 ./internal/atlas/
```

```
name           old time/op  new time/op  delta
AdjustPixel-8  2.59ns ± 1%  2.12ns ± 1%  -18.16%  (p=0.008 n=5+5)
```
2022-09-15 01:50:47 +09:00
Hajime Hoshi
9319266c01 internal/atlas: add a benchmark for adjustDestinationPixel 2022-09-15 01:25:26 +09:00
Hajime Hoshi
2cbc5e7b60 internal/cocoa: remove IsIOS
Use `runtime.GOOS == "ios"` instead.

Closes #1415
2022-09-15 01:04:37 +09:00
Hajime Hoshi
619a2ee4dd internal/gamepaddb: use runtime.GOOS instead of a build tag
Updates #1415
2022-09-15 00:27:11 +09:00
Hajime Hoshi
655cd4bf68 all: remove the build tag
Updates #1415
2022-09-15 00:23:40 +09:00
Hajime Hoshi
95bfa95a91 internal/graphicscommand: refactoring 2022-09-14 23:13:08 +09:00
Hajime Hoshi
86706c0335 internal/graphicsdriver/opengl: add opengles build tag
This enables to use OpenGL ES instead of OpenGL.

Closes #292
2022-09-13 11:10:48 -07:00
Hajime Hoshi
18fa00d25d internal/restorable: update comments 2022-09-14 02:20:11 +09:00
Hajime Hoshi
6179158812 internal/restorable: bug fix: no pixels were read only with DrawTriangles
Closes #2324
2022-09-14 02:17:14 +09:00
Hajime Hoshi
b36c21648f internal/restorable: refactoring: remove a redundant FlushCommands call
readPixelsFromGPU already flushes commands.
2022-09-13 08:43:02 -07:00
Hajime Hoshi
6b906bb813 internal/restorable: extend the staleRegion when the image is already stale on WritePixels
This is a kind of refactoring. There seems no case that this condition
change is really needed, but this is more logical.
2022-09-13 07:29:53 -07:00
Hajime Hoshi
67ceaf5874 internal/atlas: rename replacePixels -> writePixels 2022-09-13 06:39:29 -07:00
Hajime Hoshi
243c224003 internal/restorable: bug fix: wrong panic on mixing DrawTriangles and WritePixels
When DrawTriangles is called and then WritePixels is called on a
sub-image, a panic happened. However, this panic actually happens
only when the graphics driver requires restoring (e.g. OpenGL ES
on Android). The situation was very limited, but this was a real
problem on Android.

This panic was introduced to prevent a rendering bug by a inmature
graphics drivers, but we should no longer need this. This change
just removes the panic.

Updates #292
2022-09-13 06:18:55 -07:00
Hajime Hoshi
40362aa62d internal/restorable: bug fix: readPixelsFromGPU might be called for a non-stale image
Actually readPixelsFromGPUIfNeeded can invoke this.

Closes #2322
2022-09-13 15:34:43 +09:00
Hajime Hoshi
4824cbc755 internal/graphicscommand: bug fix: IsInvalidated was not concurrent-safe
This function was not called actually, so this is not a real problem.
However, this could be a potential problem for a future GLES driver (#292).

Updates #292
Closes #2321
2022-09-13 12:23:19 +09:00
Hajime Hoshi
6ea455f4e1 internal/graphicsdriver/opengl/gles: remove cString 2022-09-13 00:17:33 +09:00
Hajime Hoshi
e46bfd8d30 internal/graphicsdriver: rename files
Updates #292
2022-09-12 23:03:54 +09:00
Hajime Hoshi
7d6ee39c15 internal/gamepad: bug fix: a wireless Xbox controller didn't work correctly on macOS
The button and hat values must be adjusted by their minimum values.
See also GLFW's implementation.

Closes #266
2022-09-12 01:55:05 +09:00
Hajime Hoshi
89598df520 internal/gamepad: refactoring
Updates #2311
2022-09-11 22:44:06 +09:00
Hajime Hoshi
4629306f4b internal/gamepad: bug fix: wrong SDL ID on iOS
The gamepad database already worked well with this fix.

Closes #2311
2022-09-11 22:29:38 +09:00
Hajime Hoshi
14a3a0f6bc internal/graphicsdriver/opengl/gl: better error message 2022-09-10 14:21:59 +09:00
Hajime Hoshi
fe11facbb8 internal/graphicsdriver/opengl/gl: better error message 2022-09-10 14:14:42 +09:00
Hajime Hoshi
d8eaf0a394 internal/graphicsdriver/opengl/gl: reland: integrate files for ebitengine/purego
Closes #2313
2022-09-10 13:37:20 +09:00
Hajime Hoshi
45a9cdda30 Revert "internal/graphicsdriver/opengl/gl: integrate files for ebitengine/purego"
This reverts commit be8edb984f.

Reason: Test failures. See #2313

Updates #2313
2022-09-10 03:45:14 +09:00
Hajime Hoshi
be8edb984f internal/graphicsdriver/opengl/gl: integrate files for ebitengine/purego 2022-09-10 03:31:16 +09:00
Hajime Hoshi
fccb43e15b internal/graphicsdriver/directx: remove .errcheck_excludes_windows
These DirectX functions don't return any value and should not affect
the last error. Then it should be fine to ignore the returning values
from syscall.Syscall*.

Updates #2287
2022-09-10 03:03:18 +09:00
Hajime Hoshi
f2255b8fa6 internal/graphicsdriver/opengl/gl: remove .errcheck_excludes_windows
Updates #2287
2022-09-10 02:44:24 +09:00
Hajime Hoshi
b1fff313ac internal/glfwwin: remove .errcheck_excludes_windows
The third returning value of Syscall is GetLastError, and the functions
like glGetIntegerv should not change the error state. Then it is safe
to ignore the errors.

Updates #2287
2022-09-10 02:18:37 +09:00
Hajime Hoshi
b5acb1e53d internal/gamepad: remove .errcheck_excludes_windows
Updates #2287
2022-09-10 02:11:08 +09:00
Terra Brown
a1cc44833d
add errcheck static analysis (#2293)
Closes #2287
2022-09-10 01:52:46 +09:00
Hajime Hoshi
e505098e55 internal/ui: handle error at forceUpdateOnMinimumFPSMode
Updates #2287
2022-09-09 22:49:34 +09:00
Hajime Hoshi
4c76356803 internal/gamepad: refactoring 2022-09-09 22:31:47 +09:00
Hajime Hoshi
47558d20c5 internal/gamepaddb: enable the database for Android
Before this fix, the button and axis IDs are from the OS. These
didn't match with the SDL game controller databaes unfortunately.

This fix changes the assignments of the buttons and the axes to match
with the database.

Closes #2312
2022-09-09 22:20:39 +09:00