Hajime Hoshi
16ff5c5039
internal/shaderir: change the naming convention: Num -> Count
2022-07-13 02:02:48 +09:00
Hajime Hoshi
dce34d2306
internal/shader: change the naming convention: Num -> Count
2022-07-13 02:02:48 +09:00
Hajime Hoshi
afed6a83c6
internal/graphics: change the naming convention: Num -> Count
...
This change also renames ebiten.MaxIndicesNum -> ebiten.MaxIndicesCount.
2022-07-13 02:02:44 +09:00
Hajime Hoshi
2203c3c448
internal/ui: remove the keypress event and the charCode preperty usages
...
These APIs are deprecated.
Closes #2199
2022-07-12 23:36:58 +09:00
Hajime Hoshi
55adc2113e
internal/clock: Update -> UpdateFrame
2022-07-12 13:18:49 +09:00
Hajime Hoshi
e05df6a778
internal/ui: refactoring
2022-07-12 12:47:34 +09:00
Hajime Hoshi
d4e1787154
internal/clock: refactoring
2022-07-12 12:42:16 +09:00
Hajime Hoshi
c5e952d196
internal/ui: refactoring: reduce members from globalState
2022-07-12 12:35:07 +09:00
Hajime Hoshi
08e54ae1a6
internal/ui: rename the TPS functions
...
Updates #2071
2022-07-12 12:25:57 +09:00
Hajime Hoshi
b8367da7e2
internal/graphics: optimize imageSrcNUnsafeAt
2022-07-11 01:07:06 +09:00
Hajime Hoshi
b27b7ec483
internal/graphicsdriver/directx: use CreateEventEx to follow the official example
2022-07-10 22:44:40 +09:00
Hajime Hoshi
4c121ae5eb
internal/graphicsdriver/directx: bug fix: a wrong fence value was passed to SetEventOnCompletion
2022-07-10 22:24:39 +09:00
Hajime Hoshi
a22125a075
internal/graphicsdriver/directx: bug fix: ResizeBuffers failed without the flag
...
Closes #2193
2022-07-10 19:55:28 +09:00
Hajime Hoshi
4afabe34ae
internal/shader: optimization: remove unnecessary local variables
...
Updates #2034
Updates #2188
2022-07-10 19:01:58 +09:00
Hajime Hoshi
b6a340a96f
internal/shader: optimization: use a regular return for a function with one output parameter
...
Updates #2034
Updates #2188
2022-07-10 18:18:46 +09:00
Hajime Hoshi
8c879c7bcf
internal/shader: refactoring
2022-07-10 16:02:50 +09:00
Hajime Hoshi
bf0f3d304b
internal/graphicsdriver/directx: add optimization flag to D3DCompile
...
Updates #2034
Updates #2188
2022-07-10 02:55:16 +09:00
Hajime Hoshi
0035ba0bd1
internal/graphicsdriver/directx: allow tearing when vsync is off
...
Updates #2034
Updates #2188
2022-07-10 01:17:36 +09:00
Hajime Hoshi
a32a137fa8
internal/graphicsdriver/directx: skip unnecessary flushing commands
...
Updates #2034
Updates #2188
2022-07-10 00:24:14 +09:00
Hajime Hoshi
b2a1b9a9a2
internal/shader: bug fix: float constant didn't work with assign operators
2022-07-09 22:29:42 +09:00
Hajime Hoshi
55c7a2df6c
internal/graphicsdriver/opengl/gl: bug fix: wrong build tags
2022-07-09 16:15:56 +09:00
Hajime Hoshi
28fd3ec9e5
add the ebitengine version build tags besides the ebiten version
...
Closes #2111
Updates #2190
2022-07-09 15:38:03 +09:00
Hajime Hoshi
428b1263d9
add ebitenginecbackend build tag besides ebitencbackend
...
Updates #2111
Updates #2190
2022-07-09 15:23:52 +09:00
Hajime Hoshi
204fb5935b
add new environment variables with the EBITENGINE_ suffix
...
Updates #2111
Updates #2190
2022-07-09 15:00:28 +09:00
Hajime Hoshi
a5179b9491
internal/shaderir/glsl: bug fix: test failures with OpenGL
...
Updates #2186
2022-07-09 02:43:48 +09:00
Hajime Hoshi
c01821ca5c
internal/shader: use all functions for vector comparisons
...
Updates #2186
2022-07-09 02:30:16 +09:00
Hajime Hoshi
3d5031571d
internal/graphicsdriver/directx: add the original source at D3DCompile errors
2022-07-09 01:59:51 +09:00
Hajime Hoshi
6dcd2ff11c
internal/shader: bug fix: wrong assignment rule for booleans
2022-07-08 02:19:42 +09:00
Hajime Hoshi
87be157b23
internal/shader: refactoring
2022-07-08 01:09:42 +09:00
Hajime Hoshi
a3590cb258
internal/shader: add type checks to bool/int/flaot
...
Updates #2184
2022-07-08 00:22:55 +09:00
Hajime Hoshi
faa2ad5c6f
internal/shader: add type checks for mat2/mat3/mat4
...
Updates #2184
2022-07-07 23:05:26 +09:00
Hajime Hoshi
f89277fd85
internal/shader: add type checks to vec2/vec3/vec4
...
Updates #2184
2022-07-07 00:20:02 +09:00
Hajime Hoshi
a866fe7391
internal/graphicscommand: improve debug command messages for shaders
2022-07-06 19:29:19 +09:00
Hajime Hoshi
8522bfd0bf
internal/graphicscommand: bug fix: replacePixelsCommand should not read pixels
...
Reading pixels, writing pixels, and using the image as a source might
cause a flaky behavior with Metal. Stop reading pixels if possible.
Closes #2180
2022-07-05 23:30:26 +09:00
Hajime Hoshi
dd805c9414
internal/atlas: remove a wrong comment
...
(*restrable.Image).ReplacePixels can take overlapped regions.
See TestOverlappedPixels.
Updates #2180
2022-07-05 13:59:23 +09:00
Hajime Hoshi
08ebab0558
internal/ui: better fix for initialMonitorByOS
...
Updates #2179
2022-07-04 14:42:21 +09:00
Hajime Hoshi
47c65a92ae
internal/graphicsdriver/directx: bug fix: ignore DXGI_STATUS_OCCLUDED
...
When a screen is locked, an Ebitengine application crashed as the
swap chain's Present returned DXGI_STATUS_OCCLUDED.
Let's ignore the error and continue to run the applications. In the
ideal world, an application should stop running during the screen lock,
so let's revisit this later.
This fix also fixes the issue that a Win32API GetCursorPos returned
an error ERROR_ACCESS_DENIED when the screen was locked.
Closes #2179
2022-07-04 12:55:36 +09:00
Hajime Hoshi
fb23e4b578
internal/processtest/testdata: fix col and row
...
Updates #2154
2022-07-04 12:07:39 +09:00
Hajime Hoshi
5411e8136b
ebiten: bug fix: use DrawTriangles as an implementation of Set
...
Closes #2154
2022-07-04 12:02:47 +09:00
Hajime Hoshi
7d725f3e58
Revert "internal/graphicscommand: bug fix: using an image just after ReplacePixels might fail on Metal"
...
This reverts commit c31cc4ecff
.
Reason: This didn't fix the issue.
Updates #2154
2022-07-04 11:50:06 +09:00
Hajime Hoshi
c31cc4ecff
internal/graphicscommand: bug fix: using an image just after ReplacePixels might fail on Metal
...
Inserting a dummy rendering command after ReplacePixels and before
DrawTriangles solved the issue. This is a very dirty hack, but
there seems no other better way.
Closes #2154
2022-07-03 15:59:18 +09:00
Hajime Hoshi
afe1a93648
internal/graphicscommand, internal/graphicsdriver/metal: remove unused code
2022-07-03 15:23:52 +09:00
Hajime Hoshi
12533c2cce
Revert "internal/graphicsdriver/metal: bug fix: need to commit replace-pixels commands at DrawTriangles"
...
This reverts commit ac802cf0d0
.
Reason: This caused flickerings, and didn't solve #2154
Updates #2154
Closes #2174
2022-07-03 12:17:58 +09:00
Hajime Hoshi
ac5c48f575
internal/gamepad: support Xbox
...
Updates #2084
2022-07-02 01:02:24 +09:00
Hajime Hoshi
a6f6fdbfb7
internal/gamepad: update for Xbox
...
Updates #2084
2022-07-01 20:43:49 +09:00
Hajime Hoshi
97039ff714
internal/gamepad: implement gamepad detection callbacks for Xbox
...
Updates #2084
2022-07-01 17:15:11 +09:00
Hajime Hoshi
298d6488cc
internal/affine: add test
...
Updates #2170
2022-07-01 01:46:37 +09:00
Hajime Hoshi
8cdfa4f66c
internal/affine: create a fast path for ChangeHSV
...
When hue = 0 and saturation = 1, this should be the same as scaling.
Closes #2170
2022-06-30 11:32:12 +09:00
Hajime Hoshi
a9c9e18ff4
internal/graphicscommand: better strings for ColorM
2022-06-30 11:13:02 +09:00
Hajime Hoshi
0eb2f76422
internal/buffered: refactoring
2022-06-25 01:42:40 +09:00
Hajime Hoshi
bf27f25e26
internal/gamepad: bug fix: build failures on FreeBSD
2022-06-25 01:36:13 +09:00
Hajime Hoshi
c490347cef
internal/buffer: bug fix: shader manipulations must be buffered
...
Closes #2162
2022-06-25 01:31:20 +09:00
Hajime Hoshi
2d23168aca
iinternal/gamepad: start implementation for Xbox
...
Updates #2084
2022-06-25 00:02:12 +09:00
Hajime Hoshi
3fb3997160
internal/gamepad: separate the Xbox part
...
Updates #2084
2022-06-24 22:49:37 +09:00
Hajime Hoshi
847c4f067a
internal/gamepad: make nativeGamepad(s) interfaces
...
This is a preparation to switch the gamepad implementation for Xbox.
Updates #2084
2022-06-24 21:52:48 +09:00
Hajime Hoshi
f1037d8bff
internal/ui: handle gamepad errors
2022-06-24 20:20:49 +09:00
Hajime Hoshi
0cd43bd081
internal/gamepad: stop embedding a member into a struct
...
This is a preparation to switch the gamepad implementation for Xbox.
Updates #2084
2022-06-24 19:01:50 +09:00
Hajime Hoshi
712940cb02
internal/graphicsdriver/directx: bug fix: leave mapped regions for constant buffers
...
Mapping for a constant buffer every frame might sometimes fails. We
are not sure the reason, but in the official examples, leaving mapped
regoins seems the way to go.
Updates #2084
Closes #2157
2022-06-23 17:09:46 +09:00
Hajime Hoshi
506d534370
internal/ui: fix window sizes for Xbox
...
Updates #2084
2022-06-23 14:50:41 +09:00
Hajime Hoshi
c93cecdc2b
internal/graphicsdriver/directx: accept S_FALSE at ScheduleFrameEventX
2022-06-22 02:13:32 +09:00
Hajime Hoshi
7b05e59000
internal/graphicsdriver/directx: bug fix: wrong GUID for IDXGIDevice
2022-06-22 01:59:22 +09:00
Hajime Hoshi
8311ff1e46
internal/graphicsdriver/directx: bug fix: wrong pointer usage
2022-06-22 01:49:23 +09:00
Hajime Hoshi
10af36ee9f
internal/jsutil: bug fix: unnecessary allocations of temporary ArrayBuffers
...
Closes #2156
2022-06-21 21:54:02 +09:00
Hajime Hoshi
7e92b79a00
internal/graphicsdriver/directx: implement swap chains for Xbox
...
Updates #2084
2022-06-21 12:21:00 +09:00
Hajime Hoshi
a641f9ede0
internal/graphicsdriver/directx: refactoring
2022-06-20 23:40:53 +09:00
Hajime Hoshi
969e87fb89
internal/graphicsdriver/directx: fix moveToNextFrame for Xbox
...
Updates #2084
2022-06-20 00:41:34 +09:00
Hajime Hoshi
f8e9dcf035
internal/graphicsdriver/directx: refactoring
2022-06-19 17:58:04 +09:00
Hajime Hoshi
08c8c8089a
internal/graphicsdriver/directx: bug fix: clear constant buffers at the end of DrawTriangles
...
Constant buffers should not be reset while a stencil buffer is used.
Closes #2138
2022-06-19 17:13:34 +09:00
Hajime Hoshi
ac802cf0d0
internal/graphicsdriver/metal: bug fix: need to commit replace-pixels commands at DrawTriangles
...
Closes #2154
2022-06-19 15:38:12 +09:00
Hajime Hoshi
667bf2ff9d
internal/graphicsdriver/directx: refactoring
2022-06-19 01:44:31 +09:00
Hajime Hoshi
2a5b64bf4d
internal/graphicsdriver/directx: suppress warnings for depth buffers
...
Updates #2138
2022-06-19 00:21:04 +09:00
Hajime Hoshi
81b3d7bfac
internal/graphicsdriver/directx: add an assertion
2022-06-18 22:33:07 +09:00
Hajime Hoshi
f7a108e693
internal/graphicsdriver/directx: refactoring
2022-06-18 21:53:41 +09:00
Hajime Hoshi
b71a4975dd
internal/graphicsdriver/directx: bug fix: wrong state transitions at screen images
...
This change fixes the following issues:
* There should be two resource states for presenting targets, so an image
for the screen must have two resource states, though it had only one
in the current implementation.
* At removeImage, the screen image was removed unexpectedly.
Updates #2081
Closes #2151
2022-06-18 19:01:59 +09:00
Hajime Hoshi
522660c1f9
internal/graphicsdriver/directx: fix fence usages
...
Updates #2034
Updates #2138
Updates #2149
2022-06-18 15:44:54 +09:00
Hajime Hoshi
e78d888b24
internal/graphicsdriver/directx: handle error at Signal
2022-06-18 02:53:12 +09:00
Hajime Hoshi
0c38d6faeb
internal/graphicsdriver/directx: add comment about frames
...
Updates #2034
2022-06-18 01:18:49 +09:00
Hajime Hoshi
a16ffef499
internal/graphicsdriver/directx: update frameIndex at present
...
This follows the official GDK samples.
2022-06-18 01:09:54 +09:00
Hajime Hoshi
07a558b38d
internal/graphicsdriver/metal: bug fix: the default driver must be initialized on the main thread
...
Closes #2147
2022-06-17 14:58:26 +09:00
Hajime Hoshi
b43312fe80
internal/graphicsdriver/directx: add comments
...
Updates #2142
2022-06-17 12:19:36 +09:00
Hajime Hoshi
2f84e77e74
internal/graphicsdriver/directx: fallback to OpenGL when initialization fails
...
Closes #2142
2022-06-17 12:12:44 +09:00
Hajime Hoshi
9962fc5ee5
internal/graphicsdriver/direct: replace Get -> NewGraphics
...
Updates #2142
2022-06-17 11:48:40 +09:00
Hajime Hoshi
138463e219
internal/ui: rename chooseGraphicsDriver -> newGraphicsDriver
2022-06-17 02:40:39 +09:00
Hajime Hoshi
7484df0c5e
internal/graphicsdriver/metal: replace Get with NewGraphics
...
This is a prepartion to return an error when a graphics driver, especially
DirectX, fails to initialize.
Updates #2142
2022-06-17 02:40:35 +09:00
Hajime Hoshi
a6d415ebf2
internal/graphicsdriver/opengl: replace Get with NewGraphics ( #2146 )
...
This is a prepartion to return an error when a graphics driver, especially
DirectX, fails to initialize.
Updates #2142
2022-06-17 02:02:29 +09:00
Hajime Hoshi
195b060911
internal/graphicsdriver/metal: refactoring: initialize the driver at Get
2022-06-16 23:52:55 +09:00
Hajime Hoshi
76d88b276a
internal/graphicsdriver/directx: call C++ side for ID3D12GraphicsCommandList functions
...
Updates #2084
2022-06-13 22:35:58 +09:00
Hajime Hoshi
4aebcd2a04
internal/graphicsdriver/directx: bug fix: consider empty slices as arguments
2022-06-13 17:51:02 +09:00
Hajime Hoshi
c08d79d2ce
internal/graphicsdriver/directx: keep runtime.KeepAlive for Xbox
2022-06-13 17:36:58 +09:00
Hajime Hoshi
4adf46c2b0
internal/graphicsdriver/directx: refactoring
2022-06-13 17:25:27 +09:00
Hajime Hoshi
348435f769
internal/graphicsdriver/directx: fix a constant value for Xbox
...
Updates #2084
2022-06-13 14:23:29 +09:00
Hajime Hoshi
44cfb92cee
internal/ui: bug fix: MaximizeWindow before Run caused an unexpected error on Windows
...
Closes #2137
2022-06-13 12:28:20 +09:00
Hajime Hoshi
aef5402831
internal/graphicsdriver/directx: remove unused function
2022-06-13 01:35:31 +09:00
Hajime Hoshi
bcb2fe8c93
internal/graphicsdriver/directx: enable D3D12SerializeRootSignature for Xbox
...
Updates #2084
2022-06-13 01:02:48 +09:00
Hajime Hoshi
253f2757d1
internal/atlas: add a test to modify pixels after ReplacePixels call
2022-06-11 23:44:29 +09:00
Hajime Hoshi
08b52698c6
internal/graphicsdriver/directx: call C++ side for some functions for Xbox
...
Updates #2084
2022-06-11 19:37:17 +09:00
Hajime Hoshi
4a19d645b7
internal/graphicsdriver/opengl: remove a comment
2022-06-11 15:36:10 +09:00
Hajime Hoshi
71a32d2036
internal/ui: pass the canvas element directly instead of an ID
2022-06-11 15:34:17 +09:00
Hajime Hoshi
95628ee5f7
internal/ui: add a unique ID to the canvas for browsers
2022-06-11 15:24:50 +09:00
Hajime Hoshi
d42bb7d699
internal/graphicsdriver/directx: add a comment for Xbox
...
Updates #2084
2022-06-11 14:20:21 +09:00
Hajime Hoshi
826afcb9cc
internal/graphicsdriver/directx: fix CopyTextureRegion for Xbox
...
Updates #2084
2022-06-10 22:51:04 +09:00
Hajime Hoshi
abef203a70
rename github.com/ebitne/purego -> github.com/ebitengine/purego
2022-06-10 21:59:01 +09:00
Hajime Hoshi
07aa906753
internal/graphicsdriver/directx: fix GetCPU/GPUDescriptorHandleForHeapStart for Xbox
...
Updates #2084
2022-06-10 21:35:20 +09:00
Hajime Hoshi
b9373c498b
internal/graphicsdriver/directx: fix CreateCommandList for Xbox
...
Updates #2084
2022-06-10 16:44:07 +09:00
Hajime Hoshi
37369a2f4b
internal/atlas: add TestMaxImageSizeJust
2022-06-10 14:30:18 +09:00
Hajime Hoshi
03567f74f9
internal/atlas: bug fix: respect injected maxSize for testings
2022-06-10 14:25:08 +09:00
Hajime Hoshi
7c458f519e
internal/atlas: remove unnecessary comments
2022-06-10 13:53:24 +09:00
Hajime Hoshi
6b814888b5
internal/atlas: always use DrawTriangles at putOnAtlas
...
DrawTriangles was introduced at #1508 , and apparently there is no
reason we should use ReplacePixels here. So, simplify the logic by
using only DrawTriangles.
2022-06-10 02:58:04 +09:00
Hajime Hoshi
bdae45be8f
internal/atlas: add assertions
2022-06-10 02:38:35 +09:00
Hajime Hoshi
116e131ccf
internal/atlas: rename ImageTypeIsolated -> ImageTypeUnmanaged
2022-06-10 02:11:08 +09:00
Hajime Hoshi
b40022b286
internal/atlas: stop using padding for ImageTypeVolatile and ImageTypeIsolated
...
Closes #2131
2022-06-10 00:54:48 +09:00
Hajime Hoshi
9e34103491
internal/atlas: refactoring: make paddingSize a method
...
Updates #2131
2022-06-10 00:23:25 +09:00
Hajime Hoshi
5290605b2d
internal/atlas: add comments
2022-06-08 11:18:08 +09:00
Hajime Hoshi
9ee56ac320
inetrnal/atlas: remove unnecessary (and risky) locks
2022-06-08 10:05:15 +09:00
Hajime Hoshi
3b6a080519
internal/atlas: bug fix: use the global lock for shaders
...
Closes #2129
2022-06-08 10:00:31 +09:00
Hajime Hoshi
83ac234142
internal/ui: bug fix: offscreen images were created too often unexpectedly
2022-06-08 09:26:22 +09:00
Hajime Hoshi
6b212d7642
internal/restorable: refactoring: add Image.needsRestoring
2022-06-08 02:24:10 +09:00
Hajime Hoshi
9f729cf5c3
internal/restorable: remove SetVolatile
2022-06-08 02:20:09 +09:00
Hajime Hoshi
81f91658ff
internal/atlas: refactoring: remove SetVolatile and SetIsolate
...
Pass an image type to NewImage instead.
2022-06-08 01:08:00 +09:00
Hajime Hoshi
b8e8d72377
internal/restorable: rename ImageTypeScreenFramebuffer -> ImageTypeScreen
2022-06-07 23:45:35 +09:00
Hajime Hoshi
d3e3df812a
internal/ui: recreate an offscreen image when isScreenClearedEveryFrame is toggled
...
This is a preparation to remove SetVolatile and SetIsolated in
the atlas package.
2022-06-07 23:16:42 +09:00
Hajime Hoshi
6398230f84
internal/graphicscommand: add 'screen' info to (*newImageCommand).String()
2022-06-06 11:13:04 +09:00
Hajime Hoshi
73c893e977
internal/restorable: refactoring: unify NewScreenFramebufferImage and NewImage
2022-06-06 09:33:50 +09:00
Hajime Hoshi
31fd736ca5
internal/graphicscommand: refactoring: unify NewScreenFrameBufferImage and NewImage
2022-06-06 09:21:11 +09:00
Hajime Hoshi
cb0cbb4efa
internal/restorable: refactoring: introduce ImageType
2022-06-06 09:13:55 +09:00
Hajime Hoshi
7f10744514
internal/atlas: add an assertion at putOnAtlas
2022-06-06 09:01:04 +09:00
Hajime Hoshi
9bf5f2188f
internal/atlas: add an assertion at SetIsolated
2022-06-06 08:25:43 +09:00
Hajime Hoshi
86a0a4154d
internal/atlas: rename SetIsolate -> SetIsolated
2022-06-06 07:17:45 +09:00
Hajime Hoshi
b9012fc6ed
internal/atlas: unify the term 'isolate' and 'independent' to 'isolate'
2022-06-06 00:28:23 +09:00
Hajime Hoshi
6ce8f77c53
gofmt
2022-06-06 00:28:19 +09:00
Hajime Hoshi
0256b0cfbf
internal/graphicsdriver/directx: bug fix: disable fullscreen by Alt+Enter
...
By default, DirectX 12 tries to make the window fullscreen by Alt+Enter.
This caused application crashes. Let's disable this feature.
Closes #2123
2022-06-05 16:16:09 +09:00
Hajime Hoshi
51fe48fb76
internal/gamepad: bug fix: wrong offset especially on 32bit Linux
...
Closes #2122
2022-06-05 12:48:47 +09:00
Hajime Hoshi
5cdd2f8bce
internal/affine: further optimization to avoid heap allocation
...
Updates #2119
2022-06-04 15:13:30 +09:00
Hajime Hoshi
d518e64e22
Revert "internal/graphicsdriver/directx: refactoring: add syscallN"
...
This reverts commit 55a490736a
.
Reason: This has a potential risk of stack overflow.
Closes #2120
2022-06-04 13:58:01 +09:00
Hajime Hoshi
ecaa25faba
internal/affine: avoid heap allocations by casting a variable to a concrete type
...
This is a dirty hack but seems efficient.
Closes #2119
2022-06-04 13:18:14 +09:00
Hajime Hoshi
f69c550992
internal/graphicsdriver/directx: bug fix: go:nosplit was required for syscallN
...
Updates #2116
Closes #2117
2022-06-04 01:11:22 +09:00
Hajime Hoshi
55a490736a
internal/graphicsdriver/directx: refactoring: add syscallN
...
syscall.SyscallN is available as of Go 1.18 so this change implemented
our original syscallN function.
syscallN also panics when a given function pointer is 0. This helps
debugging especially on Xbox.
Updates #2084
2022-06-03 21:56:34 +09:00
Hajime Hoshi
3e1b313221
internal/graphicsdriver/directx: bug fix: ID3D12Resource::Map sometimes retrying
...
Updates #2113
Closes #2116
2022-06-03 21:56:30 +09:00
Hajime Hoshi
8e4e3d67c4
internal/gamepad: refactoring
2022-06-03 19:00:21 +09:00
Hajime Hoshi
2eb4ef1a94
internal/gamepad: give a window from another package instead of GetActiveWindow
...
GetActiveWindow doesn't work on Xbox.
Updates #2084
2022-06-03 18:42:54 +09:00
Hajime Hoshi
1580e92dfc
internal/gamepad: refactoring
2022-06-03 18:06:54 +09:00
Hajime Hoshi
90d26305e7
internal/gamepad: unify the naming convention for Win32API with other packages
2022-06-03 16:59:44 +09:00
Hajime Hoshi
124f233de0
internal/gamepad: cast returning values to uint32
2022-06-03 16:52:49 +09:00
Hajime Hoshi
532b476c4e
Revert "internal/graphicsdriver/directx: pass nil for pReadRange at Map"
...
This reverts commit 3b13158cc0
.
Reason: Specifying nil for reading ranges is not efficient
2022-06-03 13:59:34 +09:00
Hajime Hoshi
c6c45aadfa
Revert "Revert "internal/glfwwin: ignore errors from DWM functions""
...
This reverts commit 991cec993c
.
Reason: Reverted a wrong commit
2022-06-03 13:59:16 +09:00
Hajime Hoshi
991cec993c
Revert "internal/glfwwin: ignore errors from DWM functions"
...
This reverts commit 9ad87c0153
.
Reason: Specifying nil for reading ranges is not efficient
2022-06-03 13:49:45 +09:00
Hajime Hoshi
3b13158cc0
internal/graphicsdriver/directx: pass nil for pReadRange at Map
...
Updates #2113
2022-06-03 13:45:08 +09:00
Hajime Hoshi
9ad87c0153
internal/glfwwin: ignore errors from DWM functions
...
DWM functions might not be implemented on Proton. In the original
GLFW implementation, the returning values are not checked.
Updates #2113
2022-06-03 01:36:31 +09:00
Hajime Hoshi
c29c423686
internal/glfwwin, internal/graphicsdriver/directx: bug fix: HRESULT and Errno are imcompatible
2022-06-03 00:41:04 +09:00
Hajime Hoshi
7d95dddb1a
internal/glfwwin: refactoring
2022-06-03 00:32:36 +09:00
Hajime Hoshi
666d50e83d
internal/glfwwin: use HRESULT for an error value instead of GetLastError
...
GetLastError might not be reliable for some APIs like DwmFlush.
Updates #2113
2022-06-02 23:02:09 +09:00
Hajime Hoshi
4a9caf8afb
internal/graphicsdriver/directx: ignore higher 32bit values for Errno
...
Updates #2113
2022-06-02 23:01:38 +09:00
Hajime Hoshi
fb03a1e351
internal/graphicsdriver/directx: bug fix: ID3D12Resource::Unmap does not return an value
...
Updates #2113
2022-06-02 12:52:58 +09:00
Hajime Hoshi
4a684c4195
treat Windows error values as uint32 instead of windows.Handle
...
The error value are defined as windows.Handle (64bit) in
golang.org/x/sys/windows, but an actual type should be HRESULT (32bit).
This causes an issue that a returning value from a Windows API was
recognized as a non-zero error value though the value was not an error,
when the value's lower 32-bits are all zero.
See also https://github.com/golang/go/issues/48736#issuecomment-1143993096
Updates #2113
2022-06-02 12:10:21 +09:00
Hajime Hoshi
b900f83a01
internal/graphicsdriver/directx: refactoring: remove an unused member Image.numRows
2022-06-02 01:53:27 +09:00
Hajime Hoshi
0dc6e4e64e
internal/graphicsdriver/directx: use ID3D12Resource instead of ID3D12Resource1
...
Updates #2114
2022-06-02 01:26:02 +09:00
Hajime Hoshi
432365ff92
internal/glfwwin: ignore the error at SetProcessDpiAwarenessContext
...
Updates #2113
2022-06-01 23:11:06 +09:00
Hajime Hoshi
285a5cbc69
internal/glfwwin: skip some functions for Xbox
...
Updates #2084
2022-06-01 12:08:03 +09:00
Hajime Hoshi
0adb0c3860
internal/ui: bug fix: compile error
2022-06-01 02:09:10 +09:00
Hajime Hoshi
9c15bda275
internal/ui: return a null Window on Xbox
...
Updates #2084
2022-06-01 01:26:31 +09:00
Hajime Hoshi
ff868ba39f
internal/ui: skip some functions for Xbox
...
Updates #2084
2022-06-01 00:58:36 +09:00
Hajime Hoshi
dcb5bb47c6
internal/glfw: unify the naming convension for Win32API
2022-06-01 00:48:22 +09:00
Hajime Hoshi
6fc71e97bb
internal/glfwwin: skip some functions for Xbox
...
Updates #2084
2022-06-01 00:35:43 +09:00
Hajime Hoshi
aa4a2b64e0
internal/glfwwin: bug fix: update _glfw.windows
2022-06-01 00:01:07 +09:00
Hajime Hoshi
c99b948df3
internal/graphicsdriver/directx: refactoring
...
Updates #2084
2022-05-30 03:17:15 +09:00
Hajime Hoshi
d4226659ee
internal/graphicsdriver/directx: initialize a device for Xbox
...
Updates #1162
2022-05-30 02:10:18 +09:00
Hajime Hoshi
59798d29f4
internal/graphicsdriver/directx: defer the initialization
2022-05-29 22:02:39 +09:00
Hajime Hoshi
b4491ab94d
internal/graphicsdriver/directx: unify the naming convention with glfwwin
2022-05-29 21:18:23 +09:00
Hajime Hoshi
0081fa7a47
internal/graphicsdriver/directx: add a comment
2022-05-29 20:05:37 +09:00
Hajime Hoshi
ad380a32f4
internal/glfwwin: split GDK part to a new package internal/microsoftgdk
...
Updates #1162
2022-05-29 19:25:26 +09:00
Hajime Hoshi
7f46938ff7
internal/glfwwin: return an error at initWGL on Xbox
...
Updates #1162
2022-05-29 17:37:06 +09:00
Hajime Hoshi
59e6d4578b
internal/glfw: skip some Win32APIs for Xbox
...
Updates #1162
2022-05-29 17:04:47 +09:00
Hajime Hoshi
ce147a7e38
internal/glfwwin: refactoring: remove Monitor.currentMode
2022-05-29 16:00:18 +09:00
Hajime Hoshi
2efbb819e0
internal/glfw: skip some Win32APIs for Xbox
...
Updates #1162
2022-05-29 15:54:37 +09:00
Hajime Hoshi
05d49c5a52
internal/glfwwin: create a pseudo monitor for Xbox
...
Updates #1162
2022-05-29 15:38:17 +09:00
Hajime Hoshi
f8163f93c0
internal/glfwwin: refactoring
2022-05-29 14:22:22 +09:00
Hajime Hoshi
ef7d10a36e
internal/glfwwin: add a build tag microsoftgdk
...
Updates #1162
2022-05-29 01:31:42 +09:00
Hajime Hoshi
5c63c4a4aa
internal/graphicsdriver/metal: support macOS 10.12 by removing packed types
...
From the Metal shading language specification [1] Table 2.2.3, attribute
variables in Ebitengine's vertices don't have to be packed. Then, we can
remove `packed` types.
[1] https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf
Closes #2107
2022-05-28 23:57:59 +09:00
Hajime Hoshi
ac922742bf
internal/glfw: use shorter copyright comments
2022-05-27 20:38:45 +09:00
Hajime Hoshi
f7d1a43e98
internal/glfwwin: remove GammaRamp
2022-05-27 20:19:12 +09:00
Hajime Hoshi
df0208ec79
internal/glfwwin: remove unused exported functions
2022-05-27 20:15:36 +09:00
Hajime Hoshi
3a6b707b29
internal/glfwwin: remove unused members (a monitor size)
2022-05-27 20:12:43 +09:00
Hajime Hoshi
d577cc5e7d
internal/graphicsdriver/opengl/gl: rename files
...
Updates #1162
2022-05-27 18:31:40 +09:00
TotallyGamerJet
726e88e520
internal/graphics/opengl/gl: remove CGO in openGL on macOS ( #2104 )
...
Updates #1162
2022-05-27 18:26:53 +09:00
Hajime Hoshi
f7172f41c8
internal/glfwwin: skip detecting monitors for Xbox
...
Updates #2084
2022-05-27 15:55:23 +09:00
Hajime Hoshi
c379873a1f
rename Ebiten -> Ebitengine
2022-05-25 22:48:19 +09:00
Hajime Hoshi
1202e66114
internal/gamepad: bug fix: out of range at hatState on Windows
...
Closes #2103
2022-05-25 11:44:46 +09:00
Hajime Hoshi
7030840efa
internal/graphicsdriver/opengl/gl: refactoring
2022-05-25 02:24:40 +09:00
Hajime Hoshi
604f14d2d4
internal/glfwwin: refactoring: reduce risky unsafe.Pointer usages
2022-05-25 02:21:30 +09:00
Hajime Hoshi
0d7062335e
internal/glfwwin: remove GetProp and SetProp
...
GetProp and SetProp forced a risky usage of pointers.
2022-05-25 02:11:00 +09:00
Hajime Hoshi
ec2df98c70
internal/glfwwin: skip functions for Xbox
...
Updates #2084
2022-05-25 02:00:59 +09:00
Hajime Hoshi
847357c3ea
internal/glfwwin: remove an unused function GetKeyName
...
MapVirtualKeyW is not available on Xbox.
Updates #2084
2022-05-25 01:00:32 +09:00
Hajime Hoshi
ffc9a0876a
internal/glfwwin: remove changing the foreground lock timeout
...
See 58b48a3a00
Updates #2084
2022-05-25 00:34:54 +09:00
Hajime Hoshi
55657e72ae
internal/ui: skip hideConsoleWindowOnWindows in Xbox
...
Updates #2084
2022-05-25 00:13:28 +09:00
Hajime Hoshi
3745c0a2e0
internal/graphicsdriver/opengl/gl: remove an unused function GetBufferSubData
...
This is basically a revert of 86a0c7aa82
2022-05-24 20:45:45 +09:00
Hajime Hoshi
a1370a4791
internal/graphicsdriver/opengl: remove an unused member gl.getBufferSubData
2022-05-24 20:40:53 +09:00
Hajime Hoshi
f888b7868b
internal/graphicsdriver/opengl: fix the error message when GenFramebufferEXT fails
2022-05-23 22:25:40 +09:00
Hajime Hoshi
6cd655b5ce
internal/glfwwin: bug fix: error values were not returned
2022-05-22 22:05:48 +09:00
Hajime Hoshi
0577a28aed
all: add struct members for go-vet
...
Updates #1306
2022-05-22 22:05:40 +09:00
Hajime Hoshi
ad5ebae3cc
internal/ui: refactoring
2022-05-22 21:53:42 +09:00
Hajime Hoshi
4396785829
Revert "internal/graphicsdriver/opengl: remove CGO in opengl for macOS ( #2091 )"
...
This reverts commit f7e21983cf
.
Reason: test failures (#2102 )
Closes #2102
2022-05-22 01:24:48 +09:00
TotallyGamerJet
f7e21983cf
internal/graphicsdriver/opengl: remove CGO in opengl for macOS ( #2091 )
...
Updates #1162
2022-05-22 00:58:45 +09:00
Hajime Hoshi
7eeef3ae0f
internal/glfwwin: bug fix: WGL extension functions didn't work
...
Closes #2101
2022-05-22 00:40:50 +09:00
Hajime Hoshi
8d3de6207b
internal/gamepad: add a warning message when getGamepads is not available
...
Updates #2100
2022-05-21 23:25:56 +09:00
Hajime Hoshi
8d318fc4de
internal/gamepad: bug fix: getGamepads might not be available under a non-secure context
...
Closes #2100
2022-05-21 23:22:50 +09:00
Hajime Hoshi
6fa39d5e73
internal/glfw: make panic messages consistent
2022-05-21 13:19:11 +09:00
Hajime Hoshi
9a1eb0b124
internal/glfwwin: bug fix: wrong type casts (TlsGetValue)
2022-05-21 00:59:14 +09:00
Hajime Hoshi
93731673ad
internal/glfwwin: bug fix: wrong type casts
2022-05-21 00:56:22 +09:00
Hajime Hoshi
374f1cf8e6
internal/glfwwin: fix typo
2022-05-21 00:18:36 +09:00
Hajime Hoshi
bd2a31bdd8
internal/glfwwin: remove unnecessary comments
2022-05-20 23:17:03 +09:00
Hajime Hoshi
8c467aaa1b
internal/glfwwin: update GLFW to 3.3.7
...
Reference: 597ae79a86
2022-05-20 23:09:16 +09:00
Hajime Hoshi
f67b4cc1d6
internal/glfw: use a pure Go implementation of GLFW
...
This change removes internal/glfw/glfw, that is a DLL loader, and
replaces the usages with internal/glfwwin, that is a pure Go
implementation of GLFW for Windows.
The build tag `ebitenexternaldll` is also removed.
Closes #1764
2022-05-20 22:10:00 +09:00
Hajime Hoshi
edd617f80e
internal: add a new package glfwwin
...
internal/glfwwin is a pure Go implementation of GLFW for Windows.
Updates #1764
2022-05-20 21:36:13 +09:00
Hajime Hoshi
eec5ea00ec
internal/glfw: refactoring: use pointers or functions for callbacks
2022-05-20 17:49:46 +09:00
Hajime Hoshi
8d2b08dd14
internal/glfw: refactoring: make callback handlers consistent
2022-05-19 01:49:21 +09:00
Hajime Hoshi
7189c7f649
internal/glfw: refactoring: remove unused APIs
...
Ebiten doesn't rely on GLFW for gamepads.
2022-05-19 01:04:23 +09:00
Hajime Hoshi
fef79f4d3e
internal/graphicsdriver/metal: update the minimum version of macOS
...
Updates #2095
2022-05-18 00:09:04 +09:00
Hajime Hoshi
3d00bb1fa2
internal/gamepad, internal/ui: type-cast returning values from Win32APIs just in case
2022-05-11 00:48:44 +09:00
Hajime Hoshi
812607cdfc
internal/processtest/testdata: add a test case for #2089
...
Updates #2089
2022-05-08 23:45:21 +09:00
Hajime Hoshi
faf1e7350d
internal/atlas: bug fix: wrong logic to create a new mask with edges
...
* Fixed wrong operator orders
* Cleared an allocated region explicitlly
Closes #2089
2022-05-08 23:06:10 +09:00
Hajime Hoshi
7409f01b17
internal/graphicsdriver/metal/mtl: bug fix: specify the language version explicitly
...
Updates #2086
2022-05-05 23:50:48 +09:00
Hajime Hoshi
a0e1d08123
internal/graphicsdriver/directx: update comments
...
Updates #2081
2022-04-26 11:20:48 +09:00
Hajime Hoshi
7321e86a6b
internal/graphicsdriver/directx: bug fix: the screen image can be nil when resizing the window
...
Closes #2081
2022-04-26 11:19:48 +09:00
Hajime Hoshi
38a2aa11fd
internal/ui: bug fix: deadlock at Layout with Ebiten's image functions called
...
Closes #2079
2022-04-26 01:12:57 +09:00
Hajime Hoshi
dc811f9329
internal/gamepaddb: bug fix: crash at addAndroidDefaultMappings
...
Closes #2076
2022-04-19 23:36:02 +09:00
Hajime Hoshi
928d82c685
internal/atlas: potential bug fix: restore images before other image manipulations
...
From the reported stack trace, there could be a potential issue in
atlas.BeginFrame: images were manipulated before the images are restored.
Restoring images assumes that all images are not stale, but manipulating
images like putOnAtlas might cause other images stale in ReplacePixels.
Though we failed to reproduce the case, this fix should make sense.
Updates #2075
2022-04-18 02:19:46 +09:00
Hajime Hoshi
2fc691f661
internal/clock: rename CurrentFPS/TPS -> ActualFPS/TPS
2022-04-14 00:57:47 +09:00
Hajime Hoshi
f25dda1318
internal/clock: force to sync the timer when TPS is updated
2022-04-14 00:56:37 +09:00
Hajime Hoshi
2a5b5b4823
internal/ui: avoid a busy loop in restoreWindow
...
Updates #1826
2022-04-10 17:55:39 +09:00
Hajime Hoshi
3fe1df8b3b
internal/ui: bug fix: ebiten.WindowSize() returned (1,1) when iconified
2022-04-10 16:50:47 +09:00
Hajime Hoshi
aae866350a
internal/ui: bug fix: (*glfw.Window).GetSize() returns (0,0) when iconified
...
Closes #2066
2022-04-10 16:43:03 +09:00
Hajime Hoshi
d3b83dd4ea
internal/ui: refactoring
2022-04-09 18:23:56 +09:00
Hajime Hoshi
fcb7df0a59
internal/ui: bug fix: checking fullscreen on Safari was wrong
2022-04-09 17:25:19 +09:00
Hajime Hoshi
a69be34001
internal/ui: update the error message for fullscreen
2022-04-09 16:55:09 +09:00
Hajime Hoshi
853d94c3ef
internal/shader: implement strict type checks when calling a function
...
Closes #2032
2022-04-09 00:32:27 +09:00
Hajime Hoshi
15fe7158fd
internal/shader: implement strict type checks in assignments
...
Closes #1972
2022-04-09 00:02:20 +09:00
Hajime Hoshi
93b4c0d9b1
internal/ui: add comments
...
Updates #1590
2022-04-08 18:40:13 +09:00
Hajime Hoshi
2008916261
internal/ui: bug fix: use the native unit for origWindowPosByOS
2022-04-08 16:43:13 +09:00
Hajime Hoshi
90070c09fe
internal/ui: rename origPos -> origWindowPos
2022-04-08 15:59:16 +09:00
Hajime Hoshi
352d332097
internal/ui: remove redundant comments
2022-04-08 15:51:56 +09:00
Hajime Hoshi
ee124baf60
internal/ui: bug fix: WindowSize returned a wrong value on fullscreen on macOS
...
Closes #2062
2022-04-08 14:57:51 +09:00
Hajime Hoshi
ad66c3d90b
internal/png: clean up files before generating
2022-04-06 11:48:46 +09:00
Hajime Hoshi
20beb9d2b8
internal/gamepaddb: update the database
...
Updates #1902
2022-04-06 11:41:05 +09:00
Hajime Hoshi
6e19c793f6
internal/png: update for Go 1.18
2022-04-06 11:32:48 +09:00
Hajime Hoshi
32de5ec2d0
internal/graphics: refactoring
2022-04-05 11:12:25 +09:00
Hajime Hoshi
c6e5582c56
Revert "internal/graphics: refactoring"
...
This reverts commit b6cc164e96
.
Reason: wrong shader program
2022-04-04 14:31:37 +09:00
Hajime Hoshi
b6cc164e96
internal/graphics: refactoring
2022-04-04 14:30:51 +09:00
Hajime Hoshi
c56665b23c
internal/processtest: bug fix: shadernomain is no longer a valid test
...
Updates #2035
2022-04-04 03:12:34 +09:00
Hajime Hoshi
736d77e0d2
internal/graphicsdriver: remove Graphics.NDCYDirection
2022-04-04 03:03:44 +09:00
Hajime Hoshi
6710808cd1
ebiten: compile shaders at NewShader
...
Closes #2035
2022-04-04 02:52:57 +09:00
Hajime Hoshi
02db3bad53
internal/graphicscommand: remove the dependency on a graphics driver from compileShader
...
Updates #2035
2022-04-04 02:09:08 +09:00
Hajime Hoshi
4b0967be42
internal/ui: gofmt
2022-04-04 01:48:15 +09:00
Hajime Hoshi
f756be3d22
internal/devicescale: bug fix: glfw.Monitor.GetContentScale might return 0
...
Retrying to call GetContentScale solved this.
Closes #2051
2022-04-03 19:32:01 +09:00
Hajime Hoshi
f1f9f74e5c
internal/ui: bug fix: force to refresh the framebuffer by resizing the window very quickly
...
Closes #2050
2022-04-03 18:43:22 +09:00
Hajime Hoshi
65094c61b1
internal/graphicscommand: reland: merge adjacent commands if the same shader and uniform variables are used
...
Closes #1846
2022-04-03 03:57:49 +09:00
Hajime Hoshi
f75a70dc40
internal/graphicscommand: treat []float32 instead of interface{} for uniform variables
2022-04-03 03:51:52 +09:00
Hajime Hoshi
990228e216
internal/graphicscommand: cache uniform name locations and types
2022-04-03 03:28:11 +09:00
Hajime Hoshi
9be454ef25
internal/graphicsdriver: remove an old comment
2022-04-03 02:53:43 +09:00
Hajime Hoshi
9f3f9e64cc
internal/graphicscommand: add panic at convertUniforms
2022-04-03 00:39:05 +09:00
Hajime Hoshi
b52a02a178
internal/ui: bug fix: crash when Image.MarkDisposed is called multiple times
...
Closes #2048
2022-04-03 00:21:26 +09:00
Hajime Hoshi
651c5693c6
Revert "internal/graphicscommand: merge adjacent commands if the same shader and uniform variables are used"
...
This reverts commit 425ce27976
.
Reason: test failures
2022-04-03 00:11:15 +09:00
Hajime Hoshi
425ce27976
internal/graphicscommand: merge adjacent commands if the same shader and uniform variables are used
...
Closes #1846
2022-04-02 23:55:14 +09:00
Hajime Hoshi
33078c764c
internal/gamepaddb: make Update atomic
...
Closes #1978
2022-04-02 20:19:04 +09:00
Hajime Hoshi
3fafc05411
internal/graphicsdriver: remove Graphics.HasHighPrecisionFloat
...
Updates #879
2022-04-02 05:19:30 +09:00
Hajime Hoshi
351ef9fbb7
internal/atlas, internal/graphicsdriver: move the adjusting-pixel logic to atlas
...
Now pixels are adjusted even when the graphics driver doesn't have
high-precision floats, but this should not be problematic. This was
introduced at 9bff33472a
, but the
adjusting way is much different from the current way.
Updates #879
Closes #1820
2022-04-02 05:15:29 +09:00
Hajime Hoshi
34e23f5256
internal/restorable: treat texels instead of pixels
...
Updates #1820
2022-04-02 04:25:27 +09:00
Hajime Hoshi
0c6362c93a
internal/atlas: move the color scaling from internal/atlas to ebiten
...
Updates #1820
2022-04-02 02:47:56 +09:00
Hajime Hoshi
5c7917897c
internal/ui: refactoring: move the logic in gameForUI to context
2022-04-01 22:33:31 +09:00
Hajime Hoshi
9c448d207a
internal/ui: remove an unnecessary alias
2022-04-01 21:17:26 +09:00
Hajime Hoshi
b53cb2acd6
internal/ui, internal/mipmap, internal/graphicscommand: fix a wrong panic message
2022-04-01 20:12:12 +09:00
Hajime Hoshi
8e40b2562e
internal/ui: remove an error returning value from Game.Draw
2022-04-01 19:10:10 +09:00
Hajime Hoshi
ea1c18d124
internal/ui: rename contextImpl -> context
2022-04-01 17:59:44 +09:00
Hajime Hoshi
09a548e055
internal/ui: consider the case when currentMonitor() returns nil
...
Closes #1887
2022-04-01 03:51:28 +09:00
Hajime Hoshi
07a7aca1b3
internal/gamepad: skip gamepads with more than 32 buttons
...
This change was removed at ef45058037
accidentally.
Updates #1173
Updates #2039
2022-04-01 02:24:15 +09:00
Hajime Hoshi
b5a9ff007c
internal/ui: bug fix: WindowPosition
/SetWindowPosition
didn't work on macOS fullscreen
...
Updates #1590
Closes #2043
2022-03-30 12:10:48 +09:00
Hajime Hoshi
172da82aa7
internal/ui: optimization: reduce u.t.Call
2022-03-30 03:28:18 +09:00
Hajime Hoshi
f2860bebed
internal/ui: remove an unnecessary hack to resize the window
...
The bug (#1606 ) is no longer reproducible even without the hack.
Updates #1606
Updates #1609
2022-03-30 02:48:39 +09:00
Hajime Hoshi
feb70963c6
internal/ui: force to put the window in the initial monitor
...
To make things simple, let's not put the window outside the initial
monitor.
Updates #1351
Closes #1575
2022-03-30 01:56:35 +09:00
Hajime Hoshi
07d6419dc6
internal/ui: bug fix: DeviceScaleFactor was not concurrent-safe before the main loop
...
Updates #1575
Closes #2042
2022-03-29 00:27:44 +09:00
Hajime Hoshi
2d912a2387
internal/shaderir/hlsl: bug fix: wrong offset of uniform array variables
...
Closes #2038
2022-03-27 01:49:52 +09:00
Hajime Hoshi
aef00a5235
internal/shader: bug fix: wrong type deduction at (scalar)*(matrix)
...
Updates #2037
2022-03-27 01:22:54 +09:00
Hajime Hoshi
6bd3c81e27
internal/graphicsdriver/directx, internal/graphicsdriver/metal: bug fix: uniform matrix-array variables were passed wrongly
...
Updates #2036
2022-03-27 00:32:30 +09:00
Hajime Hoshi
eaad959472
internal/graphicsdriver/metal: remove println
2022-03-27 00:12:34 +09:00
Hajime Hoshi
f6d87f6ee8
internal/graphicsdriver/directx, internal/graphicsdriver/metal: bug fix: uniform matrix variables were passed wrongly
...
Updates #2036
2022-03-26 23:58:48 +09:00
Hajime Hoshi
79e93d3b12
internal/graphicsdriver: introduce the DirectX driver
...
Closes #1007
2022-03-26 20:09:34 +09:00
Hajime Hoshi
a936ffc032
internal/shader: restrict the number of arguments for atan/atan2
2022-03-26 19:40:04 +09:00
Hajime Hoshi
d30a31b16c
internal/shaderir/hlsl: add function forward declarations
2022-03-26 19:10:03 +09:00
divVerent
1de1bfef55
internal/gamepad: fix uint16 underflow handling in gamepads. ( #2030 )
...
Fixes crash where Ebiten considers a keyboard a gamepad with way too many buttons.
Updates #2027
2022-03-26 15:41:59 +09:00
Hajime Hoshi
dcccd27629
internal/shaderir/msl: bug fix: mod for a vector and a scalar didn't work
...
Updates #2029
2022-03-26 02:57:38 +09:00
Hajime Hoshi
52376170a4
internal/shaderir: bug fix: float4x4(x) initialized all the components unexpectedly
...
See https://docs.microsoft.com/en-us/windows/win32/direct3d9/casting-and-conversion#parameter-value-modifiers
Updates #1007
2022-03-26 02:05:35 +09:00
Hajime Hoshi
cfd0de5c41
internal/shaderir: make outputs for unexpected operators consistent
2022-03-26 01:40:02 +09:00
Hajime Hoshi
4893b13acc
internal/shaderir: add internal/shaderir/hlsl
...
Updates #1007
2022-03-26 01:31:05 +09:00
Hajime Hoshi
9bfbbb6e9e
internal/ui: add graphicsDriverGetter.getDirectX()
...
Updates #1007
2022-03-25 19:43:38 +09:00
Hajime Hoshi
e4d0050452
internal/gamepad: bug fix: compile error
...
Updates #2027
2022-03-25 14:35:03 +09:00
Hajime Hoshi
b985689010
internal/gamepad: bug fix: crash when a too big button code is reported on Linux
...
Updates #2027
2022-03-25 14:28:09 +09:00
Hajime Hoshi
c61be3c532
internal/ui: bug fix: getMetal might return a nil pointer as a non-nil interface
2022-03-24 13:36:53 +09:00
Hajime Hoshi
eeb5687b73
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to pointers
...
On second thought, returning pointers is more natural. Handling
nil is a caller's responsibility.
2022-03-24 13:20:36 +09:00
Hajime Hoshi
7bb7e45522
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to interface
...
Converting a nil with a pointer type to an interface type is no longer
a nil-nil interface, and then comparing with nil causes an unexpected
results.
2022-03-24 03:24:58 +09:00
Hajime Hoshi
3074dca670
internal/ui: add the EBITEN_GRAPHICS_LIBRARY environment variable
...
The `ebitengl` build tag is gone instead.
Closes #2007
2022-03-24 02:23:37 +09:00
Hajime Hoshi
151dfffad6
internal/restorable: simplify canDetectContextLostExplicitly
...
This constant was set with some wrong assumptions:
1. On Android, recovering was needed.
2. On iOS, OpenGL ES was used when
a. The architecture was 386 or amd64 == an emulator is used
b. The build tag ebitengl was not specified
c. gomobile-build was used
3. On browsers, recovering was needed.
1., 2b, and 2c are correct.
2a. is not correct: Now emulators are available on all the
architectures with both Metal and OpenGL.
3. is not correct: Ebiten no longer recovers the contest lost.
Now, Ebiten can detect a context lost explicitly when
1. On Android
2. On iOS and on gomobile-build
(When gomobile-build is used, OpenGL should always be used)
Based on this fact, this change changes the constant to a variable,
and fixes the logic to set the variable.
2022-03-23 03:01:59 +09:00
Hajime Hoshi
85daef7436
internal/ui: bug fix: OpenGL must be used when gomobile-build is used
...
Now the logic of graphicsDriver() is updated, this can return a Metal
graphics driver on iOS even when gomobile-build is used.
This change fixes this issue.
2022-03-23 02:58:56 +09:00
Hajime Hoshi
09b0a0ffaf
internal/ui: refactoring: simplify the selection of graphics libraries
2022-03-23 02:21:53 +09:00
Hajime Hoshi
7e6e022065
cmd/ebitenmobile: support Metal for iOS simulators
2022-03-23 01:34:58 +09:00
Hajime Hoshi
a74e7b1578
Revert "internal/graphicsdriver/metal: refactoring"
...
This reverts commit 1c57393393
.
Reason: nothing is rendered on iOS.
Closes #2022
2022-03-23 01:22:39 +09:00
Hajime Hoshi
8e6907c64a
internal/ui: reduce the calls of graphicsDriver()
2022-03-22 02:17:41 +09:00
Hajime Hoshi
15548b4c74
internal/ui: add userInterfaceImpl.graphicsDriver
2022-03-22 00:13:22 +09:00
Hajime Hoshi
be1836339b
internal/ui: define the common struct UserInterface for all the environments
...
The existing UserInterface structs became userInterfaceImpl structs.
2022-03-21 23:10:27 +09:00
Hajime Hoshi
99437944bc
internal/ui: remove graphicsDrivre() calls from image.go
2022-03-21 22:49:47 +09:00
Hajime Hoshi
cd57bccbfc
internal/graphicsdriver: let some functions return an error
...
This is a preparation for the DirectX driver.
Updates #1007
2022-03-21 22:23:12 +09:00
Hajime Hoshi
0dcf43b350
internal/graphicsdriver: reorder the member
2022-03-21 22:05:21 +09:00
Hajime Hoshi
5e973ab419
Revert "internal/graphicscommand: clear the queue regardless of an error"
...
This reverts commit e21636fbb9
.
Reason: Simply this is no longer needed. We gave up testing when an error
occurs in a graphics command queue.
2022-03-21 21:57:59 +09:00
Hajime Hoshi
31104c4e79
internal/processtest: remove TestShaderNoMain and add shadernomain.go
...
A shader compilation error breaks the state of the graphics command
queue, and this cannot be reused. Thus, a process test is appropriated.
2022-03-21 21:52:38 +09:00
Hajime Hoshi
81b9f91f86
internal/graphicscommand: compile shaders lazily
...
With DirectX, the graphics driver cannot be determined until the
main loop starts, as a transparent window cannot be treated with
DirectX so far. On the other hand, compiling shaders requires a
graphics driver as it requires information about Y directions of
NDCs and framebuffers.
This change delays compiling shaders until the graphics commands
are actually executed in the main loop.
Updates #1007
Updates #2019
2022-03-21 21:09:02 +09:00
Hajime Hoshi
e21636fbb9
internal/graphicscommand: clear the queue regardless of an error
...
There was a potential issue that commands in the queue are never
reset when an error happens and the queue continues to send errors.
This is problematic especially for testings.
This change fixes the issue by Go's defer.
2022-03-21 20:10:03 +09:00
Hajime Hoshi
ad0e0e3e66
internal/graphicscommand: remove an unused member
2022-03-21 19:50:05 +09:00
Hajime Hoshi
9b1adf799d
internal/shader: move syntax tests to internal/shader
2022-03-21 19:31:06 +09:00
Hajime Hoshi
b5bb576a58
internal/ui: refactoring: unexport ConvertUniforms
2022-03-21 17:05:50 +09:00
Hajime Hoshi
f4ad12987d
internal/ui: bug fix: compile error with the cbackend tag
2022-03-21 16:59:53 +09:00
Hajime Hoshi
12ce5ae83a
internal/ui: remove the call of graphicsDriver() from the context
2022-03-21 16:48:33 +09:00
Hajime Hoshi
fc96eb30a1
internal/atlas: simplify the logic by adding paddings to the mask
2022-03-21 16:13:21 +09:00
Hajime Hoshi
870a18e8f5
internal/buffered: remove unnecessary conditions from resolvePendingPixels
2022-03-21 15:27:21 +09:00
Hajime Hoshi
4b31983b6d
internal/buffered: English
2022-03-21 15:20:52 +09:00
Hajime Hoshi
c316aaae72
internal/buffered: simplify the API
2022-03-21 15:19:06 +09:00
Hajime Hoshi
5c3f8915d1
internal/atlas: add an argument check
2022-03-21 15:11:38 +09:00
Hajime Hoshi
29f7a45ccc
internal/buffer: remove the graphics-driver argument from ReplacePartialRegionPixels
...
This is necessary to remove the graphics driver usage from
(*ebiten.Image).At. And this is necessary to determine the graphics
driver after the window becomes transparent or not.
Unfortunately, it is not obvious to make a transparent window with
DirectX. Then, the determination of a graphics driver should be delayed.
Updates #1007
2022-03-21 05:59:43 +09:00
Hajime Hoshi
4f070915b2
internal/atlas: bug fix: do not use the padding when a mask is specified
...
With paddings, a mask size was not appropriate.
As a simple solution, let's not use paddings when a mask is specified.
2022-03-21 05:50:31 +09:00
Hajime Hoshi
dfc9eeaaec
internal/restorable: bug fix: the parameter mask was not passed correctly
2022-03-21 05:40:13 +09:00
Hajime Hoshi
fbcbd2a001
internal/buffered: refactoring
2022-03-21 04:36:32 +09:00
Hajime Hoshi
b3f4d6c522
internal/atlas: add a new parameter specifying a mask for ReplacePixels
2022-03-21 03:56:04 +09:00
Hajime Hoshi
5c79b86412
internal/restorable: add a new parameter specifying a mask for ReplacePixels
2022-03-21 03:08:58 +09:00
Hajime Hoshi
e55dbbf3cd
internal/restorable: add more tests
2022-03-21 03:04:52 +09:00
Hajime Hoshi
72a6ab8da4
internal/restorable: add more tests
2022-03-21 02:44:48 +09:00
Hajime Hoshi
924f7ea932
internal/restorable: refactoring
2022-03-21 01:26:48 +09:00
Hajime Hoshi
5fe6791b5d
internal/graphicscommand: add a new paramter 'mask' to ReplacePixels
2022-03-21 01:11:01 +09:00
Hajime Hoshi
c1a0d83f8d
internal/restorable: simplify the implementation of rect
...
Allow overlapped regions at pixelsRecords.
This removes the members `last*` for caching. These were introduced
at 7e7751bd43
, and apparently these
are no longer needed.
2022-03-21 00:06:30 +09:00
Hajime Hoshi
ea81d4abf4
internal/buffered: refactoring
2022-03-20 19:03:41 +09:00
Hajime Hoshi
14c327c89b
internal/atlas: replace Pixels with At to reduce unnecessary slice allocations
2022-03-20 18:39:17 +09:00
Hajime Hoshi
11ff0ab48c
internal/atlas: refactoring: remove arguments from Pixels
2022-03-20 18:28:57 +09:00
Hajime Hoshi
367a9ec5bf
internal/atlas: refactoring
2022-03-20 18:07:29 +09:00
Hajime Hoshi
54b4e87506
internal/restorable: bug fix: ReplacePixels on a sub-image might panic on Android
...
If regions by ReplacePixel are overlapped, this can panics. This can
happen only on Android, where a context lost can happen.
Thus, a sub-image cannot call a direct ReplacePixels. internal/buffer
has to care this.
2022-03-20 18:01:37 +09:00
Hajime Hoshi
696bbc088f
internal/ui: rename variables
2022-03-20 16:51:23 +09:00
Hajime Hoshi
c3e855ab02
internal/buffered: refactoring
2022-03-20 16:44:11 +09:00
Hajime Hoshi
673556d03f
internal/ui: move the error handlings to the ui package
2022-03-20 16:26:26 +09:00
Hajime Hoshi
bd07f6246f
internal/buffered: remove mysterious comments
2022-03-20 05:17:43 +09:00
Hajime Hoshi
cc574ad67e
internal/atlas: rename functions: Area -> Region
2022-03-20 04:20:23 +09:00
Hajime Hoshi
b59dd45239
internal/buffered: separate ReplacePixels with the large-area and small-area versions
...
For the large-area version, this doesn't require a graphics driver.
This is necessary to ensure that ReplacePixels never needs a graphics
driver.
2022-03-20 04:13:31 +09:00
Hajime Hoshi
4cbce71b2b
internal/graphicscommand: move the choice of graphics drivers to internal/ui
2022-03-20 02:51:31 +09:00
Hajime Hoshi
1d9982ee6d
internal/ui: move the dependency on graphicscommand from ebiten to ui
2022-03-20 02:00:44 +09:00
Hajime Hoshi
e78f34aa26
internal/ui: add Image
...
This is a preparation for a refactoring. Image will be a proxy to
pass a graphics driver to the lower layer.
2022-03-20 01:39:05 +09:00
Hajime Hoshi
3e44a20b22
internal/graphicscommand: swap arguments
2022-03-20 00:09:17 +09:00
Hajime Hoshi
8e3576b404
internal/mipmap: remove unused functions
2022-03-19 23:45:15 +09:00
Hajime Hoshi
7c2300b352
internal/graphicscommand: reduce the usages of the graphicsDriver function
2022-03-19 23:03:34 +09:00
Hajime Hoshi
58366ce64d
internal/glfw: make the file operation atomic
...
If multiple Ebiten processes start at the same time, the file operation
can cause a race condition. Add a file lock to avoid this.
2022-03-18 20:32:25 +09:00
Hajime Hoshi
2e6bb8c4e2
internal/graphicsdriver/metal: add comments
2022-03-14 22:02:44 +09:00
Hajime Hoshi
a617576879
internal/shaderir: replace Mul with ComponentWiseMul and MatrixMul
...
This is a preparation for DirectX / HLSL.
Updates #1007
2022-03-13 19:17:46 +09:00
Hajime Hoshi
044d41dd2d
internal/shaderir: change Op from string to int
...
This is a preparation to distinguish Hadamard product and matrix
product for HLSL.
Updates #1007
2022-03-13 16:20:04 +09:00
Hajime Hoshi
7d0f95e9be
internal/graphicsdriver: refactoring: replace Uniform with []float32
...
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
35a5c88901
internal/graphics: rename constants
2022-03-12 04:01:48 +09:00
Hajime Hoshi
98e2d86ea3
internal/shaderir/msl: refactoring
2022-03-12 00:18:55 +09:00
Hajime Hoshi
5715539a0f
internal/shaderir/glsl, internal/shaderir/msl: refactoring
2022-03-11 15:18:38 +09:00
Hajime Hoshi
e63709a2a5
internal/shaderir/glsl: refactoring
2022-03-11 02:03:15 +09:00
Hajime Hoshi
6f00221051
internal/shaderir/msl: rename the package name
...
Updates #2010
2022-03-10 16:25:11 +09:00
Hajime Hoshi
5f97bdc1d3
internal/shader: fix typo
...
Updates #2011
2022-03-10 02:54:32 +09:00
Hajime Hoshi
5614e9d7eb
internal/shader: fix misspellings
2022-03-10 02:52:44 +09:00
Hajime Hoshi
880dd0682e
internal/shader: bug fix: fix some failing tests
2022-03-10 02:24:29 +09:00
Hajime Hoshi
d3b72d4ef9
internal/shader: add test files
...
Updates #2011
2022-03-10 01:02:51 +09:00
Hajime Hoshi
de05ede27e
internal/shader: bug fix: evaluate the builtin float/int functions in the pre-compile phase correctly
...
Closes #2011
2022-03-10 00:47:16 +09:00
Hajime Hoshi
47bfd0db9e
internal/shaderir/metal: rename to msl
...
Closes #2010
2022-03-10 00:14:06 +09:00
Hajime Hoshi
5e5e3c64ac
internal/shaderir/metal: remove a redundant case
2022-03-09 02:54:31 +09:00
Hajime Hoshi
15064dbdc1
internal/shaderir/glsl, internal/shaderir/metal: simplify function names
2022-03-09 01:43:36 +09:00
Hajime Hoshi
e4fba8b047
bug fix: compile error with Go 1.16 and older
2022-03-08 00:08:53 +09:00
Hajime Hoshi
86ba7719eb
internal/ui: bug fix: use CompareAndSwap
2022-03-07 23:51:10 +09:00
Hajime Hoshi
c37ffecafd
internal/graphicsdriver/metal: reorder uniform variables
...
This might improve memory allocations.
This makes the code more consistent with HLSL's packing rule [1]
[1] https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-packing-rules
2022-03-05 22:12:08 +09:00
Hajime Hoshi
9c6b7aaca3
internal/ui: catch the error at At correctly
2022-03-05 01:44:59 +09:00
Hajime Hoshi
df2133186d
internal/shaderir: bug fix: test failures
2022-03-04 19:01:58 +09:00
Hajime Hoshi
3c1e64dd67
internal/shaderir/metal: bug fix: define the 'mod' function correctly
...
Closes #2006
2022-03-04 18:05:44 +09:00
Hajime Hoshi
d4d4b9c070
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: more efficient modulo
2022-03-04 03:47:55 +09:00
Hajime Hoshi
ed22052e5f
internal/graphicscommand: add a comment
2022-02-28 00:15:52 +09:00
Hajime Hoshi
dd8900ea48
internal/graphicsdriver: refactoring: choose the graphics driver at this package
2022-02-27 23:51:19 +09:00
Hajime Hoshi
99f8e335ee
ebiten: refactoring
2022-02-27 22:21:57 +09:00
Hajime Hoshi
77f765d483
internal/testing: bug fix: considering the case when Y is inverted
...
Closes #2003
2022-02-27 22:14:32 +09:00
Hajime Hoshi
4ca1220671
internal/graphicscommand: bug fix: compile error, test failures
2022-02-27 20:13:21 +09:00
Hajime Hoshi
b22309a0e5
internal/graphicsdriver: replace Pixels with ReadPixels
...
Now preparing a byte slice is the caller's responsibility.
2022-02-27 20:03:13 +09:00
Hajime Hoshi
1cb7633ff6
internal/ui: bug fix: atomic.Value.Store cannot be called when a differnet type value is already stored
2022-02-27 17:41:19 +09:00
Hajime Hoshi
566957dc1c
internal/graphicsdriver/metal: invert Y at the vertex shader
...
Instead of using a negative height in the viewport, invert the Y direction
at the vertex shader. This is a little more readable as a negative height
is hacky.
This is a preparation for DirectX 12. DirectX 12's coodination system
is very similar to Metal, but doesn't treat a negative height in its
viewport unfortunately.
Updates #1007
2022-02-27 01:53:03 +09:00
divVerent
ea35296be7
ebiten: provide SetScreenFilterEnabled
, a way to disable the default screen filter ( #1997 )
...
Using FilterNearest rather than filterScreen or FilterLinear speeds up a
Dell E6500 from 23fps->36fps and 27fps->48fps.
Updates #1772
2022-02-24 03:46:27 +09:00
divVerent
f2209a0b51
internal/atlas: optimization: send premultiplied alpha from vertex to fragment shader. ( #1996 )
...
Note that this applies only to the builtin shaders - interface for Kage stays
unchanged for compatibility.
Minor compatibility delta: when interpolating alpha values, previous code has
created nonsense values, such as, when interpolating from
fully-transparent-black (0,0,0,0) to opaque-white (1,1,1,1), something like
half-transparent-grey (0.25,0.25,0.25,0.5) where half-transparent-white
(0.5,0.5,0.5,0.5) is used by the new code.
I assume this is a strict improvement, however this may warrant some testing.
Possible later improvement could be moving the premultiplication from fragment
shader to CPU. Did not do this as it makes the code rather inconsistent of Kage
vs built-in shader usage.
Updates #1772
2022-02-24 02:27:50 +09:00
divVerent
476f4e3f9a
internal/gamepad: fix SetWindowLongPtrW crash on 32-bit Windows ( #1999 )
...
Closes #1998
2022-02-23 23:18:20 +09:00
Hajime Hoshi
8b7273b74a
internal/graphicsdriver/metal: call PresentDrawable only when necessary
2022-02-22 01:37:13 +09:00
Hajime Hoshi
ee911fd892
internal/graphicsdriver/metal: fix an error message
2022-02-20 22:01:36 +09:00
Hajime Hoshi
bf33658e64
internal/gamepad: respect original names more
2022-02-15 04:07:11 +09:00
Hajime Hoshi
f17d222a4b
internal/atlas: resolve deferred every frame instead of every tick
...
Resolving defferred functions doesn't have to be done every tick. Rather,
this should be done every frame as this is related to rendering.
2022-02-14 03:45:58 +09:00
Hajime Hoshi
4949c49cd0
internal/ui: refactoring
2022-02-14 03:39:02 +09:00
Hajime Hoshi
871121abe3
internal/ui: refactoring: remove (*contextImpl).layout
2022-02-14 02:59:02 +09:00
Hajime Hoshi
cffa123405
internal/ui: refactoring: remove sizeChanged for js
...
It is safe to call Layout every frame.
2022-02-14 02:50:32 +09:00
Hajime Hoshi
e2f0878a4c
internal/ui: refactoring: remove sizeChanged
...
It is safe to call Layout every frame.
2022-02-14 02:17:52 +09:00
Hajime Hoshi
fcd4453e4f
ebiten: remove RunOnMainThread
...
Unfortunately, there are several issues in RunOnMainThread:
* RunOnMainThread cannot be portable: It is impossible to implement this
correctly on mobiles.
* RunOnMainThread doesn't make sense on mobiles: the rendering works on
a different thread (goroutine) on mobiles.
* RunOnMainThread can cause deadlocks very easily.
Until we find a better solution, let's remove this.
Closes #1945
2022-02-14 01:49:42 +09:00
Hajime Hoshi
e09c1bf8f1
internal/ui: refactoring: remove an error value from runOnAnotherThreadFromMainThread
2022-02-14 00:55:58 +09:00
Hajime Hoshi
ce3f83958e
internal/graphicscommand: rename RunOnMainThread -> RunOnRenderingThread
2022-02-14 00:20:49 +09:00
Hajime Hoshi
b695cb928a
internal/ui: remove RunWithoutMainLoop in non-mobile environments
2022-02-13 22:31:48 +09:00