Hajime Hoshi
82c7436be5
internal/packing: refactoring: use image.Rectangle
2023-04-27 23:45:57 +09:00
Hajime Hoshi
6c5477adea
internal/atlas: remove borders at the upper and the left sides
...
Updates #2657
2023-04-27 09:06:05 +09:00
Hajime Hoshi
2a1d23d926
internal/shader: bug fix: panic when an assignment mismatch happens
...
Closes #2654
2023-04-26 22:09:25 +09:00
Hajime Hoshi
56b4cdc3c4
internal/graphics: use pixels for offsets
2023-04-26 00:38:23 +09:00
Hajime Hoshi
9d2178cf71
internal/shaderir: rename the built-in func to get a texel to __texelAt
2023-04-23 22:57:30 +09:00
Hajime Hoshi
49582519c1
all: add a compiler directive kage:unit
...
This change adds a new compiler directive 'kage:unit' to Kage. This
takes one of these two values: 'pixel' and 'texel'. The default value
is 'texel'.
With the pixel-unit mode, all the built-in functions treats pixels
instead of texels, and the texCoord argument of Fragment is in pixels.
This simplifies shader programs as programs no longer have the notion
of texels.
With the texel-unit mode, the behavior is the same as the current
behavior.
Closes #1431
2023-04-23 22:11:57 +09:00
Hajime Hoshi
b5ca404c42
internal/shader: bug fix: a swizzling 'r' didn't work for vec2
...
Closes #2652
2023-04-23 21:29:20 +09:00
Hajime Hoshi
00e45affe9
all: update OpenGL version from 2.1 to 3.2
...
'texelFetch' requires OpenGLSL 1.30, which requires OpenGL 3.0+.
macOS might not support OpenGL 3.0 and 3.1, so adopt 3.2.
Updates #1431
2023-04-23 14:25:36 +09:00
Hajime Hoshi
40c38eb9ee
internal/graphicsdriver/opengl: refactoring: remove contextPlatform
2023-04-22 21:52:20 +09:00
Hajime Hoshi
8926a4213e
internal/graphicsdriver/opengl: refactoring: move consts to gl
2023-04-22 21:20:34 +09:00
Hajime Hoshi
00ed6f08fc
internal/graphicsdriver/opengl/gl: refactoring: reduce types
2023-04-22 19:27:56 +09:00
Hajime Hoshi
504006fc22
internal/graphicsdriver/opengl/gl: refactoring: remove unused types
2023-04-22 16:18:18 +09:00
Hajime Hoshi
0495101450
internal/graphicsdriver/opengl/gl: bug fix: build error with GOOS=js
2023-04-22 16:10:49 +09:00
Hajime Hoshi
0542f9daa3
internal/graphicsdriver/opengl/gl: refactoring
2023-04-22 15:59:18 +09:00
Hajime Hoshi
4f69ca4ea9
internal/graphicsdriver/opengl: add a debug mode with a build tag ebitenginegldebug
...
In the debug mode, GetError is inserted in each GL function call.
Closes #2650
2023-04-22 13:17:08 +09:00
Hajime Hoshi
b40c5b1e99
internal/ui: catch an error at At at updateIconIfNeeded
...
Closes #2647
2023-04-20 00:59:14 +09:00
Hajime Hoshi
95709d9182
internal/graphicsdriver/opengl: update GLES version to 3.0
...
GLES 3.0 is required for GLSL ES 3.0
Updates #1431
2023-04-19 22:43:26 +09:00
Hajime Hoshi
7509c1d7f5
internal/graphicsdriver/opengl: remove the version es100
...
es300 is requried for 'texelFetch' [1].
[1] https://registry.khronos.org/OpenGL-Refpages/es3.0/html/texelFetch.xhtml
Updates #1431
2023-04-19 22:10:32 +09:00
Hajime Hoshi
2f55bb1b3d
internal/atlas, internal/graphicscommand: refactoring
2023-04-19 21:43:08 +09:00
Hajime Hoshi
6817be2594
internal/goglfw: ignore the invalid-handle error at DestroyWindow
...
Updates #2551
2023-04-18 23:53:26 +09:00
Hajime Hoshi
eb6a773d3f
internal/graphicscommand: remove unnecessary space chars
2023-04-18 01:19:28 +09:00
Hajime Hoshi
df32901dce
internal/shader: refactoring
2023-04-16 18:37:06 +09:00
Hajime Hoshi
c00579509a
internal/ui: bug fix: wrong mouse cursor movement calculation
...
Closes #2634
2023-04-10 15:25:04 +09:00
Hajime Hoshi
a56924b22f
internal/graphicsdriver/directx: refactoring
2023-04-09 16:49:52 +09:00
Hajime Hoshi
4473557e23
internal/graphicsdriver/directx: smooth rendering when resizing the window with DirectX 12
...
Updates #2615
2023-04-09 16:38:29 +09:00
Hajime Hoshi
2423733598
internal/graphicsdriver/directx: bug fix: wrong size was used when resizing
...
Updates #2633
2023-04-09 16:34:56 +09:00
Hajime Hoshi
2c088b9059
internal/graphicsdriver/directx: resize the swap chain after presenting is done
...
Updates #2633
2023-04-09 16:29:00 +09:00
Hajime Hoshi
730c7a2ad0
internal/graphicsdriver/directx: refactoring
2023-04-09 15:30:46 +09:00
Hajime Hoshi
78d3e4273b
internal/graphicsdriver/directx: remove tearing
...
This is basically a revert of 0035ba0bd1
.
I couldn't confirm that allowing tearing improved FPS. Rather, this
has a potential risk to cause an error at Present of the swap chain due
to an inconsistent argument, though I have not confirmed an actual issue.
Now the DirectX 11 driver was introduced, the situation has changed.
Updates #2034
Updates #2188
2023-04-09 14:47:51 +09:00
divVerent
cc24796270
internal/restorable: optimize removeDuplicatedRegions from O((n+m)^2) to O(n*m + m^2) ( #2631 )
...
This is achieved by replacing the function by one that only adds a single
new region, and only considers duplicates between the previously existing
region and the one newly added one, thereby removing previously redundant
checking of each previously existing region against each other.
This speeds up AAAAXY loading on a Moto G7 Play from 52.27 seconds to
8.15 seconds.
Closes #2626
2023-04-09 02:31:22 +09:00
Hajime Hoshi
ce71c31a27
internal/packing: refactoring: remove a redundant check of sizes
2023-04-09 01:13:44 +09:00
divVerent
574925cf7a
packing: remove redundant canAlloc checking and alloc allocating. ( #2629 )
...
By removing redundant work done in canAlloc and just calling alloc right away,
this removes 35% contribution to AAAAXY loading CPU time on the profile on
https://user-images.githubusercontent.com/251568/230496805-c5e32c19-9258-49c8-800b-a3f0bc3b072d.svg ,
or - as measured via stopwatch - brings loading time on Moto G7 Play from
17.22s to 14.94s after already applying #2627 .
This should be safe as there is no case in which alloc succeeds and the
allocated region isn't used; also, there is no case in which alloc mutates the
tree when it doesn't actually succeed (comment added in one place to justify
this).
Closes #2628
2023-04-08 22:03:16 +09:00
Hajime Hoshi
0d1f990338
internal/processtest: output a better error message when failing to compile a Go program
2023-04-01 04:01:39 +09:00
Hajime Hoshi
2875eb25f1
internal/processtest: add a test for #2620
...
Updates #2620
2023-04-01 03:59:00 +09:00
Hajime Hoshi
4e7db88829
internal/processtest: bug fix: timeout didn't work for go-run
...
Apparently timing-out for a go-run process didn't work well. Instead,
use CommandContext for the actual test binary which is already built.
2023-04-01 03:56:50 +09:00
Hajime Hoshi
09d2459f1c
internal/ui: a more robust fix for the unfocused-window loop
...
Depending on the member variable bufferOnceSwapped is a little fragile.
Detect whether the window is shown or not instead.
Updates #2620
2023-04-01 03:36:51 +09:00
Hajime Hoshi
db7c99fde8
internal/ui: bug fix: an unfocused window should not wait until buffers are swapped once
...
On macOS, a window is hidden until buffers are swapped once. If a game is
not runnable on unfocused, as the window is hidden and unfocused, the
waiting loop for a window never ends.
This change fixes the issue by changing the loop condition.
Closes #2620
2023-04-01 03:01:59 +09:00
Hajime Hoshi
f5e0496611
internal/goglfw: ignore invalid-window-handle error at DestroyWindow
...
Closes #2551
2023-03-31 23:59:11 +09:00
Hajime Hoshi
14b34a7b0a
internal/ui: typo
2023-03-31 03:21:48 +09:00
Hajime Hoshi
1999f8a024
internal/ui: use DirectX as a fallback for old Windows
...
Initializing OpenGL can fail [1], though this is pretty rare. For such
this case, try DirectX as a fallback.
[1] https://answers.microsoft.com/en-us/windows/forum/all/my-drivers-dont-support-opengl/a1ee0267-4dc8-4385-a185-6ed322d78329
Updates #2613
2023-03-31 03:15:52 +09:00
Hajime Hoshi
370b7599bc
internal/graphicsdriver/directx: use OpenGL as the default on old Windows
...
On old machines, CreateSwapChain might fail without a specific reasons.
Probably this is due to an issue in drivers, and if so, there is nothing
we can do. When choosing a graphics library, prefer OpenGL on such old
machines.
Updates #2613
2023-03-31 02:21:11 +09:00
Hajime Hoshi
182ac21866
internal/goglfw: separate the Windows version detection to a new package winver
2023-03-31 02:16:01 +09:00
Hajime Hoshi
c0adcee12c
Revert "internal/graphicsdriver/directx: initialize the refresh rate explicitly for Windows 7"
...
This reverts commit a4bfe8a869
.
Reason: This doesn't take any effects.
Updates #2613
2023-03-30 22:40:53 +09:00
Hajime Hoshi
a4bfe8a869
internal/graphicsdriver/directx: initialize the refresh rate explicitly for Windows 7
...
This is an experimental fix inspired by Chromium/ANGLE
https://source.chromium.org/chromium/chromium/src/+/main:third_party/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.cpp;l=491-492;drc=79aa846e38739138918891e8b334fac464dd9b83
Updates #2613
2023-03-30 22:22:26 +09:00
Hajime Hoshi
09250ff4f3
internal/graphicsdriver/directx: adjust buffer count
...
Apparently the buffer count should be 1 with a non-flipping swap effect.
Updates #2613
2023-03-30 21:09:41 +09:00
Hajime Hoshi
61ced5127b
internal/graphicsdriver/directx: limit d3dcompiler versions
...
For example, the verions 45/44 are alpha and should not be used.
Updates #2613
Updates #2618
2023-03-30 17:54:42 +09:00
Hajime Hoshi
99fb40f299
internal/processtest: skip tests on WSL
...
Closes #1864
2023-03-30 13:42:44 +09:00
Hajime Hoshi
d22158b156
internal/graphicsdriver/directx: use non-flip swap effect for old Windows
...
Updates #2613
Updates #2619
2023-03-30 12:33:08 +09:00
Hajime Hoshi
0cd832f096
internal/graphicsdriver/directx: check the DLL availability at NewGraphics
...
Updates #2613
Updates #2618
2023-03-30 01:45:31 +09:00
Hajime Hoshi
3e477d0bbb
internal/graphicsdriver/directx: bug fix: d3dcomipler_47.dll might be missing
...
Updates #2613
Closes #2618
2023-03-30 01:12:46 +09:00
Hajime Hoshi
6858e4b60b
internal/graphicsdriver/directx: use QueryInterface to cast IDXGISwapChain to IDXGISwapChain4
...
QueryInterface is better in terms of error messages than a dumb
pointer casting.
2023-03-30 00:44:39 +09:00
Hajime Hoshi
7fa65ae983
internal/graphicsdriver/directx: reduce unnecessary usages of IDXGISwapChain4
...
IDXGISwapChain is enough for DirectX 11.
Updates #2613
2023-03-30 00:14:04 +09:00
Hajime Hoshi
c9f1696a5b
internal/graphicsdriver/directx: use CreateDXGIFactory instead of CreateDXGIFactory2
...
CreateDXGIFactory2 is available in Windows 8.1 and newer. This is not
necessary for the current Ebitengine implementation. Use the old version
CreateDXGIFactory to support Windows 8 and older.
Updates #2613
2023-03-29 23:56:17 +09:00
Hajime Hoshi
fe67399022
internal/graphicsdriver/directx: use CreateSwapChain instead of CreateSwapChainForHwnd
...
This is a preparation to use IDXGIFactory instead of IDXGIFactory4.
Updates #2613
2023-03-29 23:37:08 +09:00
Hajime Hoshi
ad1bb4b2cb
internal/graphicsdriver/directx: remove unused functions
2023-03-29 23:21:08 +09:00
Hajime Hoshi
1017161c36
internal/graphicsdriver/directx: refactoring
2023-03-29 18:26:11 +09:00
Hajime Hoshi
0b0526a05b
internal/graphicsdriver/directx: bug fix: had to consider strides when copying resources
...
Closes #2617
2023-03-29 18:24:36 +09:00
Hajime Hoshi
0449126c5b
internal/graphicsdriver/directx: integrate EBITENGINE_DIRECTX and EBITENGINE_DIRECTX_FEATURE_LEVEL
2023-03-29 16:22:20 +09:00
Hajime Hoshi
129956d8f0
internal/graphicsdriver/directx: refactoring: remove graphic12.transparent
2023-03-29 15:56:33 +09:00
Hajime Hoshi
78d76945ad
internal/graphicsdriver/directx: implement DirectX 11 driver
...
Updates #2613
2023-03-29 15:52:33 +09:00
Hajime Hoshi
c8a2e5dc71
internal/graphicsdriver/directx: refactoring
...
This is a preparation for a DirectX 11 driver.
Updates #2613
2023-03-29 15:34:58 +09:00
Hajime Hoshi
4779bbc04d
internal/graphicsdriver/directx: refactoring: remove redundant adapter check
2023-03-29 15:32:49 +09:00
Hajime Hoshi
f23dd72fb4
internal/graphicsdriver/directx: reduce unnecessary settings of pipelines
2023-03-29 14:15:22 +09:00
Hajime Hoshi
c22957f678
internal/graphicsdriver/directx: dispose a screen image explicitly
...
A screen image in DirectX 12 should not include any buffers to release
so there is not a bug, but disposing it explicitly when resizing the
window should be polite.
2023-03-29 00:42:03 +09:00
Hajime Hoshi
f698f8fc69
internal/graphicsdriver/directx: refactoring
2023-03-28 02:32:01 +09:00
Hajime Hoshi
fe42c1f2b5
internal/graphicsdriver/directx: lower the shader version for feature levels 10.x
...
Updates #2613
2023-03-27 14:02:59 +09:00
Hajime Hoshi
dbb167c2d0
internal/graphicsdriver/directx: refactoring
2023-03-27 13:57:25 +09:00
Hajime Hoshi
549e6120b5
internal/graphicsdriver/directx: refactoring: reduce indentations
2023-03-26 22:56:15 +09:00
Hajime Hoshi
fe5c3354fc
internal/graphicsdriver/directx: bug fix: missing error checking
2023-03-26 18:52:55 +09:00
Hajime Hoshi
c9469a64ee
internal/graphicsdriver/directx: refactoring: add graphicsInfra
2023-03-26 18:31:42 +09:00
Hajime Hoshi
0b46d2b799
internal/graphicsdriver/directx: refactoring
2023-03-26 00:49:30 +09:00
Hajime Hoshi
902d7244eb
internal/graphicsdriver/directx: rename structs for a new DirectX 11 implementation
...
Updates #2613
2023-03-26 00:32:47 +09:00
Hajime Hoshi
d6525a2782
internal/graphicsdriver/directx: refactoring
2023-03-25 16:52:58 +09:00
Hajime Hoshi
c394bdcf7c
internal/graphicsdriver/directx: separate a part for images and shaders
2023-03-25 15:54:28 +09:00
Hajime Hoshi
4811386d8a
internal/graphicsdriver/directx: separate a part for DirectX 12
...
Updates #2613
2023-03-25 15:35:47 +09:00
Hajime Hoshi
488bce7e36
internal/graphicsdriver/directx: remove unnecessary comments
2023-03-25 13:53:00 +09:00
Hajime Hoshi
c1e83432c0
internal/graphicsdriver/directx: refactoring: split api_windows.go
2023-03-25 12:07:04 +09:00
Hajime Hoshi
4ec27262ed
internal/graphicsdriver/directx: refactoring
2023-03-25 01:34:29 +09:00
Hajime Hoshi
c7ca9cb321
ebiten: omit the exceeding part of vertices at Draw*
2023-03-23 21:23:33 +09:00
Hajime Hoshi
31273c875f
internal/graphics: rename constants
2023-03-23 20:48:39 +09:00
Hajime Hoshi
ce9274a29d
ebiten: remove the restriction for len(indices) at Draw*
...
Closes #2460
2023-03-23 20:01:15 +09:00
Hajime Hoshi
c7214ef6fb
internal/ui: use MaxVertexCount instead of IndicesCount
...
Updates #2460
2023-03-23 19:44:00 +09:00
Hajime Hoshi
81581df2b9
internal/graphicscommand: reland: add graphics.MaxVertexFloatCount and use it instead of IndicesCount
...
This change is reland of 54e2790a06
but with a fix for WebGL. Also, this changes the logic when len(vertices)
exceeds the maximum: just remove the last part.
Updates #2460
2023-03-23 18:01:09 +09:00
Hajime Hoshi
c59bcbdb5b
Revert "internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount"
...
This reverts commit 54e2790a06
.
Reason: test failures on browsers:
`GOOS=js GOARCH=wasm go test . -shuffle=1679547510163000000` failed
https://github.com/hajimehoshi/ebiten/actions/runs/4497182906/jobs/7912544699
2023-03-23 14:15:04 +09:00
Hajime Hoshi
54e2790a06
internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount
...
Updates #2460
2023-03-23 13:49:05 +09:00
Hajime Hoshi
3f2ac129d2
internal/graphicscommand: refactoring: remove unnecessary restrictions for indices
...
Updates #2460
2023-03-23 13:28:11 +09:00
Hajime Hoshi
90723025cc
internal/graphicsdriver/directx: reuse vertices/indices buffers whenever possible
2023-03-23 11:34:39 +09:00
Hajime Hoshi
e5525a04d5
internal/graphicsdriver/directx: refactoring: remove usages of graphics.IndicesCount
...
Updates #2460
2023-03-23 11:25:29 +09:00
Hajime Hoshi
a19ff07130
internal/graphicsdriver/opengl: bug fix: potential infinite loop
2023-03-23 02:47:23 +09:00
Hajime Hoshi
ad90ae3475
internal/graphicsdriver/directx: refactoring
2023-03-22 21:52:14 +09:00
Hajime Hoshi
034f9c2db8
internal/graphicsdriver/opengl: reland: refactoring: remove usages of graphics.IndicesCount
...
Updates #2460
2023-03-22 20:13:29 +09:00
Hajime Hoshi
61ee811579
internal/graphicsdriver: define Resetter
2023-03-22 18:35:46 +09:00
Hajime Hoshi
8cbf545e0f
internal/graphicsdriver/opengl: revert commits for graphics.Indices
...
This change reverts these commits:
* 13d3a0487b
* 4cd98d512e
Reason: this caused crashes on Android.
Updates #2460
Closes #2610
2023-03-22 17:28:45 +09:00
Hajime Hoshi
13d3a0487b
internal/graphicsdriver/opengl: refactoring: remove usages of graphics.IndicesCount
...
Updates #2460
2023-03-22 13:33:34 +09:00
Hajime Hoshi
4cd98d512e
internal/graphicsdriver/opengl: refactoring
2023-03-21 23:06:49 +09:00
Hajime Hoshi
23e90b7e39
internal/graphicsdriver/opengl: refactoring
2023-03-20 22:48:20 +09:00
Hajime Hoshi
8ae6ea5ff6
internal/graphicsdriver/opengl: update comments
2023-03-20 01:42:54 +09:00
Hajime Hoshi
cbff3555db
internal/graphicsdriver/opengl: drop WebGL 1 support
...
Closes #2191
2023-03-18 22:50:09 +09:00
Hajime Hoshi
22dfdfc418
internal/gamepad: bug fix: possible crash at iterating gamepads
...
Closes #2603
2023-03-17 11:40:24 +09:00
Hajime Hoshi
faca493fbc
go generate
2023-03-15 03:18:28 +09:00
Hajime Hoshi
39aaf7fe37
ebiten: update comments
...
Updates #2601
2023-03-14 13:07:40 +09:00
Hajime Hoshi
1656c47abf
internal/ui: bug fix: hiding a window decoration at initialization doesn't work on macOS
...
Closes #2600
2023-03-14 00:27:57 +09:00
Hajime Hoshi
3bcac70d1c
internal/graphicsdriver/metal: add comments
2023-03-13 22:21:55 +09:00
Hajime Hoshi
e93bcd9e55
internal/ui: bug fix: needed to wait for swapping buffers before entering fullscreen
...
Closes #2599
2023-03-13 21:40:40 +09:00
Hajime Hoshi
65fb9d56ba
internal/graphicsdriver/metal: refactoring
...
Updates #2599
2023-03-13 21:29:42 +09:00
divVerent
10c1b56e62
cmd/ebitenmobile: fix Xbox-ish gamepad axis assignment ( #2596 )
...
This commit mirrors https://github.com/libsdl-org/SDL/pull/7405
(6f1f586086
).
Note that for SDL, this code is used a lot less than for Ebitengine, as SDL
mostly migrated to HIDAPI and direct USB device access rather than using
Android's APIs. For Bluetooth devices, however, the Java APIs are used the
same way.
This was the remaining problem to be solved to automatically support standard
layout on most standard gamepads (this should cover most Xbox-ish and PS-ish
gamepads on the market).
In particular this covers gamepads with the following assignment:
- Left stick = X/Y, right stick = Z/RZ, triggers = LEFTTRIGGER/RIGHTTRIGGER
(which basically is what Android docs say and some PS gamepads do)
- Left stick = X/Y, right stick = RX/RY, triggers = Z/RZ
(Xbox gamepad style, apparently)
- Left stick = X/Y, right stick = RX/RY, triggers = LEFTTRIGGER/RIGHTTRIGGER
(Not sure if this exists, but it's conceivable)
As we found on the SDL pull request discussion, gamepads that offer flight
controls (e.g. THROTTLE and RUDDER) will likely not work well, before and
after this change.
Closes #2557
2023-03-12 22:32:30 +09:00
Hajime Hoshi
36e2d0ec40
internal/graphicsdriver/metal: bug fix: a path for CoreGraphics.framework didn't work
...
Closes #2595
2023-03-10 23:24:06 +09:00
Hajime Hoshi
84146510ce
internal/restorable: refactoring
2023-03-10 22:29:59 +09:00
Hajime Hoshi
46173ffec6
internal/restorable: refactoring
2023-03-10 01:57:07 +09:00
Hajime Hoshi
8f2097d55e
internal/restorable: reduce more duplicated regions
2023-03-09 23:17:02 +09:00
Hajime Hoshi
f3b49e6543
internal/restorable: reduce more duplicated regions
2023-03-09 22:57:57 +09:00
Hajime Hoshi
66db13ef74
internal/restorable: add tests
2023-03-09 21:54:41 +09:00
Hajime Hoshi
367606f274
internal/restorable: remove duplicated regions from i.staleRegions
...
Updates #2375
Updates #2581
2023-03-09 17:15:56 +09:00
Hajime Hoshi
22d74e78b2
internal/restorable: reduce allocations at readPixelsFromGPU
...
Updates #2375
2023-03-08 16:43:43 +09:00
Hajime Hoshi
da55397420
internal/restorable: remove empty regions at appendRegionsForDrawTriangles
2023-03-08 16:32:41 +09:00
Hajime Hoshi
f298b9541b
internal/restorable: use a cache for pixels at readPixelsFromGPU
...
Updates #2375
2023-03-08 16:27:38 +09:00
Hajime Hoshi
7f182e7814
internal/restorable: skip basePixels.Clear when the region is empty
2023-03-08 16:21:45 +09:00
Hajime Hoshi
e4fffaf963
internal/restorable: reduce allocations
...
Updates #2375
2023-03-08 16:07:41 +09:00
Hajime Hoshi
7f3cff5e7c
internal/restorable: revive pixelsForRestore
...
pixelsForRestore was removed at 09e0320309
as the regions for restoring were minimized. However, this caused a
regression and increased allocations on Android.
This fix revives pixelsForRestore, but as a map with region keys and
byte slice values. pixelsForRestore no longer represents a byte slice
for an entire image.
Updates #2375
2023-03-08 14:52:44 +09:00
divVerent
06c141475c
internal/gamepad: native standard layout for Linux ( #2587 )
...
Implements native standard layout for Linux gamepads by using the kernel-provided button IDs, thereby expanding
support to gamepads not listed in gamecontrollerdb.txt.
Linux's docs: https://www.kernel.org/doc/Documentation/input/gamepad.txt
SDL2's source: https://fossies.org/linux/SDL2/src/joystick/linux/SDL_sysjoystick.c#l_1740
Note that I am NOT 100% convinced about the X/Y swap between Xbox and PlayStation controllers - the Xbox
compatible pad I have however does have BTN_NORTH and BTN_WEST swapped (and thus BTN_X and BTN_Y
assigned right), which confirms SDL's logic and opposes the kernel docs.
Tested with this gamepad: "20d6:2802 BDA Xbox ONE Core controller", label says "PowerA Model 1508491-02" - even
after clearing out gamecontrollerdb.txt, examples/gamepad shows a 100% correct mapping.
Closes #2052
2023-03-04 01:47:24 +09:00
Hajime Hoshi
6ccdc6382c
internal/graphicsdriver/metal/mtl: bug fix: fix a vet error
2023-03-04 01:37:45 +09:00
Hajime Hoshi
36bd3329b3
internal/graphicsdriver/metal: bug fix: compile error
2023-03-04 01:25:43 +09:00
Hajime Hoshi
7998e4d31d
update purego to v0.3.0-alpha
...
There are breaking changes between purego v0.2.0 and v0.3.0-alpha.
2023-03-04 01:22:54 +09:00
divVerent
809ad991c2
internal/gamepad: refactor standard layout support to allow remapping in the per-platform implementations. ( #2588 )
...
Refactors native standard layout so standard axes and buttons can be implemented using any of axes, buttons or hats.
This is required to be able to implement a native standard layout mapping for Linux, as e.g. shoulder buttons can be
backed either by an analog or digital input.
Precedes #2587
Updates #2052
2023-03-03 23:29:04 +09:00
Hajime Hoshi
051b0c7238
internal/ui: bug fix: a big-offscreen size could be 0
...
Closes #2589
2023-03-03 22:34:43 +09:00
Hajime Hoshi
b278e5521f
internal/gamepad: rename variables
2023-03-03 21:17:47 +09:00
Hajime Hoshi
27538135a7
internal/atlas: improve tests
...
This change fixes the test to reflect the fix for #2586 .
Updates #2586
2023-03-02 20:16:26 +09:00
Hajime Hoshi
1c09ec5e44
internal/atlas: bug fix: too aggressive counting up destinationCount
...
Closes #2586
2023-03-02 18:58:29 +09:00
Hajime Hoshi
7c10e48afd
internal/atlas: add an assertion
...
Updates #2586
2023-03-02 18:24:22 +09:00
Hajime Hoshi
e5bb89aa35
internal/restorable: use a special shader to clear an image
...
This reduces one extra internal texture.
2023-03-01 15:47:03 +09:00
Hajime Hoshi
7c0fbce0cf
internal/atlas: use texture atlases for rendering destinations
...
Before this change, texture atlases are created only for rendreing
sources.
This change enables to use texture atlases even for rendering
destinations, so that the number of textures will be drastically
reduced.
Closes #2581
2023-03-01 02:47:01 +09:00
Hajime Hoshi
8f3974eeba
internal/restorable: add TestDrawTrianglesAndExtend
2023-02-28 09:06:41 -08:00
Hajime Hoshi
42aa5fa604
internal/restorable: bug fix: an extended image has a wrong state (especially with OpenGL ES)
2023-02-28 08:48:25 -08:00
Hajime Hoshi
a5a5de2f3f
internal/graphicsdriver/directx: reduce memory usages for writing pixels
...
Updates #2294
Updates #2582
2023-03-01 00:11:34 +09:00
Hajime Hoshi
264f0bad42
internal/graphicsdriver/directx: reduce memory usages when reading pixels
...
Updates #2294
Updates #2582
2023-02-28 22:55:21 +09:00
Hajime Hoshi
707a44e367
internal/packing: fix the comment
2023-02-28 21:45:58 +09:00
Hajime Hoshi
6b957063d4
internal/packing: bug fix: node's links were not synced correctly
...
Closes #2584
2023-02-28 20:31:39 +09:00
Hajime Hoshi
5e4652c4f8
internal/atlas: bug fix: wrong size setting
2023-02-28 13:19:27 +09:00
Hajime Hoshi
62e08e7356
internal/restorable: fix comments
2023-02-26 12:26:22 +09:00
Hajime Hoshi
c48d0fbb7a
internal/buffer: refactoring
2023-02-26 02:20:07 +09:00
Hajime Hoshi
110ba5403d
internal/buffered: remove redundant pixel data if possible
2023-02-26 01:55:43 +09:00
Hajime Hoshi
df944fdf90
internal/restorble: clear pixels when possible to save memory
2023-02-26 00:12:34 +09:00
Hajime Hoshi
f04d9d6925
internal/restoring: avoid using staleRegions when alwaysReadPixelsFromGPU is true
...
Updates #2582
2023-02-25 23:26:28 +09:00
Hajime Hoshi
965fd4cac8
internal/restoring: bug fix: stop keeping pixel data on 32bit architecture
...
Updates #4259
2023-02-25 23:11:42 +09:00
Hajime Hoshi
a0a80bbc1f
internal/restorable: do not reset basePixels at makeStale
...
This information is still available even after context-lost happens,
so this doesn't have to be reset.
2023-02-25 21:13:35 +09:00
Hajime Hoshi
ff1621885d
internal/processtest: use a semaphore for sub-tests
...
Updates #2571
2023-02-25 16:19:15 +09:00
Hajime Hoshi
aca42e4046
internal/restorable: use sparate regions instead of a big unified region
2023-02-25 15:40:48 +09:00
Hajime Hoshi
09e0320309
internal/restorable: minimize a region for restoring
2023-02-25 15:10:32 +09:00
Hajime Hoshi
ff926b2e9f
internal/restorable: reland (2nd): use a smaller size rectangle for staleRegion
2023-02-24 21:25:47 -08:00
Hajime Hoshi
ec6f425fa0
Revert "internal/restorable: reland: use a smaller size rectangle for staleRegion"
...
This reverts these commits:
* 0755523776
* e36007a3a3
Reason: TestImageOptionsFill fails with OpenGL ES (https://github.com/hajimehoshi/ebiten/actions/runs/4264894196/jobs/7423561399 )
2023-02-25 03:12:26 +09:00
Hajime Hoshi
0755523776
internal/restorable: bug fix: pixel info was unexpectedly lost
2023-02-25 02:43:58 +09:00
Hajime Hoshi
e36007a3a3
internal/restorable: reland: use a smaller size rectangle for staleRegion
2023-02-25 02:09:22 +09:00
Hajime Hoshi
f58d7e1ab5
internal/graphicsdriver/directx: bug fix: getting pixels with non-zero position might not work
2023-02-25 02:08:50 +09:00
Hajime Hoshi
185529f1cb
Revert "internal/restorable: use a smaller size rectangle for staleRegion"
...
This reverts commit e4debfd466
.
Reason: test failures on Windows: https://github.com/hajimehoshi/ebiten/actions/runs/4262488629/jobs/7418053241
2023-02-24 21:56:32 +09:00
Hajime Hoshi
e4debfd466
internal/restorable: use a smaller size rectangle for staleRegion
2023-02-24 21:33:39 +09:00
Hajime Hoshi
745a69aeaa
internal/restorable: update comments
2023-02-24 18:25:17 +09:00
Hajime Hoshi
d947cf0da0
internal/atlas: refactoring: use moveTo to make an image isolated
...
This reduces backend allocations by &backend{...}.
Updates #2581
2023-02-23 02:23:03 +09:00
Hajime Hoshi
0720ec2251
internal/packing: allow initialization with a rectangle size
...
Updates #2327
2023-02-23 00:45:42 +09:00
Hajime Hoshi
b08b740914
internal/buffered: bug fix: functions were not concurrent-safe
...
Before this change, `delayedCommandsFlushed` was set as 1 BEFORE
buffered commands were flushed. This meant that a function call and
a command being flushed were not concurrent-safe.
This change fixes this issue by changing the timing of setting
`delayedCommandsFlushed` as 1 to the later time after flushing the
buffered commands.
Closes #2580
2023-02-21 20:38:06 +09:00
Hajime Hoshi
ea7d007df9
internal/ui: bug fix: dstRegion should not exceed the image region
...
Closes #2577
2023-02-21 14:15:39 +09:00
Hajime Hoshi
ad7d5a86f9
internal/shader: bug fix: check the type for composite literal
...
Closes #2348
2023-02-20 23:07:11 +09:00
Hajime Hoshi
d91b8cae88
internal/ui: reland: refactoring: improve anti-alias logic
...
* Remove the image extension. The image is always flushed when necessary.
* Use a small offscreen image whichever the blend is.
Updates #2399
2023-02-19 23:49:32 +09:00
Hajime Hoshi
3aa8448511
Revert "internal/ui: refactoring: improve anti-alias logic"
...
This reverts commit 41f8295611
.
Reason: test failures: https://github.com/hajimehoshi/ebiten/actions/runs/4216421788/jobs/7318236488
2023-02-19 22:46:37 +09:00
Hajime Hoshi
41f8295611
internal/ui: refactoring: improve anti-alias logic
...
* Remove the image extension. The image is always flushed when necessary.
* Use a small offscreen image whichever the blend is.
Closes #2399
2023-02-19 22:14:23 +09:00
Hajime Hoshi
961c34efb5
internal/ui: use a small buffer image for anti-alias
...
Closes #2399
2023-02-19 17:35:43 +09:00
Hajime Hoshi
8479fee606
internal/ui: refactoring
2023-02-18 18:23:57 +09:00
Hajime Hoshi
0e57fc4c5f
internal/processtest: set timeout
...
Updates #2571
2023-02-18 17:36:31 +09:00
Hajime Hoshi
56597800dd
internal/ui: refactoring: add bigOffscreenImage
...
Updates #2399
2023-02-18 02:32:41 +09:00
Hajime Hoshi
7018d1aebe
internal/processtest: fix the timeout logic
...
Updates #2571
2023-02-15 22:41:18 +09:00
Hajime Hoshi
a65b65110b
Revert "internal/processtest: prevent parallel process testing"
...
This reverts commit 397da70815
.
Reason: This did not resolve the issue: https://github.com/hajimehoshi/ebiten/actions/runs/4180959132/jobs/7242421909
Updates #2571
2023-02-15 15:13:57 +09:00
Hajime Hoshi
7315044dcf
internal/ui: remove a redundant call to close a window
...
glfw.Terminate should close the window too. This might fix the issue
so let's wait and see.
Updates #2551
2023-02-15 14:36:28 +09:00
Hajime Hoshi
397da70815
internal/processtest: prevent parallel process testing
...
Updates #2571
2023-02-14 18:13:27 +09:00
TotallyGamerJet
93537650c0
internal/goglfw: use platform agnostic functions for context_windows.go ( #2570 )
...
context_windows.go is used for all the platforms. However, it used syscall.Syscall which behaves differently on macOS
and Windows as well as windows.BytePtrToString which isn't available on Linux or macOS.
This commit replaces syscall.Syscall with purego.SyscallN and windows.BytePtrToString with a copied version called
bytePtrToString.
Updates #2546
2023-02-10 02:35:17 +09:00
TotallyGamerJet
b359985e97
internal/goglfw: separate windows specific struct from common structs ( #2567 )
...
Many of the structs found in internal.h (internal_windows.go) contain defines such as GLFW_WIN32_WINDOW_STATE
which gets replaced with a struct defined in win32platform_windows.go (win32_platform.h).
Originally, these structs where directly placed inside of internal_windows.go. However, to make it easier to add macOS
and Linux these cannot be in this file.
This commit separates the windows specific structs into the respective windows file and updates the field to be named
state.
Updates #2546
2023-02-08 03:05:46 +09:00
Hajime Hoshi
8864ce1291
all: update comments
2023-02-07 12:05:43 +09:00
Hajime Hoshi
f4371991fe
internal/gamepad: refactoring
2023-02-02 22:33:01 +09:00
Hajime Hoshi
628418d88e
internal/gamepaddb: update the database
2023-02-02 22:00:34 +09:00
Pierre Curto
4de807cc44
all: fix typos ( #2558 )
...
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Hajime Hoshi
f009dd8dd2
ebiten: implement DroppedFiles to replace AppendDroppedFiles
...
Closes #2552
2023-01-25 14:27:11 +09:00
Hajime Hoshi
aa52402a90
internal/graphicsdriver/metal: fix a comment
2023-01-24 02:22:35 +09:00
Hajime Hoshi
16e49e0499
internal/ui: fix a potential out-of-range error
2023-01-24 00:32:08 +09:00
Hajime Hoshi
7f39b9c5b6
internal/graphicsdriver/metal: use supportsFeatureSet: as a fallback
...
This change is a fix for a regression that happened on macOS High Sierra.
Closes #2553
2023-01-23 23:44:56 +09:00
Hajime Hoshi
84e32c2e4e
internal/ui: more precise detection of directory on browsers
...
Updates #1868
2023-01-22 18:28:34 +09:00
Hajime Hoshi
8c25fac860
ebiten: add AppendDroppedFiles
...
Closes #1868
2023-01-22 17:22:25 +09:00
Hajime Hoshi
b79f0394cc
internal/ui: refactoring: allow slices in InputState
2023-01-22 01:28:57 +09:00
Hajime Hoshi
d53803615a
internal/ui: merge a window-closing state into an input state
2023-01-21 23:42:48 +09:00
Hajime Hoshi
35e25a3636
rename internal/glfwwin -> internal/goglfw
...
Updates #2546
2023-01-21 22:09:21 +09:00
Hajime Hoshi
06bc569b73
internal/shader: bug fix: wrongly typed constants were unexpectedly used
...
Closes #2549
2023-01-20 02:26:39 +09:00
Hajime Hoshi
f054a7634a
ebiten: deprecate (*Image).Size
...
Closes #2351
2023-01-20 01:26:37 +09:00
Hajime Hoshi
96a44eceaf
internal/glfwwin: remove unused functions
2023-01-14 17:04:46 +09:00
Hajime Hoshi
72f026e254
internal/graphicsdriver/opengl/gl: bug fix: searching GL libraries failed on some machines
...
On a Debian machine, LD_LIBRARY_PATH might not be set and libGL.so might
not exist (libGL.so.1 exists instead). In this case, searching for a GL
library fails
This change fixes the issue by not using LD_LIBRARY_PATH and also including
`libGL.so.*` files as candidates for dlopen.
Closes #2539
2023-01-13 15:08:06 +09:00
Hajime Hoshi
08fba564f8
internal/ui: refactoring: define global sel_ objects
2023-01-09 01:41:13 +09:00
divVerent
abece041f4
internal/graphicsdriver/opengl: fix state tracking of glBindTexture / glActiveTexture interaction ( #2526 )
...
After switching texture units using glActiveTexture, a different texture may
be bound. For now, let's just force the active texture state variable to zero
so the next glBindTexture call isn't skipped.
Closes #2525
2023-01-07 23:13:14 +09:00
Hajime Hoshi
95f1ef0fb9
internal/ui: bug fix: recover the cursor shape when the cursor is visible
...
Closes #2527
2023-01-07 20:03:21 +09:00
Hajime Hoshi
86fa9366f7
internal/ui: use 'set' instead of 'push' for cursors
...
We don't need to use a cursor stack.
2023-01-07 19:16:41 +09:00
Hajime Hoshi
847d1cae73
internal/graphicsdriver/opengl/gl/: refactoring
2023-01-07 17:01:00 +09:00
Hajime Hoshi
d615c2f42a
internal/graphicsdriver/opengl/gl: bug fix: isES was not set
2023-01-07 03:46:30 +09:00
Hajime Hoshi
869ca1e01f
internal/graphicsdriver/opengl/gl: fix a wrong comment
2023-01-07 03:41:02 +09:00
Hajime Hoshi
983e8abd46
internal/graphicsdriver/opengl/gl: bug fix: an unavailable library name might be chosen
...
Instead, let's try all the names with dlopen.
Updates #2523
2023-01-07 03:06:12 +09:00
Hajime Hoshi
df7b7b731e
internal/graphicsdriver/opengl/gl: bug fix: libGL.so might not exist in Steam
...
Instead, libGL.so.1 might exist. Use LD_LIBRARY_PATH and list the
candidates.
Closes #2523
2023-01-07 00:03:07 +09:00
Hajime Hoshi
b860d8dc61
internal/graphicsdriver/metal/mtl: bug fix: test failures
2023-01-05 14:14:42 +09:00
Hajime Hoshi
c5848455f5
internal/graphicsdriver/metal: use MTLGPUFamily instead of MTLGPUFeatureSet
2023-01-05 13:37:37 +09:00
Hajime Hoshi
cf76e3c646
internal/graphicsdriver/opengl: better place to reset uniform variables
...
Updates #2517
2023-01-04 01:36:04 +09:00
Hajime Hoshi
599be725b9
internal/graphicsdriver/metal: fix comments
2023-01-03 23:16:01 +09:00
Hajime Hoshi
7418576c16
internal/ui: re-enable skipping to render the final screen when possible
...
With Metal, nextDrawable could return immediately when a command buffer
is empty. To avoid high CPU usage, this change adds a slight sleep in
this case.
With DirectX, Present waits for a while even though nothing is updated,
then that's fine.
Updates #2341
Updates #2342
Updates #2520
2023-01-03 23:09:28 +09:00
Hajime Hoshi
edb952c9e7
internal/graphicsdriver/metal: add comments
2023-01-03 22:10:33 +09:00
Hajime Hoshi
365740aca9
internal/ui: update comments
...
Updates #2521
2023-01-03 21:39:34 +09:00
Hajime Hoshi
67c9d65d82
internal/ui: refactoring
2023-01-03 21:17:47 +09:00
Hajime Hoshi
0bdfeec610
internal/ui: use a separate render thread for Nintendo Switch
...
Updates #2512
2023-01-03 21:12:18 +09:00
Hajime Hoshi
312dce950c
internal/ui: bug fix: compile failures with -tags=nintendosdk
...
Needed to use NativeDisplayType for eglGetDisplay.
2023-01-03 20:38:45 +09:00
Hajime Hoshi
6344273b7c
internal/ui: bug fix: compile failures with -tags=nintendosdk
2023-01-03 20:29:05 +09:00
Hajime Hoshi
73985c6c96
internal/ui: bug fix: compile failures with -tags=nintendosdk
2023-01-03 20:12:36 +09:00
Hajime Hoshi
723a44a822
internal/ui: rename ebitengine_Init -> ebitengine_Initialize
2023-01-03 19:23:38 +09:00
Hajime Hoshi
0e0205b2d0
internal/ui: use -overlay to provide the implementation for Nintendo Switch
...
Closes #2372
2023-01-03 19:10:15 +09:00
Hajime Hoshi
edf35b02cb
internal/graphicsdriver/opengl: record last uniform variables and reset them before swapping buffers
...
This is basically a revert of 6b4c696b31
.
This change resets the last uniform variables before swapping
buffers.
Updates #2517
2023-01-03 03:13:46 +09:00
Hajime Hoshi
da97657afb
Revert "internal/ui: refactoring: remove unnecessary hack for unfocusing"
...
This reverts commit 3f753b7086
.
Reason: this was actually necessary.
Updates #982
Updates #987
Closes #2521
2023-01-03 02:06:55 +09:00
Hajime Hoshi
70bcec189d
internal/ui: refactoring
2023-01-03 01:43:55 +09:00
Hajime Hoshi
e4b15faefe
internal/ui: bug fix: wrong condition
2023-01-03 01:28:51 +09:00
Hajime Hoshi
bbc82ef2db
internal/ui: skip rendering onto the final framebuffer only for OpenGL
...
This was reverted at a049acd94e
but now
I've confirmed this is not problematic only with OpenGL.
Updates #2341
Updates #2342
2023-01-03 01:24:53 +09:00
Hajime Hoshi
6b4c696b31
internal/graphicsdriver/opengl: bug fix: needed always to set uniform variables
...
Before this fix, setting uniform variables could be skipped when the
values were the same. This caused some issues when a number of drawing
commands were much small than usual (e.g. SetScreenClearedEveryFrame
with false).
This change fixes this by not doing such optimization. Unfortunately
it was impossible to create a minimum reproducible unit test since
we cannot test the final screen framebuffer's states so far.
Closes #2517
2023-01-03 00:43:10 +09:00
Hajime Hoshi
a049acd94e
internal/ui: disable the optimization to skip rendering offscreen
...
This caused some issues in various environments. Until we find a good
solution, let's disable this.
Updates #2341
Updates #2342
Closes #2518
2023-01-02 23:14:03 +09:00
Hajime Hoshi
4d270de75e
internal/atlas: renmae functions
...
Updates #2519
2023-01-02 20:18:05 +09:00
Hajime Hoshi
bb1021a549
internal/atlas: ensure the given sizes must be power of 2
...
Updates #2519
2023-01-02 19:17:27 +09:00
Hajime Hoshi
b4d8519f97
internal/packing: remove unused functions
2023-01-02 18:21:21 +09:00
Hajime Hoshi
471237b701
internal/ui: bug fix: ignore ERROR_BUSY when deleting a GL context
...
Closes #2518
2023-01-02 15:05:16 +09:00
Hajime Hoshi
7018318546
internal/ui: bug fix: compile error on the testing CI
2023-01-01 18:01:14 +09:00
Hajime Hoshi
bba32bc06e
internal/ui: refactoring
2023-01-01 17:45:20 +09:00
Hajime Hoshi
fd1a90411a
internal/nintendosdk: refactoring
2023-01-01 17:36:27 +09:00
Hajime Hoshi
afbd1aebf1
internal/ui: use -overlay to provide the implementation for Nintendo Switch
...
Updates #2372
2023-01-01 01:35:05 +09:00
Hajime Hoshi
58692f6d85
internal/gamepad: refactoring
2023-01-01 00:58:42 +09:00
Hajime Hoshi
77f32bd088
internal/gamepad: use -overlay to provide the implementation for Nintendo Switch
...
Updates #2372
2022-12-31 18:08:28 +09:00
Hajime Hoshi
34941ca083
all: separate the rendering thread from the main thread
...
Updates #1704
Closes #2512
2022-12-30 22:57:34 +09:00
Hajime Hoshi
0fc21470e2
internal/ui: move some context-dependent processes to updateFrameImpl
...
This is a preparation to introduce an independent thread for rendering.
Updates #2512
2022-12-30 22:06:36 +09:00
Hajime Hoshi
b9fb4e9f50
internal/ui: remove an unnecessary hack for macOS
...
Now macOS always uses the native fullscreen even for a transparent
window, we no longer need a hack to call SwapBuffers explicitly.
Updates #1004
2022-12-30 16:25:05 +09:00
Hajime Hoshi
0a03df297b
internal/ui: make it explicit to call swapBuffers only w/ OpenGL
2022-12-30 15:44:01 +09:00
Hajime Hoshi
0e137e8dd7
internal/ui: bug fix: compile error on mobiles
2022-12-30 15:44:01 +09:00
Hajime Hoshi
8902d95b2d
internal/ui: remove unused function runOnAnotherThreadFromMainThread
2022-12-30 13:52:05 +09:00
Hajime Hoshi
e1992347b7
internal/graphicscommand: rename SetRenderingThread -> SetRenderThread
2022-12-30 13:51:32 +09:00
Hajime Hoshi
fa4916d063
internal/ui: refactoring
2022-12-30 13:28:00 +09:00
Hajime Hoshi
3f753b7086
internal/ui: refactoring: remove unnecessary hack for unfocusing
...
The sleeping for an unfocused state also happens in (*userInterfaceImpl).update().
Updates #982
Updates #987
2022-12-30 00:41:46 +09:00
Hajime Hoshi
7e7deeab22
internal/ui: bug fix: SetWindowIcon crashed in the single-thread mode
...
Updates #1468
Closes #2513
2022-12-30 00:01:11 +09:00
Hajime Hoshi
b597ed1e27
internal/ui: remove unnecessary swapBuffer call
...
This was introduced at 9e161864f6
, the
background is now unclear. Things work even without this hack.
Updates #157
Updates #158
2022-12-29 21:48:37 +09:00
Hajime Hoshi
42c08698fb
internal/ui: give up re-rendering on resizing the window
...
It seems difficult to implement this correctly as long as the rendering
thread is the same as the main thread.
Closes #2144
Updates #2512
2022-12-29 21:27:44 +09:00
Hajime Hoshi
dd853050e9
internal/ui: refactoring
2022-12-29 21:09:30 +09:00
Hajime Hoshi
4d89b5de07
internal/ui: refactoring
2022-12-29 20:47:32 +09:00
Hajime Hoshi
e5b9569142
internal/ui: bug fix: the env variable should be used only when the library is not specified
...
Updates #2378
2022-12-29 15:44:55 +09:00
Hajime Hoshi
8d020ad414
internal/graphicsdriver/metal: refactoring
2022-12-29 15:27:51 +09:00
Hajime Hoshi
5e17791e4e
internal/ui: bug fix: an offscreen was broken with SetScreenClearedEveryFrame(false)
...
Updates #2500
Closes #2510
2022-12-29 14:57:07 +09:00
Hajime Hoshi
cba6905c57
internal/glfwwin: bug fix: MapVirtualKeyW is not defined on Xbox
2022-12-29 00:53:03 +09:00
Hajime Hoshi
0756be0b68
cmd/ebitenmobile: use an independent thread for rendering on iOS
...
Closes #2508
2022-12-28 23:37:13 +09:00
Hajime Hoshi
c638727759
internal/thread: remove Stop and use context.Context instead
2022-12-28 17:11:55 +09:00
Hajime Hoshi
01eb1a0bca
internal/ui: refactoring
2022-12-28 16:44:22 +09:00
Hajime Hoshi
e9248c6f33
internal/ui: rename t -> mainThread
2022-12-28 15:59:53 +09:00
Hajime Hoshi
089ba9ee20
internal/thread: update comments
2022-12-28 14:46:54 +09:00
Hajime Hoshi
ece60af1b7
internal/graphicsdriver/metal: stop using presentsWithTransaction
...
presentsWithTransaction caused many troubles. The critical thing was
that nextDrawable sometimes took more than one second when a user
inputs with NSTextView.
Fortunately, applications work well even without presentsWithTransaction.
Updates #1029
Updates #1196
Updates #1745
Updates #1974
2022-12-27 19:00:56 +09:00
Hajime Hoshi
5e7ec81f5c
internal/ui: rename functions
2022-12-27 12:54:01 +09:00
Hajime Hoshi
41a68bf17b
internal/ui: remove unused functions
2022-12-26 22:43:20 +09:00
Hajime Hoshi
0c072894b5
internal/microsoftgdk: improve forward compatibility
2022-12-25 22:00:22 +09:00
Hajime Hoshi
8b588587cc
internal/graphicsdriver/directx: do not cache a vertex shader when an error occurs
2022-12-25 04:27:15 +09:00
Hajime Hoshi
dd7e125d9c
ebiten: add KeyName for desktops and browsers
...
Updates #1904
2022-12-25 03:37:29 +09:00
Hajime Hoshi
e6346c01d2
internal/ui: stop panicking at Key.String
2022-12-25 00:33:08 +09:00
Hajime Hoshi
8e1bd4eaba
internal/graphicsdriver/directx: refactoring
2022-12-24 18:05:47 +09:00
Hajime Hoshi
fda0b1cbcb
internal/graphicsdriver/directx: reuse a compiled vertex shader if possible
...
D3DCompile can be a very slow function, and let's skip this if possible.
2022-12-24 17:44:54 +09:00
Hajime Hoshi
88fe3d1287
internal/shaderir: rename TextureNum to TextureCount
2022-12-24 15:55:05 +09:00
Hajime Hoshi
88e5d5e059
Revert "internal/shaderir: refactoring: remove Program.TextureNum"
...
This reverts commit c2bea16776
.
Reason: test compilation errors
2022-12-24 15:53:16 +09:00
Hajime Hoshi
c2bea16776
internal/shaderir: refactoring: remove Program.TextureNum
2022-12-24 15:15:41 +09:00
Hajime Hoshi
f9650fbb8c
internal/graphics: update error messages
2022-12-24 14:34:02 +09:00
Hajime Hoshi
e4576a3de5
internal/restorable: bug fix: concurrent map write
2022-12-24 03:14:04 +09:00
Hajime Hoshi
71492554a7
internal/restorable: compile shaders in parallel
2022-12-24 02:00:42 +09:00
Hajime Hoshi
1b4f68d775
internal/graphicsdriver/directx: call D3DCompile in parallel
...
D3DCompile can be very slow on some old machines.
See also https://bugs.chromium.org/p/angleproject/issues/detail?id=422
2022-12-24 01:22:33 +09:00
Hajime Hoshi
de8184ac10
internal/graphicsdriver/directx: implement suspend/resume for Xbox
2022-12-23 17:28:03 +09:00
Hajime Hoshi
d3655940bd
internal/ui: bug fix: input states must be updated before the hook
...
Closes #2502
2022-12-21 11:46:58 +09:00
Hajime Hoshi
a5b6f39ed7
internal/ui: bug fix: reset the input state immediately after reading
...
Before this change, the input state was reset at the end of a tick.
This means that wheel deltas or input chars in a tick might be reset
unexpectedly.
This change fixes the issue by reseting the input state immediately
when reading, so that wheel events and input-char events are preserved.
Updates #2496
Updates #2501
2022-12-21 00:27:28 +09:00
Hajime Hoshi
38f802cb40
internal/ui: simplify the logic of skipping rendering
2022-12-20 11:34:47 +09:00
Hajime Hoshi
59295cc85f
internal/ui: bug fix: input state should be reset for each tick, not frame
...
Before this change, input states were reset for each frame. When FPS
is bigger than TPS, the input state was reset more often than expected
and then some inputs were missing.
This change fixes the issue by resetting input states not for each frame
but for each tick.
This change also updates some comments of the input API.
Updates #2496
Closes #2501
2022-12-20 10:07:19 +09:00
Hajime Hoshi
3eb2b480be
internal/ui: bug fix: adjust the max skip count for fullscreening
...
Closes #2500
2022-12-20 02:46:45 +09:00
Hajime Hoshi
d1b9a0a9a1
internal/ui: freeze the input state for each frame
...
After this change, the input APIs will return more consistent results
for one frame.
Closes #2496
2022-12-18 23:54:43 +09:00
Hajime Hoshi
3152d88477
internal/ui: remove old Edge browser support
...
Closes #1059
2022-12-16 22:56:36 +09:00
Hajime Hoshi
9ad7a55db2
internal/ui: remove unused functions
2022-12-16 15:17:59 +09:00
Hajime Hoshi
61a009e508
internal/ui: bug fix: FPS drop on fullscreen on macOS 13
...
Updates #1745
Closes #2495
2022-12-16 02:59:06 +09:00
Hajime Hoshi
72dc730b42
internal/ui: bug fix: care the case when CoInitializeEx returns S_FALSE
2022-12-13 13:01:32 +09:00
Hajime Hoshi
8ab220df7f
internal/ui: bug fix: compile error
2022-12-13 02:38:45 +09:00
Hajime Hoshi
b022f6d86a
internal/ui: bug fix: error check at syscall
2022-12-13 02:26:07 +09:00
Hajime Hoshi
0bec1e65fa
ebiten: add RunGameOptions.SkipTaskbar
...
Closes #1518
2022-12-13 02:00:44 +09:00
Hajime Hoshi
6ed5293132
internal/gamepaddb: update gamepad db
2022-12-12 02:50:58 +09:00
Hajime Hoshi
c321d069a8
internal/graphicscommand: remove unnecessary type parameters
2022-12-10 00:43:41 +09:00
Hajime Hoshi
3024e07ecc
ebiten: add RunGameOptions.ScreenTransparent
...
Closes #2378
2022-12-09 22:50:57 +09:00
Hajime Hoshi
d31b0189a2
ebiten: add RunGameOptions.InitUnfocused
...
Updates #2378
2022-12-09 21:27:32 +09:00
Hajime Hoshi
bb68ebfcad
ebiten: add RunGameWithOptions to specify graphics library
...
This also adds mobile.SetGameWithOptions.
Updates #2378
2022-12-09 21:27:31 +09:00
Hajime Hoshi
015ce2b262
internal/ui: refactoring: reduce APIs
2022-12-09 00:05:22 +09:00
Hajime Hoshi
1f741fa007
internal/glfw: do not panic for an error at Monitor.GetContentScale
...
Updates #2488
2022-12-08 13:39:19 +09:00
Hajime Hoshi
8a95b1d85c
internal/glfwwin: ignore an error ERROR_SUCCESS for all Windows APIs
...
This is still mysterious, but this can happen on some old machines.
Updates #2478
Closes #2489
2022-12-08 12:33:52 +09:00
Hajime Hoshi
14688348a8
internal/ui: bug fix: wrong calculation of wheel scrolling
...
Closes #2487
2022-12-08 02:10:01 +09:00
Hajime Hoshi
102a2d2138
internal/graphicsdriver/directx: change the default feature level to 11_0
...
The feature level 12_0 causes some issues on some machines. As we now
have EBITENGINE_DIRECTX_FEATURE_LEVEL, let's go back to the default
feature level 11_0.
Updates #2486
2022-12-07 21:16:47 +09:00
Hajime Hoshi
0d173834a6
all: speed optimization
2022-12-03 23:09:41 +09:00
Hajime Hoshi
89c64f83e3
ebiten: performance improvement by reducing allocations of []float32
2022-12-03 21:53:56 +09:00
Hajime Hoshi
6a72b1e10d
internal/ui: refactoring
2022-12-03 21:25:28 +09:00
Hajime Hoshi
0a6813c17f
internal/graphics: use flatten []float32 slice instead of [][]float32
...
Closes #2479
2022-12-03 20:23:58 +09:00
Hajime Hoshi
9d74784723
internal/ui: refactoring: simplify ConvertUniforms
2022-12-03 18:26:30 +09:00
Hajime Hoshi
724516a0e0
internal/shaderir: add comments
2022-12-03 15:37:14 +09:00
Hajime Hoshi
6a0eb82207
internal/glfwwin: bug fix: crash when dropping a file
...
Updates #2478
2022-12-03 04:47:05 +09:00
Hajime Hoshi
15c2fe01c0
internal/glfwwin: bug fix: unexpected error at wglSwapIntervalEXT
...
Updates #2478
2022-12-03 04:37:23 +09:00
Hajime Hoshi
ae715ba33b
internal/shaderir: performance improvement by using a slice instead of a map
2022-12-03 01:10:29 +09:00
Hajime Hoshi
61f1d8b69f
internal/graphics: remove the common vertices backend
...
It was actually impossible to use the common vertices backend in a
thread-safe manner, and actually this caused race conditions.
This changes fixes the issue by giving up a central backend, and
letting images have their own vertices buffer.
Closes #2473
2022-12-03 01:02:23 +09:00
Hajime Hoshi
3386908902
ebiten: swap the definition MouseButtonMiddle and MouseButtonRight
...
This follows the Web standard.
Closes #2468
2022-11-27 13:51:09 +09:00
Hajime Hoshi
e98661c1d3
internal/ui: forbid fullscreen on Xbox
2022-11-25 00:59:15 +09:00
Hajime Hoshi
9e9cec249a
ebiten: make some MouseButton definitions explicit
...
This change redefines named mouse button consts like MouseButtonLeft
to use MouseButton0, so that users can know which enums are the same
and different.
Updates #2445
2022-11-23 04:41:11 +09:00
Kacper Drobny
6e12fd13e4
ebiten: add additional MouseButtons ( #2467 )
...
Closes #2445
2022-11-23 04:28:34 +09:00
Hajime Hoshi
5356b44286
internal/graphicsdriver/opengl: add comments about Firefox
...
Updates #2077
2022-11-23 00:57:16 +09:00
Hajime Hoshi
67430362cc
internal/graphicsdriver/directx: add EBITENGINE_DIRECTX_FEATURE_LEVEL
...
A fix for #2447 was a breaking-change as the DirectX driver was no longer
available for some old graphics card.
To support such old cards, provide a new environment variable
EBITENGINE_DIRECTX_FEATURE_LEVEL to specify a feature level.
The possible values are 11_0, 11_1, 12_0, 12_1, and 12_2. The default
value is 12_0.
Closes #2466
2022-11-21 02:46:07 +09:00
Hajime Hoshi
f129c23393
all: update URLs in comments
2022-11-21 01:46:50 +09:00
Hajime Hoshi
e9e5d27d2c
internal/shader: bug fix: % operators for integer vecs didn't work
...
Closes #1911
2022-11-21 01:39:20 +09:00
Hajime Hoshi
0b9cbaa1ed
internal/shader: introduce integer vectors (ivec2, ivec3, ivec4)
...
Closes #1911
2022-11-21 00:31:23 +09:00
TotallyGamerJet
f09c4a624e
internal/gamepad: use RegisterLibFunc ( #2465 )
...
RegisterLibFunction is typesafe and now supports float arguments.
Updates #1162
2022-11-21 00:24:27 +09:00
TotallyGamerJet
fb612ab443
internal/cocoa, internal/graphicsdriver/mtl: remove usages of NSInvocations to directly call ID.Send ( #2464 )
...
purego now supports using floats as arguments.
We can remove these instances of NSInvocation that
only existed to circumvent that feature.
Updates #1162
2022-11-20 23:48:22 +09:00
Hajime Hoshi
9a75e266d4
internal/graphicsdriver: fix comments
2022-11-20 23:18:40 +09:00
Hajime Hoshi
7961654927
internal/graphicsdriver/metal: bug fix: wrong alignment for vec3
2022-11-20 23:14:09 +09:00
Hajime Hoshi
5aecd6762c
internal/shader: refactoring
2022-11-20 18:25:08 +09:00
Hajime Hoshi
dc1df824a5
internal/shader: more strict type checks with built-in functions
2022-11-20 17:47:53 +09:00
Hajime Hoshi
5d8216def3
internal/shader: stricter const type check
2022-11-20 15:52:33 +09:00
Hajime Hoshi
5f4e3a0348
internal/shader: add swizzling check
2022-11-19 22:39:17 +09:00
Hajime Hoshi
bba196d1ec
ebiten: allow array types for uniform variables
...
Closes #2448
2022-11-18 14:08:31 +09:00
Hajime Hoshi
90213d5d80
internal/graphicsdriver/opengl: refactoring
2022-11-18 13:32:09 +09:00
Hajime Hoshi
95b4e67c77
internal/graphicsdriver/opengl: reduce context functions
2022-11-18 03:18:30 +09:00
Hajime Hoshi
4de6da0a50
internal/graphicsdriver/opengl: use an appropriate stencil buffer format
2022-11-17 13:31:36 +09:00
Hajime Hoshi
21670691b1
internal/graphicsdriver/opengl: remove duplicated code
2022-11-17 13:22:48 +09:00
Hajime Hoshi
d6027a9357
internal/graphicsdriver/opengl: remove duplicated code
2022-11-17 13:13:15 +09:00
Hajime Hoshi
8cc6fa82fd
internal/graphicsdriver/opengl: remove fnIsContextLost
...
As restoring from context lost doesn't happen on browsers, isContextLost
doesn't have to be called.
2022-11-17 12:43:26 +09:00
Hajime Hoshi
c768860f3f
internal/graphicsdriver/opengl: remove fnGetExtension
2022-11-17 12:40:56 +09:00
Hajime Hoshi
bae5aa7732
internal/graphicsdriver/opengl: move initGL to NewGraphics
...
As restoring from context lost doesn't happen on browsers, initilizing
GL doesn't have to be done at reset.
2022-11-17 12:34:55 +09:00
Hajime Hoshi
4082223aec
internal/graphicsdriver/opengl: remove webGLVersion
2022-11-17 12:27:32 +09:00
Hajime Hoshi
74d9515345
internal/graphicsdriver/opengl: refactoring: move gl_js to gl/context_js.go
...
This unifies the OpenGL context interface for all the platforms.
2022-11-17 12:22:46 +09:00
Hajime Hoshi
f08983e14d
internal/graphicsdriver/opengl: remove unused variables
...
It should be safe to assume 0 is an invalid texture ID in OpenGL.
https://registry.khronos.org/OpenGL-Refpages/gl4/html/glIsTexture.xhtml
> If texture is zero, or is a non-zero value that is not currently the
> name of a texture, or if an error occurs, glIsTexture returns GL_FALSE.
2022-11-17 10:53:28 +09:00
Hajime Hoshi
de3702e4c2
internal/graphicsdriver/opengl: reduce unnecessary slice allocations
2022-11-17 03:01:31 +09:00
Hajime Hoshi
9df4770d20
internal/graphicsdriver/opengl/gl: make Context closer to gomobile's Context
2022-11-17 01:23:27 +09:00
Hajime Hoshi
49fc1cfdc0
internal/graphicsdriver/opengl/gl: refactoring: replace some *iv functions with *i
2022-11-17 00:26:33 +09:00
Hajime Hoshi
098fed65d5
internal/graphicsdriver/opengl/gl: refactoring: replace GetIntegerv -> GetInteger
2022-11-16 23:59:28 +09:00
Hajime Hoshi
c7c9500ba6
internal/graphicsdriver/directx: bug fix: a software adaptor was unexpectedly chosen
...
Closes #2459
2022-11-16 15:46:17 +09:00
Hajime Hoshi
4c389c1752
internal/graphicsdriver/opengl/gl: bug fix: compile error
2022-11-15 02:41:59 +09:00
Hajime Hoshi
056042ca92
internal/graphicsdriver/opengl/gl: refactoring
2022-11-15 02:38:38 +09:00
Hajime Hoshi
0d8912e7ae
internal/graphicsdriver/opengl/gl: bug fix: failed to load OpenGL(ES).framework on iOS
...
This change also fixes the issue that *EXT functions are missing
in OpenGLES.framework.
Closes #2456
2022-11-15 02:33:45 +09:00
Hajime Hoshi
7d146fb70b
internal/ui: bug fix: IsGL / SetUIView can be called before initialization is done
...
The functions in the package `mobile/ebitenmobileview` could be invoked
from EbitenViewController even before the graphics driver initialization
is done in theory.
This change fixes this issue by waiting the initialization by
channels. Also, this change adds error handlings at these functions.
Closes #2455
2022-11-15 01:53:20 +09:00
Hajime Hoshi
f4e63602d3
internal/graphicsdriver/opengl/gl: dynamic function loading for Android
...
Closes #2450
2022-11-14 23:23:50 +09:00
Hajime Hoshi
31af27b926
internal/graphicsdriver/opengl/gl: fix error message
2022-11-14 13:19:19 +09:00
Hajime Hoshi
f6f7ed3e3d
internal/graphicsdriver/opengl/gl: automatically choose OpenGL and OpenGL ES
...
Updates #292
2022-11-14 12:50:53 +09:00
Hajime Hoshi
fcf454ef20
internal/graphicsdriver/opengl/gl: use RTLD_LAZY instead of RTLD_NOW
...
See the discussion at #2453 .
2022-11-14 04:46:11 +09:00
TotallyGamerJet
56ec19caa1
all: use RTLD_LAZY in dlopen for darwin ( #2453 )
...
dlopen requires either RTLD_LAZY or RTLD_NOW but there was neither.
Updates #1162
2022-11-14 04:44:51 +09:00
Hajime Hoshi
072e91d67f
internal/graphicsdriver/opengl/gl: dynamic-load functions with GLX
...
Updates #292
Updates #2450
2022-11-14 03:21:42 +09:00
Hajime Hoshi
f093996284
internal/graphicsdriver/opengl/gl: refactoring
2022-11-14 03:14:21 +09:00
Hajime Hoshi
1e86e7fa18
internal/ui: refactoring: reduce opengles build tags
...
Updates #292
2022-11-14 02:46:34 +09:00
Hajime Hoshi
114a8aa6ea
internal/graphicsdriver/opengl/gl: reland: refactoring: reduce opengles build tags
...
Updates #292
2022-11-14 02:33:23 +09:00
Hajime Hoshi
e8810495cf
internal/graphicsdriver/opengl/gl: reland: refactoring: reduce opengles build tags
...
This is a reland of c9cff69dcb
.
Updates #292
2022-11-14 02:21:18 +09:00
Hajime Hoshi
e87e4ffbd2
Revert "internal/graphicsdriver/opengl/gl: refactoring"
...
This reverts commit c9cff69dcb
.
Reason: compmile error for browsers
2022-11-14 02:17:27 +09:00
Hajime Hoshi
c9cff69dcb
internal/graphicsdriver/opengl/gl: refactoring
2022-11-14 02:13:32 +09:00
Hajime Hoshi
94291ecb17
internal/graphicsdriver/opengl/gl: update copyrights
...
These files are already completely different from the original files.
2022-11-14 01:56:30 +09:00
Hajime Hoshi
39b8a66359
internal/graphicsdriver/opengl/gl: dynamic function load for OpenGL ES
...
Updates #292
Updates #2450
2022-11-13 08:48:26 -08:00
Hajime Hoshi
d09fd90963
internal/ui: use EGL for OpenGL ES
...
Updates #292
2022-11-13 06:23:30 -08:00
Hajime Hoshi
e5e7ceb688
internal/graphicsdriver/opengl/gl: refactoring
2022-11-13 23:10:20 +09:00
Hajime Hoshi
144d2374bf
internal/graphicsdriver/opengl/gl: remove 'egl' build tag
...
Probably nobody uses this.
2022-11-13 22:50:21 +09:00
Hajime Hoshi
5b96d93d13
internal/graphicsdriver/opengl/gl: refactoring
2022-11-13 22:26:13 +09:00
Hajime Hoshi
78f8ddbda8
internal/graphicsdriver/opengl/gl: load OpenGLES.framework if possible on Darwin
...
Closes #2449
2022-11-13 19:51:43 +09:00
Hajime Hoshi
b6ed95750b
internal/graphicsdriver/opengl: unify context_gl.go and context_gles.go
...
Closes #2451
2022-11-13 19:42:21 +09:00
Hajime Hoshi
f69beffc6c
internal/graphicsdriver/opengl: bug fix: initialization was too early on Windows
...
Closes #2452
2022-11-13 18:00:40 +09:00
Hajime Hoshi
b536b82109
internal/graphicsdriver/opengl/gl: hide concrete context types
2022-11-13 17:13:52 +09:00
Hajime Hoshi
b66cf74c99
internal/graphicsdriver/opengl: bug fix: compile error
2022-11-13 16:16:19 +09:00
Hajime Hoshi
656a2d758e
internal/graphicsdriver/opengl: bug fix: compile error
2022-11-13 15:55:33 +09:00
Hajime Hoshi
8393211ed7
internal/graphicsdriver/opengl: bug fix: compile error
2022-11-13 15:44:15 +09:00
Hajime Hoshi
8c49c88b08
internal/graphicsdriver/opengl: refactoring
2022-11-13 15:27:37 +09:00
Hajime Hoshi
42566c6c9a
internal/graphicsdriver/opengl: refactoring: remove SetCanvas
2022-11-13 15:18:44 +09:00
Hajime Hoshi
a0a5f2b301
internal/graphicsdriver/opengl: remove SetGomobileGLContext
...
This change is needed to initialize the context at opengl.NewGraphics.
Updates #2451
2022-11-13 15:07:14 +09:00
Hajime Hoshi
5cfb7c9469
internal/graphicsdriver/opengl: make context_gles.go closer to context_gl.go
...
Updates #2451
2022-11-13 14:20:47 +09:00
Hajime Hoshi
0c5a77eaa4
internal/graphicsdriver/opengl/gles: integrate gles and glconst into gl
...
Updates #2451
2022-11-13 14:15:22 +09:00
Hajime Hoshi
c4abaa32f5
internal/graphicsdriver/opengl: initialize gl at init()
...
This changes context_gl.go a little closer to context_gles.go.
Updates #2451
2022-11-13 04:13:18 +09:00
Hajime Hoshi
bb30b85d29
internal/graphicsdriver/opengl/gl: simplify C code
2022-11-13 03:35:40 +09:00
Hajime Hoshi
879cf50aaf
internal/graphicsdriver/opengl: remove unused functions
2022-11-13 02:54:34 +09:00
Hajime Hoshi
fad9f1592c
internal/graphicsdriver/opengl/gles: remove unused functions
2022-11-13 02:45:53 +09:00
Hajime Hoshi
c5fb6fa23f
internal/graphicsdriver/opengl/gl: remove unused functions
2022-11-13 02:35:45 +09:00
Hajime Hoshi
1ecac8d834
all: allow integer uniform variables for Kage shaders
...
Closes #2305
Updates #2448
2022-11-13 01:49:24 +09:00
Hajime Hoshi
4ff9a12930
internal/graphicscommand: refactoring
2022-11-12 22:26:28 +09:00
Hajime Hoshi
a406904a51
internal/graphicsdriver: refactoring
2022-11-12 21:03:54 +09:00
Hajime Hoshi
419bb4c1e9
all: use uint32 instead of float32 for uniform values
...
This is a preparation for other types of uniform values.
Updates #2305
2022-11-12 20:28:07 +09:00
Hajime Hoshi
0db2318a8d
internal/graphicsdriver/opengl: update comments
2022-11-12 19:31:16 +09:00
Hajime Hoshi
cee948048d
internal/graphicsdriver/opengl: remove unused functions
2022-11-12 19:28:14 +09:00
Hajime Hoshi
4ae84c2232
internal/packing: bug fix: wrong logic for extending a page
...
Before this fix, 0-sized node could be created when extending the
page.
Updates #2327
2022-11-12 17:42:17 +09:00
Hajime Hoshi
2deceaa0af
internal/graphicsdriver/directx: specify DX level 12
...
The DirectX initialization passed but crashed later on some old machines
supporting the feature level 11 but not 12.
This change fixes the issue by changing the required feature level from
11 to 12 so that the initialization fails and OpenGL is used as the
fallback.
Closes #2447
2022-11-12 12:25:24 +09:00
Hajime Hoshi
c72fd7ffcf
internal/packing: enable non-square page size
...
Closes #2327
2022-11-11 23:11:05 +09:00
Hajime Hoshi
fde964312c
internal/packing: reland: refactoring
...
This change basically relands these commits:
* e08078d84a
* 8fa36cc7ef
but with a fix internal/restorable not to create too many images.
Updates #2327
2022-11-11 21:55:11 +09:00
Hajime Hoshi
f593725bf9
Revert "internal/packing: refactoring"
...
This reverts these commits
* 8fa36cc7ef
.
* e08078d84a
Reason: test failures
Updates #2327
2022-11-11 19:35:13 +09:00
Hajime Hoshi
8fa36cc7ef
internal/packing: improve test
...
Updates #2327
2022-11-11 19:26:00 +09:00
Hajime Hoshi
e08078d84a
internal/packing: refactoring
...
Now pages are automatically extended by Alloc.
Updates #2327
2022-11-11 19:12:23 +09:00
Hajime Hoshi
303965e1a9
all: remove unnecessary copying
...
Copying []byte to string should copy the data if necessary, as the
Go specification assures that strings are immutable.
2022-11-11 00:28:47 +09:00
Hajime Hoshi
097adcf8b6
internal/graphicsdriver/opengl/gl: reladn: refactoring
...
This is a reland of a1ad87a262
2022-11-09 21:02:31 +09:00
Hajime Hoshi
96298bb59d
Revert "internal/graphicsdriver/opengl/gl: refactoring"
...
This reverts commit a1ad87a262
.
Reason: compile error
2022-11-09 18:27:06 +09:00
Hajime Hoshi
a1ad87a262
internal/graphicsdriver/opengl/gl: refactoring
2022-11-09 16:07:30 +09:00
Hajime Hoshi
915fff96f8
all: reduce reflect usages
2022-11-09 13:24:31 +09:00
Hajime Hoshi
0d6b42fedd
internal/ui: refactoring: keep screen/offscreen sizes as float64
...
Updates #2285
2022-11-09 01:18:41 +09:00
TotallyGamerJet
8c5f525ac2
internal/ui: use RegisterClass API ( #2442 )
...
Updates #1162
This change uses purego's new RegisterClass API to clean up the
EbitengineWindowDelegate ObjC class. Doing so makes the code
easier to read and more efficient since it directly get the origResizable
and origDelegate fields.
2022-11-07 14:31:39 +09:00
Hajime Hoshi
262ff351f4
internal/graphicsdriver/directx: bug fix: ScheduleFrameEventX might not return S_OK on Xbox One
2022-11-05 15:09:38 +09:00
Hajime Hoshi
58f95dd1e0
internal/ui: clean-up
2022-11-05 14:20:48 +09:00
Hajime Hoshi
cff99106b6
internal/ui: bug fix: fullscreening didn't work correctly on macOS 13
...
As of macOS 13, a retrieved collectionBehavior included
NSWindowCollectionBehaviorFullScreenNone and this prevented the window
from being fullscreen.
This change fixes this issue by removing the flag
NSWindowCollectionBehaviorFullScreenNone when necessary.
Closes #2437
2022-11-05 14:07:02 +09:00
Hajime Hoshi
a6e121613f
internal/graphicsdriver/directx: bug fix: wrong SDK version for Xbox One
2022-11-05 02:31:28 +09:00
Hajime Hoshi
50021ef3e4
internal/graphicscommand: use buffers for []float32 to reduce allocations
2022-11-04 21:55:44 +09:00
Hajime Hoshi
d73e8f785d
internal/graphicsdriver: render various destination regions as one command
...
Closes #2232
2022-11-04 20:49:44 +09:00
Hajime Hoshi
1ce29e2afa
internal/graphicsdriver/directx: reduce rendering paths for even-odd rendering
2022-11-04 18:18:08 +09:00
Hajime Hoshi
0afb6fd22a
internal/graphicsdriver/metal: reduce rendering paths for even-odd rendering
2022-11-04 16:17:51 +09:00
Hajime Hoshi
1839dd0b9b
internal/graphicscommand: bug fix: test failures on Linux
2022-11-04 03:55:05 +09:00
Hajime Hoshi
005e87a917
internal/ui: prepare extra capacities for uniform variables
2022-11-04 03:18:49 +09:00
Hajime Hoshi
80e3baae9f
internal/graphicscommand: reduce allocations of float32 slices
2022-11-04 02:34:44 +09:00
Hajime Hoshi
c4e4e55d75
internal/shaderir: cache reachable uniform variables
...
Updates #2232
2022-11-04 01:28:24 +09:00
Hajime Hoshi
384dee7160
internal/graphicscommand: remove unused uniform variables
...
This improves possibility of merging graphics commands by reducing
uniform variables.
Updates #2232
2022-11-03 22:45:17 +09:00
Hajime Hoshi
0762db3b3e
internal/shaderir: refactoring
2022-11-03 18:16:54 +09:00
Hajime Hoshi
7dbb078a9e
internal/shaderir: refactoring
2022-11-03 17:44:11 +09:00
Hajime Hoshi
e2c25dbc6d
internal/shaderir: rename functions
2022-11-03 17:14:49 +09:00
Artem Yadelskyi
10415d417a
all: replace interface{}
with any
( #2430 )
...
Closes #2429
2022-11-03 15:33:09 +09:00
Artem Yadelskyi
5b53cef59e
all: remove old // +build
comments ( #2431 )
...
Closes #2325
2022-11-03 12:55:14 +09:00
Hajime Hoshi
8aacf067dd
all: use x/sys/execabs instead of os/exec
...
Closes #2418
2022-11-01 23:36:57 +09:00
Hajime Hoshi
1b3696a7ff
internal/graphicsdriver/opengl: fix comments
2022-10-31 12:59:27 +09:00
Hajime Hoshi
a5993f09a2
internal/graphicscommand: refactoring: add preserved uniform variables at the graphicscommand package
...
This is a preparation to skip setting unnecessary uniform variables
like dstRegion.
Updates #2232
2022-10-30 22:30:52 +09:00
Hajime Hoshi
690e73c11b
all: replace reflect.SliceHeader with unsafe.Slice
...
Closes #2420
2022-10-30 12:25:30 +09:00
Hajime Hoshi
ac61126473
internal/graphicscommand: always flush buffers
...
After #2423 is fixed, buffers should be able to be flushed safely
anytime.
Updates #2391
Updates #2423
2022-10-30 10:51:41 +09:00
Hajime Hoshi
b096ba700a
internal/graphicscommand: bug fix: clear buffers when disposing an image
...
Closes #2423
2022-10-30 03:38:53 +09:00
Hajime Hoshi
5eceabd172
Revert "internal/graphicscommand: bug fix: flush image buffers"
...
This reverts commit d6910eb9ab
.
Reason: The wasm flakiness occured again
Updates #2391
Updates #2423
2022-10-30 02:32:28 +09:00
Hajime Hoshi
d6910eb9ab
internal/graphicscommand: bug fix: flush image buffers
...
This is basically a revert for 4d5b608d0c
.
This caused a crash on Windows.
Even after this fix, the browser tests seem no longer flaky, but
I am not 100% sure.
Updates #2391
Closes #2423
2022-10-30 02:21:56 +09:00
Hajime Hoshi
ee595659e7
Revert "internal/gamepad: remove dependency on golang.org/x/sys/unix"
...
This reverts commit 046f7e52a3
.
Reason: As we drop Go 1.16, we no longer have to remove this dependency.
Updates #2421
2022-10-29 23:23:13 +09:00
Hajime Hoshi
046f7e52a3
internal/gamepad: remove dependency on golang.org/x/sys/unix
2022-10-29 21:42:08 +09:00
Hajime Hoshi
ac08ebe080
internal/ui: set SwapInterval(0) when resizing the window
...
This mitigates flickering at least on macOS with OpenGL.
Updates #2144
2022-10-29 17:49:32 +09:00
Hajime Hoshi
066029539e
internal/ui: clean-up code
...
A callback is preferred to a dirty flag.
Updates #2341
2022-10-28 19:07:37 +09:00
Hajime Hoshi
b019a3723a
internal/ui: optimize GPU usages when the screen doesn't have to be updated
...
This change skips rendering when 1) the screen is not cleared every frame
(`SetScreenClearedEveryFrame(false)`) and 2) Draw doesn't draw anything
onto the screen. The GPU usages decreased on some machines (e.g. GPU usage
was 10% with an empty Ebitengine project and became 2-3 % on a Windows
machine).
Updates #2341
2022-10-28 18:51:06 +09:00
Hajime Hoshi
2cf651bed8
internal/graphicsdriver/directx: resize the swap buffer chain at the end of a frame
...
Updates #2144
2022-10-25 00:35:09 +09:00
Nathan Levett
f220eb729c
internal/graphicsdriver/opengl: move OpenGL constants to seperate package ( #2408 )
...
Closes #2389
2022-10-24 23:22:14 +09:00
Hajime Hoshi
3b7bc2fc57
internal/ui: remove unnecessary comments
2022-10-23 00:39:37 +09:00
Hajime Hoshi
fc2f999ebf
internal/ui: refactoring: separate globalState into a new file
2022-10-23 00:11:35 +09:00
Hajime Hoshi
422de70d59
internal/ui: bug fix: screenshot didn't include antialias renderings
2022-10-22 14:19:24 +09:00
Hajime Hoshi
c49db07e75
internal/ui: bug fix: wrong property name was used
...
Closes #2400
2022-10-21 21:37:27 +09:00
Hajime Hoshi
f04e391cb4
all: rename emptyImage -> whiteImage
2022-10-21 15:26:56 +09:00
Hajime Hoshi
a990d79905
internal/ui: refactoring
2022-10-21 03:11:13 +09:00
Hajime Hoshi
9ec23ddeb4
ebiten: add DrawTrianglesOptions.AntiAlias
and DrawTrianglesShaderOptions.AntiAlias
...
Closes #2385
2022-10-21 02:07:41 +09:00
Hajime Hoshi
da5f5ea327
ebiten: add blend factors
...
Updates #2382
2022-10-18 00:21:13 +09:00
Hajime Hoshi
d2a99afa44
internal/graphicsdriver/opengl: bug fix: lastBlend was not updated correctly on GLES
2022-10-17 16:05:09 +09:00
Hajime Hoshi
46a218c278
internal/graphicsdriver/metal/mtl: bug fix: wrong renaming
...
Updates #2382
2022-10-17 01:11:54 +09:00
Hajime Hoshi
871a8869db
ebiten: bug fix: wrong renaming
...
Updates #2382
2022-10-17 01:00:23 +09:00
Hajime Hoshi
180e456a8e
ebiten: rename members of Blend
...
Updates #2382
2022-10-17 00:51:55 +09:00
Hajime Hoshi
e03825bf08
ebiten: add BlendOperationSubtract and BlendOperationReverseSubtract
...
Updates #2382
2022-10-17 00:30:24 +09:00
Hajime Hoshi
06c53c1445
internal/grphicsdriver/opengl: bug fix: wrong consntant was used for blend operations
...
Updates #2382
2022-10-17 00:21:12 +09:00
Hajime Hoshi
b79495761e
ebiten: add Blend and deprecate CompositeMode
...
Updates #2382
2022-10-16 22:47:00 +09:00
Hajime Hoshi
bd0d43f98f
internal/graphicsdriver: use byte for blending members
2022-10-16 20:49:12 +09:00
Hajime Hoshi
b6987b6312
internal/graphicsdriver/opengl: bug fix: needed to reset lastBlend
2022-10-16 20:44:09 +09:00
Hajime Hoshi
7c459c152b
internal/atlas: bug fix: compile error
2022-10-16 20:02:42 +09:00
Hajime Hoshi
2855095ac9
all: unify terms for buffers and flushing
2022-10-16 19:47:00 +09:00
Hajime Hoshi
4d5b608d0c
internal/graphicscommand: bug fix: suppress test flakiness on browsers
...
Closes #2391
2022-10-16 17:55:23 +09:00
Hajime Hoshi
475dc6394f
internal/atlas: remove an unnecessary mutex
...
Updates #2390
2022-10-16 15:29:02 +09:00
Hajime Hoshi
27cb149475
internal/graphicscommand: bug fix: resolve unsent WritePixels commands
...
(*Image).WritePixels doens't send a command to the queue immediately
but caches commands internally. However, the package atlas assumed
that pixel data was sent to the cache every end of a frame. Then, byte
slices for pixels were corrupted.
This change fixes the issue by resolving all the images when flushing
commands.
Closes #2390
2022-10-16 15:19:25 +09:00
Hajime Hoshi
aa81a6cc7d
internal/processtest/testdata: add a test file
...
Updates #2362
2022-10-16 15:17:09 +09:00
Hajime Hoshi
09a7d39874
internal/graphicsdriver: add Blend struct
...
This is a preparation to specify blend factors and blend operators.
Updates #2382
2022-10-16 01:08:26 +09:00
Hajime Hoshi
2f146d5e4f
internal/graphicsdriver/opengl: bug fix: build failure for browsers
2022-10-15 23:29:22 +09:00
Hajime Hoshi
257f05883c
internal/graphicsdriver/opengl: enable to compiile for browsers with the 'opengles' tag
...
The 'opengles' tag is just ignored for browsers.
2022-10-15 22:22:28 +09:00
Hajime Hoshi
37c5f53890
internal/graphicsdriver/opengl: refactoring
2022-10-15 22:14:21 +09:00
Hajime Hoshi
1d9f1474e9
internal/graphicsdriver: rename constants
2022-10-15 21:14:59 +09:00
Hajime Hoshi
272d0c6a3f
internal/graphicsdriver: rename Operator -> BlendFactor
...
Updates #2382
2022-10-15 17:34:03 +09:00
Hajime Hoshi
e42ee8c506
internal/graphicscommand: bug fix: call End even if an error causes
...
Without calling End, the graphics driver (especially Metal) state
might be stale and might cause another error.
Closes #2388
2022-10-15 15:23:04 +09:00
Hajime Hoshi
35e9f26681
internal/graphicsdriver/directx: refactoring
2022-10-15 12:16:41 +09:00
Hajime Hoshi
e796646abd
internal/graphicscommand: rename arguments
2022-10-15 03:36:25 +09:00
Hajime Hoshi
bf6a5415cf
internal/graphicscommand: bug fix: test failures on Windows
2022-10-15 02:56:40 +09:00
Hajime Hoshi
32a2a705c0
internal/ui: flush the cache of the final screen after DrawScreen
...
The screen image might have a cache in the future.
Updates #2385
2022-10-15 01:59:53 +09:00
Hajime Hoshi
daf349ab72
internal/graphicscommand: bug fix: present at the end of the frame explicitly
...
Before this change, presenting happened when the rendering destination
was the final screen. Now this assumption is wrong as the final screen
might be used in the middle of the commands due to DrawFinalScreen.
Instead, this change adds a new argument `present` to FlushCommands to
present the screen explicitly at the end of the frame.
Closes #2386
2022-10-15 01:54:46 +09:00
Hajime Hoshi
f15536e8de
ebiten: refactoring: remove imageDumperGame
...
This enables passing the user's Game to internal/ui without wrapping.
This is necessary to check whether the user's Game implements an
optional function or not.
Updates #2046
2022-10-14 02:58:31 +09:00
Hajime Hoshi
25ae96db89
internal/ui: move screenScaleAndOffsets to the ebiten package
...
Updates #2046
2022-10-14 01:58:07 +09:00
Hajime Hoshi
03621e22c6
internal/ui: remove unnecessary mutex
...
Now (*context).updateFrame and (*context).adjustPosition are not called
in parallel even though the goroutines might be different.
2022-10-14 01:47:52 +09:00
Hajime Hoshi
4bd3a9ef8f
internal/ui: refactoring: move the screen rendering logic to ebiten package
...
Updates #2046
2022-10-14 00:34:40 +09:00
Hajime Hoshi
08e6f5af86
internal/graphicsdriver: remove FramebufferYDirection
2022-10-14 00:05:59 +09:00
Hajime Hoshi
c23af8fa3a
internal/ui: remove unnecessary comments
2022-10-13 12:28:32 +09:00
Hajime Hoshi
30088cf602
internal/ui: refactoring: reduce uniform variable
...
This might degrade performance, but can demonstrate how to get the
scale of the screen.
Updates #2046
2022-10-13 00:59:51 +09:00
Hajime Hoshi
91275e8fc2
internal/ui: add comments
...
Updates #1431
2022-10-12 02:46:08 +09:00
Hajime Hoshi
99e777b0c5
internal/atlas: do not adjust pixels for DrawTriangles(Shader)
...
Adjusting pixels is needed to avoid strainge rendering to avoid unexpected
rendering (#1171 ). However, this adjustment caused unexpected holes
especially in a thick stroke.
This change moves the logic of adjusting pixels from atlas to
graphics.QuadVertices so that adjusting works only for DrawImage and
DrawRectShader.
Updates #1171
Updates #1843
2022-10-11 02:09:20 +09:00
Hajime Hoshi
a310b7c5bb
internal/builtinshader: fix comments
2022-10-10 13:14:37 +09:00
Hajime Hoshi
cb79e4eabe
internal/restorable: improve pixelsForRestore usages
...
Updates #2375
2022-10-06 15:54:54 +09:00
Hajime Hoshi
c6b37e9809
internal/restorable: use pixelsForRestore only when restoring is needed
...
Updates #2375
2022-10-06 15:09:21 +09:00
Hajime Hoshi
34562c3337
internal/restorable: clear pixelsForRestore at Dispose
...
Updates #2375
2022-10-06 15:04:12 +09:00
Hajime Hoshi
e66bac5c3f
internal/restorable: reuse byte slices for restoring
...
Updates #2375
2022-10-06 14:52:20 +09:00
Hajime Hoshi
85d8a5889a
Revert "internal/restorable: reuse bytes instead of allocations"
...
This reverts commit 8cf3c31cf6
.
Reason: This didn't improve the situation.
Updates #2375
2022-10-06 14:11:09 +09:00
Hajime Hoshi
8cf3c31cf6
internal/restorable: reuse bytes instead of allocations
...
Updates #2375
2022-10-06 12:41:47 +09:00
Hajime Hoshi
69cdd2b178
internal/graphicsdriver/metal: refactoring
2022-10-04 00:29:18 +09:00
Hajime Hoshi
b489548963
internal/builtinshader: fix comments
2022-10-03 01:09:28 +09:00
Hajime Hoshi
61cabbf2e7
internal/atlas: optimization
2022-10-03 00:06:50 +09:00
Hajime Hoshi
72983d966b
all: remove unused conditions
...
Now Kage shaders are always used.
The situtation is different from when we fixed for #1355 , so we removed
the fast path for #1335 . We have to re-check the current performance.
Updates #1355
2022-10-02 23:50:48 +09:00
Hajime Hoshi
534d82c17d
internal/builtinshader: move Filter and Address from internal/graphicsdriver
2022-10-02 23:24:15 +09:00
Hajime Hoshi
9c07b20f2b
internal/ui: remove an odd cast
2022-10-02 23:20:16 +09:00
Hajime Hoshi
efd91c8b86
internal/ui: remove unused arguments from DrawTriangles
...
Closes #2369
2022-10-02 23:10:27 +09:00
Hajime Hoshi
d823e22bed
internal/mipmap: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 23:06:32 +09:00
Hajime Hoshi
361a1059ee
internal/buffered: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 23:06:29 +09:00
Hajime Hoshi
3da30b3b78
internal/atlas: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 23:06:27 +09:00
Hajime Hoshi
de8f85651d
internal/restorable: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 22:51:34 +09:00
Hajime Hoshi
0ae2b1bc24
all: remove unnecessary conditions
...
Now a Kage shader is always used.
2022-10-02 22:30:59 +09:00
Hajime Hoshi
6fca8edc1b
internal/graphicscommand: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 22:21:11 +09:00
Hajime Hoshi
080d936d42
internal/graphics: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 22:13:31 +09:00
Hajime Hoshi
6fc9d9316d
internal/graphicscommand: remove unnecessary conditions
...
Now a Kage shader is always used.
2022-10-02 22:11:20 +09:00
Hajime Hoshi
a9574627e8
internal/graphicsdriver/directx: remove the built-in shaders
...
Updates #2369
2022-10-02 21:35:23 +09:00
Hajime Hoshi
033997d928
internal/graphicsdriver/opengl: remove the built-in shaders
...
Updates #2369
2022-10-02 21:26:13 +09:00
Hajime Hoshi
5f7db485f2
internal/graphicsdriver/metal: remove the built-in shaders
...
Updates #2369
2022-10-02 20:34:38 +09:00
Hajime Hoshi
0b45ca7057
ebiten: reduce duplicated shader compilations
2022-10-02 20:33:50 +09:00
Hajime Hoshi
ff72898b85
internal/builtinshader: use a struct instead of a map
...
With a map, we might miss typos.
2022-10-02 20:17:47 +09:00
Hajime Hoshi
311aa7dcf8
all: use Kage shaders in internal packages
...
Updates #2369
2022-10-02 19:17:09 +09:00
Hajime Hoshi
f293a03ab6
internal/mipmap: reland: do not consider filter to determine mipmap level
...
This is a reland of 42833614fb
.
Now the filter argument is not used (a4e9a05b14
),
the filter value can be the nearest filter even though the shader is
for the linear filter.
As long as `canSkipMipmap` is set correctly, we don't have to consider
the parameter `filter`. We should ignore it.
Updates #2364
2022-10-02 19:14:23 +09:00
Hajime Hoshi
bcb9844395
Revert "internal/mipmap: bug fix: do not consider filter to determine mipmap level"
...
This reverts commit 42833614fb
.
Reason: test failure: TestImageEdge
2022-10-02 18:53:28 +09:00
Hajime Hoshi
42833614fb
internal/mipmap: bug fix: do not consider filter to determine mipmap level
...
Now the filter argument is not used (a4e9a05b14
),
the filter value can be the nearest filter even though the shader is
for the linear filter.
As long as `canSkipMipmap` is set correctly, we don't have to consider
the parameter `filter`. We should ignore it.
Updates #2364
2022-10-02 18:44:06 +09:00
Hajime Hoshi
4b2a9c3243
internal/testing: add the default exit code 1
...
This confirms that Update is really called.
2022-10-02 18:16:16 +09:00
Hajime Hoshi
3bb21282af
internal/builtinshader: bug fix: typo
...
Updates #2364
2022-10-02 16:16:49 +09:00
Hajime Hoshi
eea11ba6cb
internal/ui: use a Kage shader for Fill
...
Updates #2364
2022-10-02 16:08:33 +09:00
Hajime Hoshi
7b6f726729
internal/ui: skip uniform variables when possible
...
Updates #2364
2022-10-02 16:02:44 +09:00
Hajime Hoshi
239f9de2ca
internal/ui: use Kage shaders
...
Updates #2364
2022-10-02 15:54:48 +09:00
Hajime Hoshi
a4e9a05b14
ebiten: reland: use Kage shaders instead of built-in shaders for a color matrix
...
This replaces the built-in shaders with Kage shadres. This is a
refactoring and doesn't degrade performance:
```
go test -bench=^BenchmarkColorMScale$ -run=^$ . -count=5
```
```
name old time/op new time/op delta
ColorMScale-8 978ns ±15% 1184ns ±46% ~ (p=0.413 n=4+5)
```
A follow-up change to remove the built-in shaders is needed.
Closes #2364
2022-10-02 15:35:40 +09:00
Hajime Hoshi
5e459bbe42
internal/graphicsdriver/opengl, metal, directx: use premultiplied alpha format for color scales
...
Updates #2365
2022-10-02 13:38:21 +09:00
Hajime Hoshi
8a7d860632
all: unify Windows error handlings for Windows HANDLE
...
Updates #2366
2022-10-02 02:22:06 +09:00
Hajime Hoshi
a9ba0db3d1
internal/glfwwin, internal/graphicsdriver/directx: bug fix: wrong error handlings for Windows HANDLE
...
Closes #2366
2022-10-02 01:57:24 +09:00
Hajime Hoshi
eb3c45c8af
Revert "internal/graphicsdriver/opengl, metal, directx: skip multiplying a scale when a color matrix is used"
...
This reverts commit b457dc3307
.
Reason: a color scale might be used with ColorM (DrawTriangles)
2022-10-02 00:19:41 +09:00
Hajime Hoshi
520c47f0e8
Revert "ebiten: use Kage shaders instead of built-in shaders for a color matrix"
...
This reverts commit 7fc79c50c3
.
Reason: a color scale might be used with ColorM (DrawTriangles)
Updates #2364
2022-10-02 00:19:37 +09:00
Hajime Hoshi
7fc79c50c3
ebiten: use Kage shaders instead of built-in shaders for a color matrix
...
Closes #2364
2022-10-02 00:08:14 +09:00
Hajime Hoshi
b457dc3307
internal/graphicsdriver/opengl, metal, directx: skip multiplying a scale when a color matrix is used
2022-10-01 18:14:22 +09:00
Hajime Hoshi
4203a3b68a
internal/graphicsdriver/opengl, metal, directx: add comments
...
Updates #1212
2022-10-01 15:21:02 +09:00
Hajime Hoshi
a10f3d1dad
internal/graphicsdriver/opengl, metal, directx: refactoring: clean up the built-in shaders
2022-10-01 14:35:26 +09:00
Hajime Hoshi
cff64894cc
internal/affine: refactoring: use slices instead of array pointers
...
This doesn't change the performance at the test using ColorM:
```
name old time/op new time/op delta
ColorMScale-8 1.11µs ±43% 1.23µs ±70% ~ (p=1.000 n=5+5)
```
2022-09-30 22:20:32 +09:00
Hajime Hoshi
d00bd1cb16
internal/ui: refactoring: move setVerticesCache
to ui.Image
...
Updates #2362
2022-09-29 01:21:46 +09:00
Hajime Hoshi
9492b4ecf5
internal/mipmap: refactoring
...
This change replaces the member `volatile` with `imageType` to make
the code more explicit.
In the old code, it was not obvious whether a mipmap was used for a
screen image. Actually a mipmap was not used since `canSkipMipmap` is
always true for a screen image, but this was too tricky.
2022-09-28 03:07:40 +09:00
Hajime Hoshi
6b35ad4a88
internal/mipmap: bug fix: mipmap images were unexpectedly volatile
...
Closes #2354
2022-09-28 01:40:38 +09:00
Hajime Hoshi
3a0f28ce6b
internal/ui: refactoring: reduce global-variable usages
2022-09-26 00:46:03 +09:00
Hajime Hoshi
fa108ca717
internal/ui: bug fix: compiie errors on mobiles and browsers
2022-09-26 00:34:44 +09:00
Hajime Hoshi
4a82a109be
internal/ui: use sync/atomic for performance
2022-09-26 00:27:04 +09:00
Hajime Hoshi
909f2fe492
internal/ui: bug fix: make inFrame concurrent-safe
...
Updates #1816
2022-09-25 23:56:14 +09:00
Hajime Hoshi
12f42544dd
internal/ui: refactoring: simplify logic by removing setSizeCallbackEnabled
...
Closes #1816
2022-09-25 23:48:40 +09:00
Hajime Hoshi
70ebd34d99
internal/ui: refactoring: separate setWindowSizeInDIPImpl to setWindowSizeInDIP and setFullscreen
2022-09-25 22:55:56 +09:00
Hajime Hoshi
f0dbf86799
internal/ui: refactoring: adjust the width earlier
2022-09-25 22:34:14 +09:00
Hajime Hoshi
c7deed6e72
internal/ui: add setFullscreen
2022-09-25 22:31:26 +09:00
Hajime Hoshi
e47f9ac38f
internal/ui: bug fix: wrong bit operations
...
Closes #2349
2022-09-25 20:10:37 +09:00
Hajime Hoshi
9302230fef
internal/ui: refactoring
2022-09-25 19:56:53 +09:00
Hajime Hoshi
98076bd512
internal/ui: refactoring: simplify initializing fullscreen
2022-09-25 18:28:57 +09:00
Hajime Hoshi
6167cc4f54
internal/ui: remove unnecessary function calls
...
updateSize was introduced at 7eff5cbd4a
, but
apparently calling setWindowSizeInDIP was originally not needed.
2022-09-25 18:19:35 +09:00
Hajime Hoshi
25405783a7
internal/ui: refactoring
...
Updates #1816
2022-09-25 02:05:26 +09:00
Hajime Hoshi
b2f3d39acf
internal/restorable: add color tests at TestAllowWritePixelsForPartAfterDrawTriangles
...
Updates #2346
2022-09-24 22:09:08 +09:00
Hajime Hoshi
1703297f37
internal/shader: add a test for type shadowing
2022-09-24 19:00:23 +09:00
Hajime Hoshi
7f91a681e3
internal/shader: check type redeclaration
2022-09-24 18:56:01 +09:00
Hajime Hoshi
c5867c3357
internal/ui: bug fix: avoid 0 as arguments for Layout
...
Updates #2340
2022-09-20 22:50:39 +09:00
Hajime Hoshi
b5ddee3e4a
internal/ui: bug fix: reentering updateImpl caused double unlocking
...
updateImpl can be invoked in multiple ways. This should have been
protected by a mutex, or this caused unexpected reentrance.
Closes #2339
2022-09-20 13:19:43 +09:00
divVerent
47de8027b9
internal/gamepaddb: fix mapping support for e.g. dpleft:-a0
. ( #2335 )
...
SDL interprets this as "map -1 to 1, map 0 to -1", so we should do the same.
This fix contains two parts:
* Fix the intended output range.
* Also fix the formula to map a range to a range.
The fix does not change behavior if a "-a" mapping isn't used, as in any other case max-min == 1 or max+min == 0.
Fixes #2334
2022-09-20 00:34:46 +09:00
Hajime Hoshi
c7fcfe5bf7
internal/graphicsdriver/directx: refactoring
...
This makes more explicit that the pixels are sent after the slice
for the pixels finishes modification.
2022-09-19 00:31:44 +09:00
Hajime Hoshi
cfdf59ef8d
internal/graphicsdriver/directx: revert changes to remove GetCopyableFootprints
...
This reverts these commits
* ccddd4ee20
* 8e40c2ce7e
* 2eb1efe3cc
Without GetCopyableFootprints, the test results on 32bit Windows seemed
much more flaky. This didn't fix the memory issue like #2294 anyway.
2022-09-19 00:26:59 +09:00
Hajime Hoshi
ccddd4ee20
internal/graphicsdriver/directx: refactoring: make the lifetime of uploadingStagingBuffer more explicit
2022-09-19 00:16:53 +09:00
Hajime Hoshi
8e40c2ce7e
internal/graphicsdriver/directx: refactoring
2022-09-19 00:06:43 +09:00
Hajime Hoshi
2eb1efe3cc
internal/graphicsdriver/directx: stop using GetCopyableFootprints
...
GetCopyableFootprints seems very conservative and returns a quite
big memory size. Instead of using the info from GetCopyableFootprints
let's use our own minimum footprint.
2022-09-18 23:10:15 +09:00
Hajime Hoshi
cd9477491d
internal/gamepad: refactoring
2022-09-18 20:09:10 +09:00
Hajime Hoshi
78802f18d9
internal/glfwwin: remove GetProcAddress
2022-09-18 18:04:02 +09:00
Hajime Hoshi
129f201be4
internal/gamepaddb: use go:embed
...
Updates #1258
2022-09-17 21:02:07 +09:00
TotallyGamerJet
043397c20e
internal/ui: remove Cgo on darwin in ui_glfw_darwin.go ( #2329 )
...
Updates #1162
2022-09-16 11:53:46 +09:00
Hajime Hoshi
45b2bd7b2b
internal/graphicsdriver/metal/mtl: remove a TODO comment
2022-09-16 11:48:59 +09:00
Hajime Hoshi
53df5aaaf0
internal/cocoa: rename _cmd
to cmd
2022-09-16 02:32:12 +09:00
Hajime Hoshi
963eb2756a
all: fix TODO comments
2022-09-16 02:02:02 +09:00
Hajime Hoshi
b13fa2817c
internal/gamepad: clean up codes for Darwin
...
* Removes redundant assignments.
* Fixes types for the Apple libraries.
Updates #1162
2022-09-16 00:25:51 +09:00
TotallyGamerJet
4a569be6f6
internal/gamepad: remove Cgo on darwin ( #2330 )
...
Updates #1162
2022-09-16 00:11:59 +09:00
Hajime Hoshi
5404e4d68a
all: replace io/ioutil
with io
and os
...
Closes #1770
2022-09-15 02:54:25 +09:00
Hajime Hoshi
d0556af8a4
internal/atlas: refactoring
2022-09-15 01:52:05 +09:00
Hajime Hoshi
31945563d8
internal/atlas: optimize adjustDestinationPixel
...
```
go test -bench=BenchmarkAdjustPixel -run=^$ -count=5 ./internal/atlas/
```
```
name old time/op new time/op delta
AdjustPixel-8 2.59ns ± 1% 2.12ns ± 1% -18.16% (p=0.008 n=5+5)
```
2022-09-15 01:50:47 +09:00
Hajime Hoshi
9319266c01
internal/atlas: add a benchmark for adjustDestinationPixel
2022-09-15 01:25:26 +09:00
Hajime Hoshi
2cbc5e7b60
internal/cocoa: remove IsIOS
...
Use `runtime.GOOS == "ios"` instead.
Closes #1415
2022-09-15 01:04:37 +09:00
Hajime Hoshi
619a2ee4dd
internal/gamepaddb: use runtime.GOOS instead of a build tag
...
Updates #1415
2022-09-15 00:27:11 +09:00
Hajime Hoshi
655cd4bf68
all: remove the build tag
...
Updates #1415
2022-09-15 00:23:40 +09:00
Hajime Hoshi
95bfa95a91
internal/graphicscommand: refactoring
2022-09-14 23:13:08 +09:00
Hajime Hoshi
86706c0335
internal/graphicsdriver/opengl: add opengles
build tag
...
This enables to use OpenGL ES instead of OpenGL.
Closes #292
2022-09-13 11:10:48 -07:00
Hajime Hoshi
18fa00d25d
internal/restorable: update comments
2022-09-14 02:20:11 +09:00
Hajime Hoshi
6179158812
internal/restorable: bug fix: no pixels were read only with DrawTriangles
...
Closes #2324
2022-09-14 02:17:14 +09:00
Hajime Hoshi
b36c21648f
internal/restorable: refactoring: remove a redundant FlushCommands call
...
readPixelsFromGPU already flushes commands.
2022-09-13 08:43:02 -07:00
Hajime Hoshi
6b906bb813
internal/restorable: extend the staleRegion when the image is already stale on WritePixels
...
This is a kind of refactoring. There seems no case that this condition
change is really needed, but this is more logical.
2022-09-13 07:29:53 -07:00
Hajime Hoshi
67ceaf5874
internal/atlas: rename replacePixels -> writePixels
2022-09-13 06:39:29 -07:00
Hajime Hoshi
243c224003
internal/restorable: bug fix: wrong panic on mixing DrawTriangles and WritePixels
...
When DrawTriangles is called and then WritePixels is called on a
sub-image, a panic happened. However, this panic actually happens
only when the graphics driver requires restoring (e.g. OpenGL ES
on Android). The situation was very limited, but this was a real
problem on Android.
This panic was introduced to prevent a rendering bug by a inmature
graphics drivers, but we should no longer need this. This change
just removes the panic.
Updates #292
2022-09-13 06:18:55 -07:00
Hajime Hoshi
40362aa62d
internal/restorable: bug fix: readPixelsFromGPU might be called for a non-stale image
...
Actually readPixelsFromGPUIfNeeded can invoke this.
Closes #2322
2022-09-13 15:34:43 +09:00
Hajime Hoshi
4824cbc755
internal/graphicscommand: bug fix: IsInvalidated was not concurrent-safe
...
This function was not called actually, so this is not a real problem.
However, this could be a potential problem for a future GLES driver (#292 ).
Updates #292
Closes #2321
2022-09-13 12:23:19 +09:00
Hajime Hoshi
6ea455f4e1
internal/graphicsdriver/opengl/gles: remove cString
2022-09-13 00:17:33 +09:00
Hajime Hoshi
e46bfd8d30
internal/graphicsdriver: rename files
...
Updates #292
2022-09-12 23:03:54 +09:00
Hajime Hoshi
7d6ee39c15
internal/gamepad: bug fix: a wireless Xbox controller didn't work correctly on macOS
...
The button and hat values must be adjusted by their minimum values.
See also GLFW's implementation.
Closes #266
2022-09-12 01:55:05 +09:00
Hajime Hoshi
89598df520
internal/gamepad: refactoring
...
Updates #2311
2022-09-11 22:44:06 +09:00
Hajime Hoshi
4629306f4b
internal/gamepad: bug fix: wrong SDL ID on iOS
...
The gamepad database already worked well with this fix.
Closes #2311
2022-09-11 22:29:38 +09:00
Hajime Hoshi
14a3a0f6bc
internal/graphicsdriver/opengl/gl: better error message
2022-09-10 14:21:59 +09:00
Hajime Hoshi
fe11facbb8
internal/graphicsdriver/opengl/gl: better error message
2022-09-10 14:14:42 +09:00
Hajime Hoshi
d8eaf0a394
internal/graphicsdriver/opengl/gl: reland: integrate files for ebitengine/purego
...
Closes #2313
2022-09-10 13:37:20 +09:00
Hajime Hoshi
45a9cdda30
Revert "internal/graphicsdriver/opengl/gl: integrate files for ebitengine/purego"
...
This reverts commit be8edb984f
.
Reason: Test failures. See #2313
Updates #2313
2022-09-10 03:45:14 +09:00
Hajime Hoshi
be8edb984f
internal/graphicsdriver/opengl/gl: integrate files for ebitengine/purego
2022-09-10 03:31:16 +09:00
Hajime Hoshi
fccb43e15b
internal/graphicsdriver/directx: remove .errcheck_excludes_windows
...
These DirectX functions don't return any value and should not affect
the last error. Then it should be fine to ignore the returning values
from syscall.Syscall*.
Updates #2287
2022-09-10 03:03:18 +09:00
Hajime Hoshi
f2255b8fa6
internal/graphicsdriver/opengl/gl: remove .errcheck_excludes_windows
...
Updates #2287
2022-09-10 02:44:24 +09:00
Hajime Hoshi
b1fff313ac
internal/glfwwin: remove .errcheck_excludes_windows
...
The third returning value of Syscall is GetLastError, and the functions
like glGetIntegerv should not change the error state. Then it is safe
to ignore the errors.
Updates #2287
2022-09-10 02:18:37 +09:00
Hajime Hoshi
b5acb1e53d
internal/gamepad: remove .errcheck_excludes_windows
...
Updates #2287
2022-09-10 02:11:08 +09:00
Terra Brown
a1cc44833d
add errcheck static analysis ( #2293 )
...
Closes #2287
2022-09-10 01:52:46 +09:00
Hajime Hoshi
e505098e55
internal/ui: handle error at forceUpdateOnMinimumFPSMode
...
Updates #2287
2022-09-09 22:49:34 +09:00
Hajime Hoshi
4c76356803
internal/gamepad: refactoring
2022-09-09 22:31:47 +09:00
Hajime Hoshi
47558d20c5
internal/gamepaddb: enable the database for Android
...
Before this fix, the button and axis IDs are from the OS. These
didn't match with the SDL game controller databaes unfortunately.
This fix changes the assignments of the buttons and the axes to match
with the database.
Closes #2312
2022-09-09 22:20:39 +09:00
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