Commit Graph

4214 Commits

Author SHA1 Message Date
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
Hajime Hoshi
a9653d1e7a internal/gamepaddb: fix hat assignments for Android
Now Ebitengine's original mapping works, but the database doesn't
work due to differences of button assignments. Fix this later.

Updates #2309
2022-09-08 00:20:31 +09:00
Hajime Hoshi
4a851bcf27 internal/gamepaddb: fix the assignment of axes for Android
Updates #2309
2022-09-07 23:09:58 +09:00
Hajime Hoshi
f414e25b9d internal/gamepaddb: fix some button assignments for Android
Updates #2309
2022-09-07 15:54:14 +09:00
Hajime Hoshi
d66c599938 cmd/ebitenmobile: remove counting buttons and use a constant instead
Updates #2309
2022-09-07 15:43:11 +09:00
Hajime Hoshi
db1255cdf8 internal/gamepad: rename ButtonNum -> ButtonCount 2022-09-07 15:40:52 +09:00
Hajime Hoshi
b5d755b07a Revert "internal/gamepaddb: fix button assignments on Android"
This reverts commit e161b28bff.

Reason: this would break backward compatibility

Updates #2309
2022-09-07 15:37:22 +09:00
Hajime Hoshi
e161b28bff internal/gamepaddb: fix button assignments on Android
Updates #2309
2022-09-07 15:34:29 +09:00
Hajime Hoshi
f383580d7b internal/gamepad: bug fix: wrong ID usages on Android
* IDs should have been decoded to a byte slice before checking the
  value.
* Ebitengine doesn't treat HID devices on Android so far, so checking
  whether the device was HID or not didn't make sense.

