Commit Graph

3946 Commits

Author SHA1 Message Date
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