Updates #2309
2022-09-07 01:05:14 +09:00
divVerent
34a500c305
internal/gamepad: ignore EPERM when opening gamepads (#2308)
This seems required for the Snap sandbox when probing a non-gamepad device node.

Closes #2307
2022-09-06 21:29:32 +09:00
Hajime Hoshi
bb406c9b8f internal/graphicsdriver/metal: bug fix: go vet failed
view must not be copied.

Updates #2282
2022-09-06 19:09:21 +09:00
Hajime Hoshi
35f597e682 internal/graphicsdriver: refactoring: remove FilterScreen
Closes #2282
2022-09-06 19:04:15 +09:00
Hajime Hoshi
bd43b42ee5 internal/ui: reland the screen shader in Kage
This change relads a part of the change to use the screen shader
instead of FilterScreen, but with the issue on iOS fixed.

Let's remove FilterScreen later.

Updates #2282
2022-09-06 18:48:19 +09:00
Hajime Hoshi
c19f45b91c internal/shader: bug fix: test failures
Updates #2304
2022-09-05 02:52:16 +09:00
Hajime Hoshi
4ade34bc02 internal/shaderir: bug fix: wrong argument check on pow
Closes #2304
2022-09-05 02:35:48 +09:00
Hajime Hoshi
1d487be57b internal/ui: refactoring: remove unused members from EbitengineWindowDelegate
Closes #2297
2022-09-03 23:48:40 +09:00
divVerent
9bc571af5e
internal/gamepad: fix a typo that caused oddly cut off gamepad names. (#2300)
This change allows gamepad names up to 256 characters, which is usually
enough. Before, names were cut off after 7 characters, matching the string
"Unknown" that is used if querying the name fails.

Closes #2300
2022-09-03 20:44:03 +09:00
Hajime Hoshi
55f6e8c3a1 internal/ui: rename EbitenWindowDelegate -> EbitengineWindowDelegate 2022-09-02 23:34:02 +09:00
Hajime Hoshi
0a92204e04 internal/ui: remove comments 2022-09-02 20:39:16 +09:00
Hajime Hoshi
7045605fdf internal/ui: bug fix: restore the window position after fullscreen exit on macOS
glfw.PollEvents was necessary to enable SetPos and SetSize after
exiting from fullscreen on macOS.

Closes #2296
2022-09-02 20:31:48 +09:00
Hajime Hoshi
4e4533c89d internal/ui: bug fix: do not call setFrame in windowDidExitFullScreen
Calling setFrame in windowDidExitFullScreen caused unexpected results
like a strange window size after fullscreen. Let's remove this.

By removing this, setting window position and size during fullscreen
will no longer work again. Let's fix this later.

Closes #2295
2022-09-02 17:48:23 +09:00
Hajime Hoshi
37bae461d1 internal/graphicsdriver/directx: bug fix: processtest failures
The command allocators should be reset only when the frame index was
updated.

Closes #2249
2022-09-02 12:48:06 +09:00
Hajime Hoshi
1762869791 internal/processtest/testdata: typo 2022-09-02 03:23:30 +09:00
Hajime Hoshi
c126dea7fb Revert "internal/graphicsdriver/directx: bug fix: do not reset command allocators at Begin"
This reverts commit 9d303e8dc5.

Reason: A GPU memory leak (#2292). Though this reverting reveals the error #2249
again, a memory leak is more critical. Then revert the change once, and then
take time to investigate how to resolve #2249.

Closes #2292
Updates #2249
2022-09-02 02:27:40 +09:00
Hajime Hoshi
cdf83ad2fc internal/atlas: dispose images at ReadPixels
Without resolveDeferred() at ReadPixels, many images are never disposed
in tests.

Updates #2292
2022-09-01 23:54:57 +09:00
Hajime Hoshi
7fab62158d internal/glfwwin: bug fix: do not allow maximizing window when the max size is specified
Closes #2289
2022-09-01 22:48:38 +09:00
Kacper Drobny
9c177c1b8e
internal/ui: allow maximizeWindow when no max boundaries are set (#2291)
Closes #2290
2022-09-01 22:34:17 +09:00
Hajime Hoshi
ae41530f1c internal/graphicscommand: move availableFilename to graphicscommand 2022-08-31 13:26:14 +09:00
Hajime Hoshi
d66c552912 internal/graphicscommand: bug fix: 0-sized image was included in dumped internal images
Updates #2270
2022-08-31 12:22:36 +09:00
Terra Brown
26a58d20b3
internal/graphicscommand: enable EBITENGINE_INTERNAL_IMAGES_KEY on browsers (#2283)
Closes #2270

Co-authored-by: Hajime Hoshi <hajimehoshi@gmail.com>
2022-08-31 03:10:10 +09:00
Hajime Hoshi
63e3c4adea Revert "internal/graphics: remove FilterScreen and use an original Kage program instead"
This reverts these commits

* 3259ef3daf
* 7c55065490
* 5bb70f485e

Reason: iOS crash. Probably we have to prepare a special rendering
pipeline for the final screen.

Closes #2278
2022-08-30 01:56:06 +09:00
Hajime Hoshi
f7c44f086f replace Ebiten with Ebitengine in comments 2022-08-29 11:17:17 +09:00
Hajime Hoshi
ec68534c73 internal/graphicsdriver/opengl: introduce EBITENGINE_OPENGL replacing ebitenginewebgl1
This change inroduces a new environment variable `EBITENGINE_OPENGL`
to replace the build tag `ebitenginewebgl1`.
2022-08-28 01:45:58 +09:00
Hajime Hoshi
313c70f4b4 internal/graphicsdriver/directx: support 32bit Windows
Closes #2088
2022-08-28 00:04:55 +09:00
Hajime Hoshi
610e9ce14c gofmt -s -w 2022-08-28 00:04:32 +09:00
Hajime Hoshi
fd5d142453 internal/restorable: bug fix: needed to copy the stale region when extending an image
Updates #2274
2022-08-27 23:29:50 +09:00
Hajime Hoshi
b2f874a244 image/rectangle: read pixels only for necessary parts
Closes #2274
2022-08-27 23:23:33 +09:00
Terra Brown
de35a5a6f1
ebiten: add Termination for a regular termination (#2272)
Closes #2266
2022-08-27 21:33:40 +09:00
Terra Brown
232cadf15a
internal/graphicscommand: browser screenshot/image dump support (#2269)
Closes #2265
2022-08-27 12:51:30 +09:00
Hajime Hoshi
3259ef3daf internal/ui: fix comments 2022-08-26 22:55:22 +09:00
Hajime Hoshi
7c55065490 internal/ui: simplify the screen shader 2022-08-26 22:49:17 +09:00
Hajime Hoshi
5bb70f485e internal/graphics: remove FilterScreen and use an original Kage program instead
Updates #2046
2022-08-26 17:41:29 +09:00
Hajime Hoshi
3b50e57f19 internal/ui: move convertUniforms to ui.Shader
This is a preparation to use a Kage program as the screen filter.

Update #2046
2022-08-26 17:41:26 +09:00
Hajime Hoshi
b858f36d54 remove the dependency on file2byteslice
Specify the version explicitly instead.
2022-08-23 16:34:55 +09:00
Hajime Hoshi
b28b323920 internal/shaderir: use parentheses for vector equal operators 2022-08-21 04:19:56 +09:00
Hajime Hoshi
833473316f internal/ui: forbide RestoreWindow when the window size limits are specified
Closes #2259
2022-08-20 22:36:37 +09:00
Hajime Hoshi
31141d5112 internal/ui: forbid maximizing window when a window size is limited
Closes #2258
2022-08-20 22:24:13 +09:00
Hajime Hoshi
e150745598 internal/ui: bug fix: do not register a framebuffer-size callback on macOS
When a decorating state is switched, a framebuffer-size callback was
invoked but with wrong parameters on macOS.

This callback was originally implemented for i3 window manager, and
was not needed for macOS. Then, let's not use this on macOS. Probably
we can also skip this registering on Windows.

Updates #1960
Closes #2257
2022-08-20 19:10:42 +09:00
Hajime Hoshi
85d54515cd internal/shader: check types for && and || correctly
Updates #2256
2022-08-19 17:34:03 +09:00
Hajime Hoshi
d6047f3988 internal/shader: add type checks to compare two values
Closes #2187
2022-08-19 17:03:29 +09:00
Hajime Hoshi
f63b87f675 internal/shader: refactoring 2022-08-19 15:24:00 +09:00
Hajime Hoshi
a4b9d3c241 internal/gamepaddb: update the database
Adopts 74ebd51889
2022-08-19 02:54:03 +09:00
Hajime Hoshi
590147acda internal/shader: add type checks for the builtin function texture2D
Note that texture2D is usually not called by users.

Closes #2184
2022-08-19 02:27:40 +09:00
Hajime Hoshi
63eee0600e internal/shader: add type checks for the builtin function transpose
Updates #2184
2022-08-19 01:57:24 +09:00
Hajime Hoshi
7a94cbbd62 internal/shader: add refract
Closes #2255
2022-08-19 01:48:35 +09:00
Hajime Hoshi
13ae8f5872 internal/shader: add type checks for the builtin function faceforward
Updates #2184
2022-08-19 01:48:30 +09:00
Hajime Hoshi
73f12fa704 internal/shader: add type checks for the builtin function smoothstep
Updates #2184
2022-08-19 01:27:01 +09:00
Hajime Hoshi
f3ea274d20 internal/shader: add type checks for the builtin function mix
Updates #2184
2022-08-19 01:19:20 +09:00
Hajime Hoshi
ec851a85f5 internal/shader: add type checks for the builtin function step
Updates #2184
2022-08-19 00:25:04 +09:00
Hajime Hoshi
34cc6405dd internal/shader: add type checks for the builtin function clamp
Updates #2184
2022-08-19 00:14:38 +09:00
Hajime Hoshi
82a9aac689 internal/shader: add type checks for the builtin function cross
Updates #2184
2022-08-18 23:45:01 +09:00
Hajime Hoshi
7af6c99954 internal/shader: add type checks for some builtin functions
Updates #2184
2022-08-18 23:21:25 +09:00
Hajime Hoshi
3aad4fada1 internal/shaderir: add comments
Updates #2253
2022-08-18 17:46:53 +09:00
TotallyGamerJet
05470f7706
internal/graphicsdriver/metal: remove C for macOS (#2243)
Updates #1162
2022-08-18 01:39:34 +09:00
Hajime Hoshi
fb775d806c internal/shader: disallow 'discard' in other functions than the fragment entry point
Closes #2248
2022-08-17 23:39:52 +09:00
Hajime Hoshi
9d303e8dc5 internal/graphicsdriver/directx: bug fix: do not reset command allocators at Begin
Closes #2249
2022-08-17 22:37:26 +09:00
Hajime Hoshi
e9e48919df internal/processtest: rename test 2022-08-17 22:04:51 +09:00
Hajime Hoshi
b211b79a5c internal/shader: use a return statement in a fragment shader entrypoint
Updates #2247
2022-08-17 22:02:13 +09:00
Hajime Hoshi
bf4648eb35 internal/shaderir: fix a wrong comment 2022-08-17 17:43:59 +09:00
Hajime Hoshi
cf92158e33 ebiten: bug fix: add an indirect function call for a fragment shader
Closes #2245
Closes #2247
2022-08-17 16:37:37 +09:00
Hajime Hoshi
bb2df24f83 internal/graphicsdriver/directx: use DXGI_PRESENT_TEST when the screen is invisible
This change also reduces FPS to about 10 when the screen is invisible
in order to save CPU power.

Closes #2181
2022-08-17 00:10:44 +09:00
Hajime Hoshi
5b182efe7e internal/ui: forbide SetWindowSize when the window is maximized
On Windows, changing the size of a maximized window results in
unexpected states. Let's forbid this.

On macOS, a maximized window is just a regular window so it is
OK to allow resizing by `SetWindowSize`.

On Linux or other Unix, the behavior depends on window systems
and it is hard to expect what would happen, so forbid this just in
case.

Closes #1986
2022-08-15 16:29:20 +09:00
Hajime Hoshi
bc8e2fe6ac internal/glfw: bug fix: the window should be focused when closing is handled
Closes #2165
2022-08-12 22:34:19 +09:00
Hajime Hoshi
dd292552d5 audio: move the implementation for NintendoSDK to Oto
Updates #2242
2022-08-12 20:53:55 +09:00
Hajime Hoshi
8081d0636a internal/cbackend: rename to nintendosdk
Updates #2242
2022-08-12 17:19:37 +09:00
Hajime Hoshi
e7c0a121c4 all: remove the build tag 'ebitencbackend'
This also automatically enables 'egl' when 'nintendosdk' is specified.

Updates #2242
2022-08-12 13:15:39 +09:00
Hajime Hoshi
dac6548c0c all: rename ebitenginecbackend to nintendosdk
Updates #2242
2022-08-12 02:05:29 +09:00
Hajime Hoshi
0578a831cc internal/microsoftgdk: initialize GDK on the Ebitengine side
Updats #2084
2022-08-11 21:45:13 +09:00
Hajime Hoshi
91797a6589 internal/microsoftgdk: remove dummy.c
Simply this was not needed.

Updates #2084
2022-08-11 21:23:13 +09:00
Hajime Hoshi
094726915b
ebiten: add IsStandardGamepadAxisAvailable and IsStandardGamepadButtonAvailable (#2241)
Closes #2040
2022-08-11 12:35:20 +09:00
Hajime Hoshi
85aabf734b internal/ui: remove panic at (*glfwWindow).Maximize
Just doing nothing is more consistent with other functions.

Updates #1990
2022-08-10 22:18:55 +09:00
Hajime Hoshi
4104abdf77 internal/ui: refactoring 2022-08-10 21:34:39 +09:00
Hajime Hoshi
b5196a5a7c internal/ui: bug fix: glfwWindow.IsMaximized should not return true on fullscreen
Closes #2239
2022-08-10 21:17:13 +09:00
Hajime Hoshi
7a936f7052 internal/ui: enable SetWindowSize even with fullscreen on macOS
Closes #1590
2022-08-10 15:57:59 +09:00
Hajime Hoshi
085b64006d internal/ui: refactoring: indentation 2022-08-10 15:47:50 +09:00
Hajime Hoshi
2ab255dd1c internal/ui: refactoring: delay the call of outsideSize() 2022-08-10 14:53:28 +09:00
Hajime Hoshi
7eff5cbd4a internal/ui: refactoring: separate updateSize into updateSize and outsideSize 2022-08-10 14:50:20 +09:00
Hajime Hoshi
2480871155 internal/ui: bug fix: compile error 2022-08-10 12:11:32 +09:00
Hajime Hoshi
57fc4d438b internal/ui: refactoring: separate the Windows API part to another file 2022-08-10 11:51:35 +09:00
Hajime Hoshi
a57560105f internal/ui: refactoring: add userInterfaceImplNative for each OS 2022-08-10 11:44:03 +09:00
Hajime Hoshi
d0fa68691c internal/ui: enable some functions even on fullsceen
This is thanks to a GLFW v3.3.8 change:
9950cc52df

Updates #1590
2022-08-10 09:00:33 +09:00
Hajime Hoshi
a84a738360 internal/ui: bug fix: collectionBehavior mattered for fullscreen
Closes #2238
2022-08-10 01:06:26 +09:00
Hajime Hoshi
205245b094 internal/shader: implement a new built-in function discard
Closes #1969
2022-08-09 11:31:59 +09:00
Hajime Hoshi
2826555044 internal/cbackend: remove CloseAudio 2022-08-08 12:38:27 +09:00
Hajime Hoshi
0217ed0544 ebiten: add WritePixels replacing ReplacePixels
Closes #2236
2022-08-08 03:50:27 +09:00
Hajime Hoshi
34aa52459e internal/ui: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:26 +09:00
Hajime Hoshi
bd1b9cdb9b internal/mipmap: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:21 +09:00
Hajime Hoshi
7061b34222 internal/buffered: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:11 +09:00
Hajime Hoshi
8ce84c6596 internal/atlas: rename ReplacePixels -> WritePixels 2022-08-08 03:24:46 +09:00
Hajime Hoshi
af894d5c83 internal/restorable: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:16:26 +09:00
Hajime Hoshi
7542bbc29c internal/graphicscommand: bug fix: test failures
Updates #2236
2022-08-08 03:10:50 +09:00
Hajime Hoshi
70f5e84098 internal/graphicsdriver: rename ReplacePixels to WritePixels
Updates #2236
2022-08-08 03:05:04 +09:00
Hajime Hoshi
ea04e2a9de ebiten: remove returning error from ReadPixels
- As ReadPixels should often be used at Draw, error handling would be hard.
- Make the API consistent with ReplacePixels.

Updates #1995
2022-08-08 02:48:25 +09:00
Hajime Hoshi
869147eda0 internal/graphicscommand: rename pixelCommand -> readPixelCommand
Updates #1995
2022-08-08 01:47:07 +09:00
Hajime Hoshi
81bd5b488c ebiten: add (*Image).ReadPixels
Closes #1995
2022-08-08 01:42:26 +09:00
Hajime Hoshi
72d5002e72 remove go2cpp support
Closes #2126
2022-08-07 22:17:53 +09:00
Hajime Hoshi
abcacc26d8 internal/glfwwin: update for GLFW v3.3.8
Closes #2214
2022-08-07 15:03:33 +09:00
Hajime Hoshi
98894d66fb internal/ui: revert the fix for #2183
- `CGEventSourceKeyState` cannot treat right modifier keys correctly.
- Unpaired keyup and keydown are very common (especially on browsers)
  and this is not a serious issue.

Updates #2183
2022-08-06 11:19:56 +09:00
Hajime Hoshi
6d87be7169 internal/ui, internal/mipmap: refactoring: replace At with ReadPixels
Updates #1995
2022-08-06 00:32:42 +09:00
Hajime Hoshi
6c22f3f1a8 internal/buffered: refactoring: replace At with ReadPixels
Updates #1995
2022-08-05 23:58:01 +09:00
Hajime Hoshi
bf5f7ee34d internal/restorable: refactoring: replace At with ReadPixels
Updates #1995
2022-08-05 23:37:27 +09:00
Hajime Hoshi
7b6ce7dcba internal/ui: bug fix: reset key states when the window is not focused on macOS
Updates #2183
2022-08-05 20:22:50 +09:00
Hajime Hoshi
e81c46a0d7 internal/ui: bug fix: vkKey definitions were not found on iOS 2022-08-05 19:10:42 +09:00
Hajime Hoshi
50f66963b0 internal/ui: refactoring 2022-08-05 19:07:47 +09:00
Hajime Hoshi
a7135ce10b internal/ui: fix build tags 2022-08-05 19:07:37 +09:00
Hajime Hoshi
a6004517dc internal/ui: use a direct method to get key states instead of events on macOS
Closes #2183
2022-08-05 19:04:01 +09:00
mattn
2bacecca24
fix typos (#2227) 2022-08-03 22:40:39 +09:00
mattn
3cd0daac67
go generate ./... with Go 1.19 (#2228) 2022-08-03 20:48:02 +09:00
Hajime Hoshi
764ec8c794 internal/atlas: refactoring 2022-08-02 01:13:46 +09:00
Herczog Zoltán
fabf3fb374
internal/graphicsdriver/metal: remove supportsMetal check (#2223)
Closes #2211
2022-07-31 21:20:53 +09:00
Vseslav Kochenov
3ac37e250f
ebiten: add ReadDebugInfo for getting debug info (only graphics libray so far) (#2222)
Closes #2177
2022-07-31 02:56:16 +09:00
Hajime Hoshi
2aa595de52 Revert "internal/graphicsdriver/directx: bug fix: check the error at CreateGraphicsPipelineState at initialization"
This reverts commit c183555cc8.

Reason: this didn't help anything on the reporter's machine
2022-07-31 00:46:26 +09:00
Hajime Hoshi
95fb4370db internal/glfwwin: remove the call of RemovePropW
This is unnecessary, and doesn't work on Xbox.

Also DestroyWindow doesn't work on Xbox so skip this on Xbox.

Updates #2084
2022-07-30 18:42:43 +09:00
divVerent
21207f827c
do not require installing file2byteslice to update go generate'd files. (#2221)
The tool is already referenced in go.mod, so it is trivial to just go run it -
that way, go generate can use it without the user explicitly installing it first.
2022-07-29 20:43:23 +09:00
Hajime Hoshi
c183555cc8 internal/graphicsdriver/directx: bug fix: check the error at CreateGraphicsPipelineState at initialization
CreateGraphicsPipelineState someitmes causes an error
DXGI_ERROR_DEVICE_HUNG, but we failed to know why.

Instead of fixing this, check the error earlier and use the fallback
grpahics library OpenGL in this case.

Updates #2198
2022-07-29 16:20:09 +09:00
Hajime Hoshi
3eeb401d22 internal/gamepaddb: refactoring 2022-07-29 12:17:55 +09:00
Hajime Hoshi
bacb630c5b internal/gamepaddb: bug fix: don't panic with invalid inputs
Closes #2218
2022-07-29 12:14:20 +09:00
Hajime Hoshi
ca8c36499d ebiten: recommend errors.Is instead of comparing the returned value directly
Closes #2152
2022-07-24 23:25:48 +09:00
Hajime Hoshi
9ea399e7cc internal/graphicsdriver/directx: typo 2022-07-20 01:24:08 +09:00
Hajime Hoshi
7025f195a7 internal/graphicsdriver/directx: check DirectX availability earlier for Wine
Closes #2114
2022-07-20 01:22:45 +09:00
Hajime Hoshi
e861080145 internal/graphicsdriver/directx: early error check for Wine
Updates #2114
2022-07-19 23:55:44 +09:00
Hajime Hoshi
f8acd5e7ee internal/graphicsdriver/directx: bug fix: D3D12CreateDevice could be called without creating a device 2022-07-19 03:22:46 +09:00
Hajime Hoshi
0f9ec45709 internal/graphicsdriver/directx: refactoring 2022-07-18 23:36:42 +09:00
Hajime Hoshi
0f52381580 ebiten: rename TPS functions
* SetMaxTPS() -> SetTPS()
* MaxTPS() -> TPS()
* CurrentTPS() -> ActualTPS()
* CurrentFPS() -> ActualFPS()

Closes #2071
2022-07-17 11:30:12 +09:00
Hajime Hoshi
356c625601 internal/gamepad: improve resetting vibrations 2022-07-16 02:44:54 +09:00
Hajime Hoshi
90ac7d047d internal/graphicsdriver/opengl/gl: bug fix: wrong build tag syntax 2022-07-15 23:34:09 +09:00
Hajime Hoshi
9e1a2bcb30 internal/gamepad: reorder function implements 2022-07-15 21:52:26 +09:00
Hajime Hoshi
d6547f12c6 internal/gamepad: implement gamepad vibrations for Xbox
Updates #2084
2022-07-15 21:33:23 +09:00
Hajime Hoshi
d231a35d3b internal/gamepad: bug fix: release IDirectInputDevice8W on disconnecting
Closes #2205
2022-07-15 15:44:40 +09:00
Hajime Hoshi
520a30f3c7 internal/gamepad: bug fix: memory leak on Xbox
Updates #2084
2022-07-15 15:12:56 +09:00
Hajime Hoshi
c14403f195 internal/gamepad: bug fix: Y axis values are opposite on Xbox
Updates #2084
2022-07-15 14:55:38 +09:00
Hajime Hoshi
b31ce0a568 internal/graphicsdriver/directx: update comments 2022-07-15 13:33:45 +09:00
Hajime Hoshi
b48c2aa103 internal/graphicsdriver/directx: bug fix: too many constant buffers could be allocated
Closes #2204
2022-07-15 03:40:24 +09:00
Hajime Hoshi
e3d025bf4f internal/graphicsdriver/directx: fix a wrong constant usage 2022-07-15 02:49:01 +09:00
Hajime Hoshi
8d74039617 internal/graphicsdriver/directx: increment numDescriptorsPerFrame
16 seems too conservative. Let's double it.

Updates #2188
2022-07-15 02:42:23 +09:00
Hajime Hoshi
9a35366380
internal/graphicsdriver/directx: batch ResourceBarrier commands (#2203)
Updates #2188
2022-07-15 02:34:38 +09:00
Hajime Hoshi
41edd98675 Revert "internal/graphicsdriver/directx: batch ExecuteCommandList"
This reverts commit f92107c2ee.

Reason: Performance regression

Updates #2188
2022-07-15 01:06:08 +09:00
Hajime Hoshi
f92107c2ee internal/graphicsdriver/directx: batch ExecuteCommandList
Updates #2188
2022-07-15 00:51:02 +09:00
Hajime Hoshi
82d31c5fb7 internal/graphicsdriver/directx: remove redundant resetting of allocators
Updates #2202
2022-07-15 00:13:28 +09:00
Hajime Hoshi
479483b76d internal/graphicsdriver/directx: bug fix: need to reset command allocators
Closes #2202
2022-07-14 21:21:55 +09:00
Hajime Hoshi
b3267a7126 internal/graphicsdriver/directx: bug fix: wrong offsets
* Wrong offsets were speicified when creating a constant buffer view and
  a shader resource view.
* Wrong root descriptor tables were speicified. For one draw command,
  one descriptor table for a constant buffer and textures should be used.

Updates #2198
Closes #2201
2022-07-14 03:01:40 +09:00
Hajime Hoshi
42d5d91829 internal/graphicsdriver/directx: unmap constant buffers appropriately
Updates #2198
2022-07-14 01:54:34 +09:00
Hajime Hoshi
6f182d1124 internal/graphicsdriver/directx: fix a suspicious error chceck 2022-07-14 01:45:21 +09:00
Hajime Hoshi
7bf179472b internal/restorable: change the naming convention: Num -> Count 2022-07-13 02:11:12 +09:00
Hajime Hoshi
921aeb4ea7 audio: rename channelNum -> channelCount 2022-07-13 02:08:38 +09:00
Hajime Hoshi
16ff5c5039 internal/shaderir: change the naming convention: Num -> Count 2022-07-13 02:02:48 +09:00
Hajime Hoshi
dce34d2306 internal/shader: change the naming convention: Num -> Count 2022-07-13 02:02:48 +09:00
Hajime Hoshi
afed6a83c6 internal/graphics: change the naming convention: Num -> Count
This change also renames ebiten.MaxIndicesNum -> ebiten.MaxIndicesCount.
2022-07-13 02:02:44 +09:00
Hajime Hoshi
2203c3c448 internal/ui: remove the keypress event and the charCode preperty usages
These APIs are deprecated.

Closes #2199
2022-07-12 23:36:58 +09:00
Hajime Hoshi
55adc2113e internal/clock: Update -> UpdateFrame 2022-07-12 13:18:49 +09:00
Hajime Hoshi
e05df6a778 internal/ui: refactoring 2022-07-12 12:47:34 +09:00
Hajime Hoshi
d4e1787154 internal/clock: refactoring 2022-07-12 12:42:16 +09:00
Hajime Hoshi
c5e952d196 internal/ui: refactoring: reduce members from globalState 2022-07-12 12:35:07 +09:00
Hajime Hoshi
08e54ae1a6 internal/ui: rename the TPS functions
Updates #2071
2022-07-12 12:25:57 +09:00
Hajime Hoshi
b8367da7e2 internal/graphics: optimize imageSrcNUnsafeAt 2022-07-11 01:07:06 +09:00
Hajime Hoshi
b27b7ec483 internal/graphicsdriver/directx: use CreateEventEx to follow the official example 2022-07-10 22:44:40 +09:00
Hajime Hoshi
4c121ae5eb internal/graphicsdriver/directx: bug fix: a wrong fence value was passed to SetEventOnCompletion 2022-07-10 22:24:39 +09:00
Hajime Hoshi
a22125a075 internal/graphicsdriver/directx: bug fix: ResizeBuffers failed without the flag
Closes #2193
2022-07-10 19:55:28 +09:00
Hajime Hoshi
4afabe34ae internal/shader: optimization: remove unnecessary local variables
Updates #2034
Updates #2188
2022-07-10 19:01:58 +09:00
Hajime Hoshi
b6a340a96f internal/shader: optimization: use a regular return for a function with one output parameter
Updates #2034
Updates #2188
2022-07-10 18:18:46 +09:00
Hajime Hoshi
8c879c7bcf internal/shader: refactoring 2022-07-10 16:02:50 +09:00
Hajime Hoshi
bf0f3d304b internal/graphicsdriver/directx: add optimization flag to D3DCompile
Updates #2034
Updates #2188
2022-07-10 02:55:16 +09:00
Hajime Hoshi
0035ba0bd1 internal/graphicsdriver/directx: allow tearing when vsync is off
Updates #2034
Updates #2188
2022-07-10 01:17:36 +09:00
Hajime Hoshi
a32a137fa8 internal/graphicsdriver/directx: skip unnecessary flushing commands
Updates #2034
Updates #2188
2022-07-10 00:24:14 +09:00
Hajime Hoshi
b2a1b9a9a2 internal/shader: bug fix: float constant didn't work with assign operators 2022-07-09 22:29:42 +09:00
Hajime Hoshi
55c7a2df6c internal/graphicsdriver/opengl/gl: bug fix: wrong build tags 2022-07-09 16:15:56 +09:00
Hajime Hoshi
28fd3ec9e5 add the ebitengine version build tags besides the ebiten version
Closes #2111
Updates #2190
2022-07-09 15:38:03 +09:00
Hajime Hoshi
428b1263d9 add ebitenginecbackend build tag besides ebitencbackend
Updates #2111
Updates #2190
2022-07-09 15:23:52 +09:00
Hajime Hoshi
204fb5935b add new environment variables with the EBITENGINE_ suffix
Updates #2111
Updates #2190
2022-07-09 15:00:28 +09:00
Hajime Hoshi
a5179b9491 internal/shaderir/glsl: bug fix: test failures with OpenGL
Updates #2186
2022-07-09 02:43:48 +09:00
Hajime Hoshi
c01821ca5c internal/shader: use all functions for vector comparisons
Updates #2186
2022-07-09 02:30:16 +09:00
Hajime Hoshi
3d5031571d internal/graphicsdriver/directx: add the original source at D3DCompile errors 2022-07-09 01:59:51 +09:00
Hajime Hoshi
6dcd2ff11c internal/shader: bug fix: wrong assignment rule for booleans 2022-07-08 02:19:42 +09:00
Hajime Hoshi
87be157b23 internal/shader: refactoring 2022-07-08 01:09:42 +09:00
Hajime Hoshi
a3590cb258 internal/shader: add type checks to bool/int/flaot
Updates #2184
2022-07-08 00:22:55 +09:00
Hajime Hoshi
faa2ad5c6f internal/shader: add type checks for mat2/mat3/mat4
Updates #2184
2022-07-07 23:05:26 +09:00
Hajime Hoshi
f89277fd85 internal/shader: add type checks to vec2/vec3/vec4
Updates #2184
2022-07-07 00:20:02 +09:00
Hajime Hoshi
a866fe7391 internal/graphicscommand: improve debug command messages for shaders 2022-07-06 19:29:19 +09:00
Hajime Hoshi
8522bfd0bf internal/graphicscommand: bug fix: replacePixelsCommand should not read pixels
Reading pixels, writing pixels, and using the image as a source might
cause a flaky behavior with Metal. Stop reading pixels if possible.

Closes #2180
2022-07-05 23:30:26 +09:00
Hajime Hoshi
dd805c9414 internal/atlas: remove a wrong comment
(*restrable.Image).ReplacePixels can take overlapped regions.
See TestOverlappedPixels.

Updates #2180
2022-07-05 13:59:23 +09:00
Hajime Hoshi
08ebab0558 internal/ui: better fix for initialMonitorByOS
Updates #2179
2022-07-04 14:42:21 +09:00
Hajime Hoshi
47c65a92ae internal/graphicsdriver/directx: bug fix: ignore DXGI_STATUS_OCCLUDED
When a screen is locked, an Ebitengine application crashed as the
swap chain's Present returned DXGI_STATUS_OCCLUDED.

Let's ignore the error and continue to run the applications. In the
ideal world, an application should stop running during the screen lock,
so let's revisit this later.

This fix also fixes the issue that a Win32API GetCursorPos returned
an error ERROR_ACCESS_DENIED when the screen was locked.

Closes #2179
2022-07-04 12:55:36 +09:00
Hajime Hoshi
fb23e4b578 internal/processtest/testdata: fix col and row
Updates #2154
2022-07-04 12:07:39 +09:00
Hajime Hoshi
5411e8136b ebiten: bug fix: use DrawTriangles as an implementation of Set
Closes #2154
2022-07-04 12:02:47 +09:00
Hajime Hoshi
7d725f3e58 Revert "internal/graphicscommand: bug fix: using an image just after ReplacePixels might fail on Metal"
This reverts commit c31cc4ecff.

Reason: This didn't fix the issue.

Updates #2154
2022-07-04 11:50:06 +09:00
Hajime Hoshi
c31cc4ecff internal/graphicscommand: bug fix: using an image just after ReplacePixels might fail on Metal
Inserting a dummy rendering command after ReplacePixels and before
DrawTriangles solved the issue. This is a very dirty hack, but
there seems no other better way.

Closes #2154
2022-07-03 15:59:18 +09:00
Hajime Hoshi
afe1a93648 internal/graphicscommand, internal/graphicsdriver/metal: remove unused code 2022-07-03 15:23:52 +09:00
Hajime Hoshi
12533c2cce Revert "internal/graphicsdriver/metal: bug fix: need to commit replace-pixels commands at DrawTriangles"
This reverts commit ac802cf0d0.

Reason: This caused flickerings, and didn't solve #2154

Updates #2154
Closes #2174
2022-07-03 12:17:58 +09:00
Hajime Hoshi
ac5c48f575 internal/gamepad: support Xbox
Updates #2084
2022-07-02 01:02:24 +09:00
Hajime Hoshi
a6f6fdbfb7 internal/gamepad: update for Xbox
Updates #2084
2022-07-01 20:43:49 +09:00
Hajime Hoshi
97039ff714 internal/gamepad: implement gamepad detection callbacks for Xbox
Updates #2084
2022-07-01 17:15:11 +09:00
Hajime Hoshi
298d6488cc internal/affine: add test
Updates #2170
2022-07-01 01:46:37 +09:00
Hajime Hoshi
8cdfa4f66c internal/affine: create a fast path for ChangeHSV
When hue = 0 and saturation = 1, this should be the same as scaling.

Closes #2170
2022-06-30 11:32:12 +09:00
Hajime Hoshi
a9c9e18ff4 internal/graphicscommand: better strings for ColorM 2022-06-30 11:13:02 +09:00
Hajime Hoshi
0eb2f76422 internal/buffered: refactoring 2022-06-25 01:42:40 +09:00
Hajime Hoshi
bf27f25e26 internal/gamepad: bug fix: build failures on FreeBSD 2022-06-25 01:36:13 +09:00
Hajime Hoshi
c490347cef internal/buffer: bug fix: shader manipulations must be buffered
Closes #2162
2022-06-25 01:31:20 +09:00
Hajime Hoshi
2d23168aca iinternal/gamepad: start implementation for Xbox
Updates #2084
2022-06-25 00:02:12 +09:00
Hajime Hoshi
3fb3997160 internal/gamepad: separate the Xbox part
Updates #2084
2022-06-24 22:49:37 +09:00
Hajime Hoshi
847c4f067a internal/gamepad: make nativeGamepad(s) interfaces
This is a preparation to switch the gamepad implementation for Xbox.

Updates #2084
2022-06-24 21:52:48 +09:00
Hajime Hoshi
f1037d8bff internal/ui: handle gamepad errors 2022-06-24 20:20:49 +09:00
Hajime Hoshi
0cd43bd081 internal/gamepad: stop embedding a member into a struct
This is a preparation to switch the gamepad implementation for Xbox.

Updates #2084
2022-06-24 19:01:50 +09:00
Hajime Hoshi
712940cb02 internal/graphicsdriver/directx: bug fix: leave mapped regions for constant buffers
Mapping for a constant buffer every frame might sometimes fails. We
are not sure the reason, but in the official examples, leaving mapped
regoins seems the way to go.

Updates #2084
Closes #2157
2022-06-23 17:09:46 +09:00
Hajime Hoshi
506d534370 internal/ui: fix window sizes for Xbox
Updates #2084
2022-06-23 14:50:41 +09:00
Hajime Hoshi
c93cecdc2b internal/graphicsdriver/directx: accept S_FALSE at ScheduleFrameEventX 2022-06-22 02:13:32 +09:00
Hajime Hoshi
7b05e59000 internal/graphicsdriver/directx: bug fix: wrong GUID for IDXGIDevice 2022-06-22 01:59:22 +09:00
Hajime Hoshi
8311ff1e46 internal/graphicsdriver/directx: bug fix: wrong pointer usage 2022-06-22 01:49:23 +09:00
Hajime Hoshi
10af36ee9f internal/jsutil: bug fix: unnecessary allocations of temporary ArrayBuffers
Closes #2156
2022-06-21 21:54:02 +09:00
Hajime Hoshi
7e92b79a00 internal/graphicsdriver/directx: implement swap chains for Xbox
Updates #2084
2022-06-21 12:21:00 +09:00
Hajime Hoshi
a641f9ede0 internal/graphicsdriver/directx: refactoring 2022-06-20 23:40:53 +09:00
Hajime Hoshi
969e87fb89 internal/graphicsdriver/directx: fix moveToNextFrame for Xbox
Updates #2084
2022-06-20 00:41:34 +09:00
Hajime Hoshi
f8e9dcf035 internal/graphicsdriver/directx: refactoring 2022-06-19 17:58:04 +09:00
Hajime Hoshi
08c8c8089a internal/graphicsdriver/directx: bug fix: clear constant buffers at the end of DrawTriangles
Constant buffers should not be reset while a stencil buffer is used.

Closes #2138
2022-06-19 17:13:34 +09:00
Hajime Hoshi
ac802cf0d0 internal/graphicsdriver/metal: bug fix: need to commit replace-pixels commands at DrawTriangles
Closes #2154
2022-06-19 15:38:12 +09:00
Hajime Hoshi
667bf2ff9d internal/graphicsdriver/directx: refactoring 2022-06-19 01:44:31 +09:00
Hajime Hoshi
2a5b64bf4d internal/graphicsdriver/directx: suppress warnings for depth buffers
Updates #2138
2022-06-19 00:21:04 +09:00
Hajime Hoshi
81b3d7bfac internal/graphicsdriver/directx: add an assertion 2022-06-18 22:33:07 +09:00
Hajime Hoshi
f7a108e693 internal/graphicsdriver/directx: refactoring 2022-06-18 21:53:41 +09:00
Hajime Hoshi
b71a4975dd internal/graphicsdriver/directx: bug fix: wrong state transitions at screen images
This change fixes the following issues:
 * There should be two resource states for presenting targets, so an image
   for the screen must have two resource states, though it had only one
   in the current implementation.
 * At removeImage, the screen image was removed unexpectedly.

Updates #2081
Closes #2151
2022-06-18 19:01:59 +09:00
Hajime Hoshi
522660c1f9 internal/graphicsdriver/directx: fix fence usages
Updates #2034
Updates #2138
Updates #2149
2022-06-18 15:44:54 +09:00
Hajime Hoshi
e78d888b24 internal/graphicsdriver/directx: handle error at Signal 2022-06-18 02:53:12 +09:00
Hajime Hoshi
0c38d6faeb internal/graphicsdriver/directx: add comment about frames
Updates #2034
2022-06-18 01:18:49 +09:00
Hajime Hoshi
a16ffef499 internal/graphicsdriver/directx: update frameIndex at present
This follows the official GDK samples.
2022-06-18 01:09:54 +09:00
Hajime Hoshi
07a558b38d internal/graphicsdriver/metal: bug fix: the default driver must be initialized on the main thread
Closes #2147
2022-06-17 14:58:26 +09:00
Hajime Hoshi
b43312fe80 internal/graphicsdriver/directx: add comments
Updates #2142
2022-06-17 12:19:36 +09:00
Hajime Hoshi
2f84e77e74 internal/graphicsdriver/directx: fallback to OpenGL when initialization fails
Closes #2142
2022-06-17 12:12:44 +09:00
Hajime Hoshi
9962fc5ee5 internal/graphicsdriver/direct: replace Get -> NewGraphics
Updates #2142
2022-06-17 11:48:40 +09:00
Hajime Hoshi
138463e219 internal/ui: rename chooseGraphicsDriver -> newGraphicsDriver 2022-06-17 02:40:39 +09:00
Hajime Hoshi
7484df0c5e internal/graphicsdriver/metal: replace Get with NewGraphics
This is a prepartion to return an error when a graphics driver, especially
DirectX, fails to initialize.

Updates #2142
2022-06-17 02:40:35 +09:00
Hajime Hoshi
a6d415ebf2
internal/graphicsdriver/opengl: replace Get with NewGraphics (#2146)
This is a prepartion to return an error when a graphics driver, especially
DirectX, fails to initialize.

Updates #2142
2022-06-17 02:02:29 +09:00
Hajime Hoshi
195b060911 internal/graphicsdriver/metal: refactoring: initialize the driver at Get 2022-06-16 23:52:55 +09:00
Hajime Hoshi
76d88b276a internal/graphicsdriver/directx: call C++ side for ID3D12GraphicsCommandList functions
Updates #2084
2022-06-13 22:35:58 +09:00
Hajime Hoshi
4aebcd2a04 internal/graphicsdriver/directx: bug fix: consider empty slices as arguments 2022-06-13 17:51:02 +09:00
Hajime Hoshi
c08d79d2ce internal/graphicsdriver/directx: keep runtime.KeepAlive for Xbox 2022-06-13 17:36:58 +09:00
Hajime Hoshi
4adf46c2b0 internal/graphicsdriver/directx: refactoring 2022-06-13 17:25:27 +09:00
Hajime Hoshi
348435f769 internal/graphicsdriver/directx: fix a constant value for Xbox
Updates #2084
2022-06-13 14:23:29 +09:00
Hajime Hoshi
44cfb92cee internal/ui: bug fix: MaximizeWindow before Run caused an unexpected error on Windows
Closes #2137
2022-06-13 12:28:20 +09:00
Hajime Hoshi
aef5402831 internal/graphicsdriver/directx: remove unused function 2022-06-13 01:35:31 +09:00
Hajime Hoshi
bcb2fe8c93 internal/graphicsdriver/directx: enable D3D12SerializeRootSignature for Xbox
Updates #2084
2022-06-13 01:02:48 +09:00
Hajime Hoshi
253f2757d1 internal/atlas: add a test to modify pixels after ReplacePixels call 2022-06-11 23:44:29 +09:00
Hajime Hoshi
08b52698c6 internal/graphicsdriver/directx: call C++ side for some functions for Xbox
Updates #2084
2022-06-11 19:37:17 +09:00
Hajime Hoshi
4a19d645b7 internal/graphicsdriver/opengl: remove a comment 2022-06-11 15:36:10 +09:00
Hajime Hoshi
71a32d2036 internal/ui: pass the canvas element directly instead of an ID 2022-06-11 15:34:17 +09:00
Hajime Hoshi
95628ee5f7 internal/ui: add a unique ID to the canvas for browsers 2022-06-11 15:24:50 +09:00
Hajime Hoshi
d42bb7d699 internal/graphicsdriver/directx: add a comment for Xbox
Updates #2084
2022-06-11 14:20:21 +09:00
Hajime Hoshi
826afcb9cc internal/graphicsdriver/directx: fix CopyTextureRegion for Xbox
Updates #2084
2022-06-10 22:51:04 +09:00
Hajime Hoshi
abef203a70 rename github.com/ebitne/purego -> github.com/ebitengine/purego 2022-06-10 21:59:01 +09:00
Hajime Hoshi
07aa906753 internal/graphicsdriver/directx: fix GetCPU/GPUDescriptorHandleForHeapStart for Xbox
Updates #2084
2022-06-10 21:35:20 +09:00
Hajime Hoshi
b9373c498b internal/graphicsdriver/directx: fix CreateCommandList for Xbox
Updates #2084
2022-06-10 16:44:07 +09:00
Hajime Hoshi
37369a2f4b internal/atlas: add TestMaxImageSizeJust 2022-06-10 14:30:18 +09:00
Hajime Hoshi
03567f74f9 internal/atlas: bug fix: respect injected maxSize for testings 2022-06-10 14:25:08 +09:00
Hajime Hoshi
7c458f519e internal/atlas: remove unnecessary comments 2022-06-10 13:53:24 +09:00
Hajime Hoshi
6b814888b5 internal/atlas: always use DrawTriangles at putOnAtlas
DrawTriangles was introduced at #1508, and apparently there is no
reason we should use ReplacePixels here. So, simplify the logic by
using only DrawTriangles.
2022-06-10 02:58:04 +09:00
Hajime Hoshi
bdae45be8f internal/atlas: add assertions 2022-06-10 02:38:35 +09:00
Hajime Hoshi
116e131ccf internal/atlas: rename ImageTypeIsolated -> ImageTypeUnmanaged 2022-06-10 02:11:08 +09:00
Hajime Hoshi
b40022b286 internal/atlas: stop using padding for ImageTypeVolatile and ImageTypeIsolated
Closes #2131
2022-06-10 00:54:48 +09:00
Hajime Hoshi
9e34103491 internal/atlas: refactoring: make paddingSize a method
Updates #2131
2022-06-10 00:23:25 +09:00
Hajime Hoshi
5290605b2d internal/atlas: add comments 2022-06-08 11:18:08 +09:00
Hajime Hoshi
9ee56ac320 inetrnal/atlas: remove unnecessary (and risky) locks 2022-06-08 10:05:15 +09:00
Hajime Hoshi
3b6a080519 internal/atlas: bug fix: use the global lock for shaders
Closes #2129
2022-06-08 10:00:31 +09:00
Hajime Hoshi
83ac234142 internal/ui: bug fix: offscreen images were created too often unexpectedly 2022-06-08 09:26:22 +09:00
Hajime Hoshi
6b212d7642 internal/restorable: refactoring: add Image.needsRestoring 2022-06-08 02:24:10 +09:00
Hajime Hoshi
9f729cf5c3 internal/restorable: remove SetVolatile 2022-06-08 02:20:09 +09:00
Hajime Hoshi
81f91658ff internal/atlas: refactoring: remove SetVolatile and SetIsolate
Pass an image type to NewImage instead.
2022-06-08 01:08:00 +09:00
Hajime Hoshi
b8e8d72377 internal/restorable: rename ImageTypeScreenFramebuffer -> ImageTypeScreen 2022-06-07 23:45:35 +09:00
Hajime Hoshi
d3e3df812a internal/ui: recreate an offscreen image when isScreenClearedEveryFrame is toggled
This is a preparation to remove SetVolatile and SetIsolated in
the atlas package.
2022-06-07 23:16:42 +09:00
Hajime Hoshi
6398230f84 internal/graphicscommand: add 'screen' info to (*newImageCommand).String() 2022-06-06 11:13:04 +09:00
Hajime Hoshi
73c893e977 internal/restorable: refactoring: unify NewScreenFramebufferImage and NewImage 2022-06-06 09:33:50 +09:00
Hajime Hoshi
31fd736ca5 internal/graphicscommand: refactoring: unify NewScreenFrameBufferImage and NewImage 2022-06-06 09:21:11 +09:00
Hajime Hoshi
cb0cbb4efa internal/restorable: refactoring: introduce ImageType 2022-06-06 09:13:55 +09:00
Hajime Hoshi
7f10744514 internal/atlas: add an assertion at putOnAtlas 2022-06-06 09:01:04 +09:00
Hajime Hoshi
9bf5f2188f internal/atlas: add an assertion at SetIsolated 2022-06-06 08:25:43 +09:00
Hajime Hoshi
86a0a4154d internal/atlas: rename SetIsolate -> SetIsolated 2022-06-06 07:17:45 +09:00
Hajime Hoshi
b9012fc6ed internal/atlas: unify the term 'isolate' and 'independent' to 'isolate' 2022-06-06 00:28:23 +09:00
Hajime Hoshi
6ce8f77c53 gofmt 2022-06-06 00:28:19 +09:00
Hajime Hoshi
0256b0cfbf internal/graphicsdriver/directx: bug fix: disable fullscreen by Alt+Enter
By default, DirectX 12 tries to make the window fullscreen by Alt+Enter.
This caused application crashes. Let's disable this feature.

Closes #2123
2022-06-05 16:16:09 +09:00
Hajime Hoshi
51fe48fb76 internal/gamepad: bug fix: wrong offset especially on 32bit Linux
Closes #2122
2022-06-05 12:48:47 +09:00
Hajime Hoshi
5cdd2f8bce internal/affine: further optimization to avoid heap allocation
Updates #2119
2022-06-04 15:13:30 +09:00
Hajime Hoshi
d518e64e22 Revert "internal/graphicsdriver/directx: refactoring: add syscallN"
This reverts commit 55a490736a.

Reason: This has a potential risk of stack overflow.

Closes #2120
2022-06-04 13:58:01 +09:00
Hajime Hoshi
ecaa25faba internal/affine: avoid heap allocations by casting a variable to a concrete type
This is a dirty hack but seems efficient.

Closes #2119
2022-06-04 13:18:14 +09:00
Hajime Hoshi
f69c550992 internal/graphicsdriver/directx: bug fix: go:nosplit was required for syscallN
Updates #2116
Closes #2117
2022-06-04 01:11:22 +09:00
Hajime Hoshi
55a490736a internal/graphicsdriver/directx: refactoring: add syscallN
syscall.SyscallN is available as of Go 1.18 so this change implemented
our original syscallN function.

syscallN also panics when a given function pointer is 0. This helps
debugging especially on Xbox.

Updates #2084
2022-06-03 21:56:34 +09:00
Hajime Hoshi
3e1b313221 internal/graphicsdriver/directx: bug fix: ID3D12Resource::Map sometimes retrying
Updates #2113
Closes #2116
2022-06-03 21:56:30 +09:00
Hajime Hoshi
8e4e3d67c4 internal/gamepad: refactoring 2022-06-03 19:00:21 +09:00
Hajime Hoshi
2eb4ef1a94 internal/gamepad: give a window from another package instead of GetActiveWindow
GetActiveWindow doesn't work on Xbox.

Updates #2084
2022-06-03 18:42:54 +09:00
Hajime Hoshi
1580e92dfc internal/gamepad: refactoring 2022-06-03 18:06:54 +09:00
Hajime Hoshi
90d26305e7 internal/gamepad: unify the naming convention for Win32API with other packages 2022-06-03 16:59:44 +09:00
Hajime Hoshi
124f233de0 internal/gamepad: cast returning values to uint32 2022-06-03 16:52:49 +09:00
Hajime Hoshi
532b476c4e Revert "internal/graphicsdriver/directx: pass nil for pReadRange at Map"
This reverts commit 3b13158cc0.

Reason: Specifying nil for reading ranges is not efficient
2022-06-03 13:59:34 +09:00
Hajime Hoshi
c6c45aadfa Revert "Revert "internal/glfwwin: ignore errors from DWM functions""
This reverts commit 991cec993c.

Reason: Reverted a wrong commit
2022-06-03 13:59:16 +09:00
Hajime Hoshi
991cec993c Revert "internal/glfwwin: ignore errors from DWM functions"
This reverts commit 9ad87c0153.

Reason: Specifying nil for reading ranges is not efficient
2022-06-03 13:49:45 +09:00
Hajime Hoshi
3b13158cc0 internal/graphicsdriver/directx: pass nil for pReadRange at Map
Updates #2113
2022-06-03 13:45:08 +09:00
Hajime Hoshi
9ad87c0153 internal/glfwwin: ignore errors from DWM functions
DWM functions might not be implemented on Proton. In the original
GLFW implementation, the returning values are not checked.

Updates #2113
2022-06-03 01:36:31 +09:00
Hajime Hoshi
c29c423686 internal/glfwwin, internal/graphicsdriver/directx: bug fix: HRESULT and Errno are imcompatible 2022-06-03 00:41:04 +09:00
Hajime Hoshi
7d95dddb1a internal/glfwwin: refactoring 2022-06-03 00:32:36 +09:00
Hajime Hoshi
666d50e83d internal/glfwwin: use HRESULT for an error value instead of GetLastError
GetLastError might not be reliable for some APIs like DwmFlush.

Updates #2113
2022-06-02 23:02:09 +09:00
Hajime Hoshi
4a9caf8afb internal/graphicsdriver/directx: ignore higher 32bit values for Errno
Updates #2113
2022-06-02 23:01:38 +09:00
Hajime Hoshi
fb03a1e351 internal/graphicsdriver/directx: bug fix: ID3D12Resource::Unmap does not return an value
Updates #2113
2022-06-02 12:52:58 +09:00
Hajime Hoshi
4a684c4195 treat Windows error values as uint32 instead of windows.Handle
The error value are defined as windows.Handle (64bit) in
golang.org/x/sys/windows, but an actual type should be HRESULT (32bit).
This causes an issue that a returning value from a Windows API was
recognized as a non-zero error value though the value was not an error,
when the value's lower 32-bits are all zero.

See also https://github.com/golang/go/issues/48736#issuecomment-1143993096

Updates #2113
2022-06-02 12:10:21 +09:00
Hajime Hoshi
b900f83a01 internal/graphicsdriver/directx: refactoring: remove an unused member Image.numRows 2022-06-02 01:53:27 +09:00
Hajime Hoshi
0dc6e4e64e internal/graphicsdriver/directx: use ID3D12Resource instead of ID3D12Resource1
Updates #2114
2022-06-02 01:26:02 +09:00
Hajime Hoshi
432365ff92 internal/glfwwin: ignore the error at SetProcessDpiAwarenessContext
Updates #2113
2022-06-01 23:11:06 +09:00
Hajime Hoshi
285a5cbc69 internal/glfwwin: skip some functions for Xbox
Updates #2084
2022-06-01 12:08:03 +09:00
Hajime Hoshi
0adb0c3860 internal/ui: bug fix: compile error 2022-06-01 02:09:10 +09:00
Hajime Hoshi
9c15bda275 internal/ui: return a null Window on Xbox
Updates #2084
2022-06-01 01:26:31 +09:00
Hajime Hoshi
ff868ba39f internal/ui: skip some functions for Xbox
Updates #2084
2022-06-01 00:58:36 +09:00
Hajime Hoshi
dcb5bb47c6 internal/glfw: unify the naming convension for Win32API 2022-06-01 00:48:22 +09:00
Hajime Hoshi
6fc71e97bb internal/glfwwin: skip some functions for Xbox
Updates #2084
2022-06-01 00:35:43 +09:00
Hajime Hoshi
aa4a2b64e0 internal/glfwwin: bug fix: update _glfw.windows 2022-06-01 00:01:07 +09:00
Hajime Hoshi
c99b948df3 internal/graphicsdriver/directx: refactoring
Updates #2084
2022-05-30 03:17:15 +09:00
Hajime Hoshi
d4226659ee internal/graphicsdriver/directx: initialize a device for Xbox
Updates #1162
2022-05-30 02:10:18 +09:00
Hajime Hoshi
59798d29f4 internal/graphicsdriver/directx: defer the initialization 2022-05-29 22:02:39 +09:00
Hajime Hoshi
b4491ab94d internal/graphicsdriver/directx: unify the naming convention with glfwwin 2022-05-29 21:18:23 +09:00
Hajime Hoshi
0081fa7a47 internal/graphicsdriver/directx: add a comment 2022-05-29 20:05:37 +09:00
Hajime Hoshi
ad380a32f4 internal/glfwwin: split GDK part to a new package internal/microsoftgdk
Updates #1162
2022-05-29 19:25:26 +09:00
Hajime Hoshi
7f46938ff7 internal/glfwwin: return an error at initWGL on Xbox
Updates #1162
2022-05-29 17:37:06 +09:00
Hajime Hoshi
59e6d4578b internal/glfw: skip some Win32APIs for Xbox
Updates #1162
2022-05-29 17:04:47 +09:00
Hajime Hoshi
ce147a7e38 internal/glfwwin: refactoring: remove Monitor.currentMode 2022-05-29 16:00:18 +09:00
Hajime Hoshi
2efbb819e0 internal/glfw: skip some Win32APIs for Xbox
Updates #1162
2022-05-29 15:54:37 +09:00
Hajime Hoshi
05d49c5a52 internal/glfwwin: create a pseudo monitor for Xbox
Updates #1162
2022-05-29 15:38:17 +09:00
Hajime Hoshi
f8163f93c0 internal/glfwwin: refactoring 2022-05-29 14:22:22 +09:00
Hajime Hoshi
ef7d10a36e internal/glfwwin: add a build tag microsoftgdk
Updates #1162
2022-05-29 01:31:42 +09:00
Hajime Hoshi
5c63c4a4aa internal/graphicsdriver/metal: support macOS 10.12 by removing packed types
From the Metal shading language specification [1] Table 2.2.3, attribute
variables in Ebitengine's vertices don't have to be packed. Then, we can
remove `packed` types.

[1] https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf

Closes #2107
2022-05-28 23:57:59 +09:00
Hajime Hoshi
ac922742bf internal/glfw: use shorter copyright comments 2022-05-27 20:38:45 +09:00
Hajime Hoshi
f7d1a43e98 internal/glfwwin: remove GammaRamp 2022-05-27 20:19:12 +09:00
Hajime Hoshi
df0208ec79 internal/glfwwin: remove unused exported functions 2022-05-27 20:15:36 +09:00
Hajime Hoshi
3a6b707b29 internal/glfwwin: remove unused members (a monitor size) 2022-05-27 20:12:43 +09:00
Hajime Hoshi
d577cc5e7d internal/graphicsdriver/opengl/gl: rename files
Updates #1162
2022-05-27 18:31:40 +09:00
TotallyGamerJet
726e88e520
internal/graphics/opengl/gl: remove CGO in openGL on macOS (#2104)
Updates #1162
2022-05-27 18:26:53 +09:00
Hajime Hoshi
f7172f41c8 internal/glfwwin: skip detecting monitors for Xbox
Updates #2084
2022-05-27 15:55:23 +09:00
Hajime Hoshi
c379873a1f rename Ebiten -> Ebitengine 2022-05-25 22:48:19 +09:00
Hajime Hoshi
1202e66114 internal/gamepad: bug fix: out of range at hatState on Windows
Closes #2103
2022-05-25 11:44:46 +09:00
Hajime Hoshi
7030840efa internal/graphicsdriver/opengl/gl: refactoring 2022-05-25 02:24:40 +09:00
Hajime Hoshi
604f14d2d4 internal/glfwwin: refactoring: reduce risky unsafe.Pointer usages 2022-05-25 02:21:30 +09:00
Hajime Hoshi
0d7062335e internal/glfwwin: remove GetProp and SetProp
GetProp and SetProp forced a risky usage of pointers.
2022-05-25 02:11:00 +09:00
Hajime Hoshi
ec2df98c70 internal/glfwwin: skip functions for Xbox
Updates #2084
2022-05-25 02:00:59 +09:00
Hajime Hoshi
847357c3ea internal/glfwwin: remove an unused function GetKeyName
MapVirtualKeyW is not available on Xbox.

Updates #2084
2022-05-25 01:00:32 +09:00
Hajime Hoshi
ffc9a0876a internal/glfwwin: remove changing the foreground lock timeout
See 58b48a3a00

Updates #2084
2022-05-25 00:34:54 +09:00
Hajime Hoshi
55657e72ae internal/ui: skip hideConsoleWindowOnWindows in Xbox
Updates #2084
2022-05-25 00:13:28 +09:00
Hajime Hoshi
3745c0a2e0 internal/graphicsdriver/opengl/gl: remove an unused function GetBufferSubData
This is basically a revert of 86a0c7aa82
2022-05-24 20:45:45 +09:00
Hajime Hoshi
a1370a4791 internal/graphicsdriver/opengl: remove an unused member gl.getBufferSubData 2022-05-24 20:40:53 +09:00
Hajime Hoshi
f888b7868b internal/graphicsdriver/opengl: fix the error message when GenFramebufferEXT fails 2022-05-23 22:25:40 +09:00
Hajime Hoshi
6cd655b5ce internal/glfwwin: bug fix: error values were not returned 2022-05-22 22:05:48 +09:00
Hajime Hoshi
0577a28aed all: add struct members for go-vet
Updates #1306
2022-05-22 22:05:40 +09:00
Hajime Hoshi
ad5ebae3cc internal/ui: refactoring 2022-05-22 21:53:42 +09:00
Hajime Hoshi
4396785829 Revert "internal/graphicsdriver/opengl: remove CGO in opengl for macOS (#2091)"
This reverts commit f7e21983cf.

Reason: test failures (#2102)

Closes #2102
2022-05-22 01:24:48 +09:00
TotallyGamerJet
f7e21983cf
internal/graphicsdriver/opengl: remove CGO in opengl for macOS (#2091)
Updates #1162
2022-05-22 00:58:45 +09:00
Hajime Hoshi
7eeef3ae0f internal/glfwwin: bug fix: WGL extension functions didn't work
Closes #2101
2022-05-22 00:40:50 +09:00
Hajime Hoshi
8d3de6207b internal/gamepad: add a warning message when getGamepads is not available
Updates #2100
2022-05-21 23:25:56 +09:00
Hajime Hoshi
8d318fc4de internal/gamepad: bug fix: getGamepads might not be available under a non-secure context
Closes #2100
2022-05-21 23:22:50 +09:00
Hajime Hoshi
6fa39d5e73 internal/glfw: make panic messages consistent 2022-05-21 13:19:11 +09:00
Hajime Hoshi
9a1eb0b124 internal/glfwwin: bug fix: wrong type casts (TlsGetValue) 2022-05-21 00:59:14 +09:00
Hajime Hoshi
93731673ad internal/glfwwin: bug fix: wrong type casts 2022-05-21 00:56:22 +09:00
Hajime Hoshi
374f1cf8e6 internal/glfwwin: fix typo 2022-05-21 00:18:36 +09:00
Hajime Hoshi
bd2a31bdd8 internal/glfwwin: remove unnecessary comments 2022-05-20 23:17:03 +09:00
Hajime Hoshi
8c467aaa1b internal/glfwwin: update GLFW to 3.3.7
Reference: 597ae79a86
2022-05-20 23:09:16 +09:00
Hajime Hoshi
f67b4cc1d6 internal/glfw: use a pure Go implementation of GLFW
This change removes internal/glfw/glfw, that is a DLL loader, and
replaces the usages with internal/glfwwin, that is a pure Go
implementation of GLFW for Windows.

The build tag `ebitenexternaldll` is also removed.

Closes #1764
2022-05-20 22:10:00 +09:00
Hajime Hoshi
edd617f80e internal: add a new package glfwwin
internal/glfwwin is a pure Go implementation of GLFW for Windows.

Updates #1764
2022-05-20 21:36:13 +09:00
Hajime Hoshi
eec5ea00ec internal/glfw: refactoring: use pointers or functions for callbacks 2022-05-20 17:49:46 +09:00
Hajime Hoshi
8d2b08dd14 internal/glfw: refactoring: make callback handlers consistent 2022-05-19 01:49:21 +09:00
Hajime Hoshi
7189c7f649 internal/glfw: refactoring: remove unused APIs
Ebiten doesn't rely on GLFW for gamepads.
2022-05-19 01:04:23 +09:00
Hajime Hoshi
fef79f4d3e internal/graphicsdriver/metal: update the minimum version of macOS
Updates #2095
2022-05-18 00:09:04 +09:00
Hajime Hoshi
3d00bb1fa2 internal/gamepad, internal/ui: type-cast returning values from Win32APIs just in case 2022-05-11 00:48:44 +09:00
Hajime Hoshi
812607cdfc internal/processtest/testdata: add a test case for #2089
Updates #2089
2022-05-08 23:45:21 +09:00
Hajime Hoshi
faf1e7350d internal/atlas: bug fix: wrong logic to create a new mask with edges
* Fixed wrong operator orders
 * Cleared an allocated region explicitlly

Closes #2089
2022-05-08 23:06:10 +09:00
Hajime Hoshi
7409f01b17 internal/graphicsdriver/metal/mtl: bug fix: specify the language version explicitly
Updates #2086
2022-05-05 23:50:48 +09:00
Hajime Hoshi
a0e1d08123 internal/graphicsdriver/directx: update comments
Updates #2081
2022-04-26 11:20:48 +09:00
Hajime Hoshi
7321e86a6b internal/graphicsdriver/directx: bug fix: the screen image can be nil when resizing the window
Closes #2081
2022-04-26 11:19:48 +09:00
Hajime Hoshi
38a2aa11fd internal/ui: bug fix: deadlock at Layout with Ebiten's image functions called
Closes #2079
2022-04-26 01:12:57 +09:00
Hajime Hoshi
dc811f9329 internal/gamepaddb: bug fix: crash at addAndroidDefaultMappings
Closes #2076
2022-04-19 23:36:02 +09:00
Hajime Hoshi
928d82c685 internal/atlas: potential bug fix: restore images before other image manipulations
From the reported stack trace, there could be a potential issue in
atlas.BeginFrame: images were manipulated before the images are restored.
Restoring images assumes that all images are not stale, but manipulating
images like putOnAtlas might cause other images stale in ReplacePixels.

Though we failed to reproduce the case, this fix should make sense.

Updates #2075
2022-04-18 02:19:46 +09:00
Hajime Hoshi
2fc691f661 internal/clock: rename CurrentFPS/TPS -> ActualFPS/TPS 2022-04-14 00:57:47 +09:00
Hajime Hoshi
f25dda1318 internal/clock: force to sync the timer when TPS is updated 2022-04-14 00:56:37 +09:00
Hajime Hoshi
2a5b5b4823 internal/ui: avoid a busy loop in restoreWindow
Updates #1826
2022-04-10 17:55:39 +09:00
Hajime Hoshi
3fe1df8b3b internal/ui: bug fix: ebiten.WindowSize() returned (1,1) when iconified 2022-04-10 16:50:47 +09:00
Hajime Hoshi
aae866350a internal/ui: bug fix: (*glfw.Window).GetSize() returns (0,0) when iconified
Closes #2066
2022-04-10 16:43:03 +09:00
Hajime Hoshi
d3b83dd4ea internal/ui: refactoring 2022-04-09 18:23:56 +09:00
Hajime Hoshi
fcb7df0a59 internal/ui: bug fix: checking fullscreen on Safari was wrong 2022-04-09 17:25:19 +09:00
Hajime Hoshi
a69be34001 internal/ui: update the error message for fullscreen 2022-04-09 16:55:09 +09:00
Hajime Hoshi
853d94c3ef internal/shader: implement strict type checks when calling a function
Closes #2032
2022-04-09 00:32:27 +09:00
Hajime Hoshi
15fe7158fd internal/shader: implement strict type checks in assignments
Closes #1972
2022-04-09 00:02:20 +09:00
Hajime Hoshi
93b4c0d9b1 internal/ui: add comments
Updates #1590
2022-04-08 18:40:13 +09:00
Hajime Hoshi
2008916261 internal/ui: bug fix: use the native unit for origWindowPosByOS 2022-04-08 16:43:13 +09:00
Hajime Hoshi
90070c09fe internal/ui: rename origPos -> origWindowPos 2022-04-08 15:59:16 +09:00
Hajime Hoshi
352d332097 internal/ui: remove redundant comments 2022-04-08 15:51:56 +09:00
Hajime Hoshi
ee124baf60 internal/ui: bug fix: WindowSize returned a wrong value on fullscreen on macOS
Closes #2062
2022-04-08 14:57:51 +09:00
Hajime Hoshi
ad66c3d90b internal/png: clean up files before generating 2022-04-06 11:48:46 +09:00
Hajime Hoshi
20beb9d2b8 internal/gamepaddb: update the database
Updates #1902
2022-04-06 11:41:05 +09:00
Hajime Hoshi
6e19c793f6 internal/png: update for Go 1.18 2022-04-06 11:32:48 +09:00
Hajime Hoshi
32de5ec2d0 internal/graphics: refactoring 2022-04-05 11:12:25 +09:00
Hajime Hoshi
c6e5582c56 Revert "internal/graphics: refactoring"
This reverts commit b6cc164e96.

Reason: wrong shader program
2022-04-04 14:31:37 +09:00
Hajime Hoshi
b6cc164e96 internal/graphics: refactoring 2022-04-04 14:30:51 +09:00
Hajime Hoshi
c56665b23c internal/processtest: bug fix: shadernomain is no longer a valid test
Updates #2035
2022-04-04 03:12:34 +09:00
Hajime Hoshi
736d77e0d2 internal/graphicsdriver: remove Graphics.NDCYDirection 2022-04-04 03:03:44 +09:00
Hajime Hoshi
6710808cd1 ebiten: compile shaders at NewShader
Closes #2035
2022-04-04 02:52:57 +09:00
Hajime Hoshi
02db3bad53 internal/graphicscommand: remove the dependency on a graphics driver from compileShader
Updates #2035
2022-04-04 02:09:08 +09:00
Hajime Hoshi
4b0967be42 internal/ui: gofmt 2022-04-04 01:48:15 +09:00
Hajime Hoshi
f756be3d22 internal/devicescale: bug fix: glfw.Monitor.GetContentScale might return 0
Retrying to call GetContentScale solved this.

Closes #2051
2022-04-03 19:32:01 +09:00
Hajime Hoshi
f1f9f74e5c internal/ui: bug fix: force to refresh the framebuffer by resizing the window very quickly
Closes #2050
2022-04-03 18:43:22 +09:00
Hajime Hoshi
65094c61b1 internal/graphicscommand: reland: merge adjacent commands if the same shader and uniform variables are used
Closes #1846
2022-04-03 03:57:49 +09:00
Hajime Hoshi
f75a70dc40 internal/graphicscommand: treat []float32 instead of interface{} for uniform variables 2022-04-03 03:51:52 +09:00
Hajime Hoshi
990228e216 internal/graphicscommand: cache uniform name locations and types 2022-04-03 03:28:11 +09:00
Hajime Hoshi
9be454ef25 internal/graphicsdriver: remove an old comment 2022-04-03 02:53:43 +09:00
Hajime Hoshi
9f3f9e64cc internal/graphicscommand: add panic at convertUniforms 2022-04-03 00:39:05 +09:00
Hajime Hoshi
b52a02a178 internal/ui: bug fix: crash when Image.MarkDisposed is called multiple times
Closes #2048
2022-04-03 00:21:26 +09:00
Hajime Hoshi
651c5693c6 Revert "internal/graphicscommand: merge adjacent commands if the same shader and uniform variables are used"
This reverts commit 425ce27976.

Reason: test failures
2022-04-03 00:11:15 +09:00
Hajime Hoshi
425ce27976 internal/graphicscommand: merge adjacent commands if the same shader and uniform variables are used
Closes #1846
2022-04-02 23:55:14 +09:00
Hajime Hoshi
33078c764c internal/gamepaddb: make Update atomic
Closes #1978
2022-04-02 20:19:04 +09:00
Hajime Hoshi
3fafc05411 internal/graphicsdriver: remove Graphics.HasHighPrecisionFloat
Updates #879
2022-04-02 05:19:30 +09:00
Hajime Hoshi
351ef9fbb7 internal/atlas, internal/graphicsdriver: move the adjusting-pixel logic to atlas
Now pixels are adjusted even when the graphics driver doesn't have
high-precision floats, but this should not be problematic. This was
introduced at 9bff33472a, but the
adjusting way is much different from the current way.

Updates #879
Closes #1820
2022-04-02 05:15:29 +09:00
Hajime Hoshi
34e23f5256 internal/restorable: treat texels instead of pixels
Updates #1820
2022-04-02 04:25:27 +09:00
Hajime Hoshi
0c6362c93a internal/atlas: move the color scaling from internal/atlas to ebiten
Updates #1820
2022-04-02 02:47:56 +09:00
Hajime Hoshi
5c7917897c internal/ui: refactoring: move the logic in gameForUI to context 2022-04-01 22:33:31 +09:00
Hajime Hoshi
9c448d207a internal/ui: remove an unnecessary alias 2022-04-01 21:17:26 +09:00
Hajime Hoshi
b53cb2acd6 internal/ui, internal/mipmap, internal/graphicscommand: fix a wrong panic message 2022-04-01 20:12:12 +09:00
Hajime Hoshi
8e40b2562e internal/ui: remove an error returning value from Game.Draw 2022-04-01 19:10:10 +09:00
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