Commit Graph

3653 Commits

Author SHA1 Message Date
Hajime Hoshi
7f55fdf769 uidriver/js: Stop auto-focusing on loading when the page is in an iframe
Fixes #1373
2020-10-10 15:52:33 +09:00
Hajime Hoshi
b1c67c7661 ebiten: Introduce type TouchID
Fixes #604
2020-10-10 03:57:47 +09:00
Hajime Hoshi
809b7a3afa ebiten: Introduce type GamepadID
Updates #604
2020-10-08 01:57:08 +09:00
Hajime Hoshi
dc288d37f8 Bug fix: Compile error for Wasm 2020-10-07 02:23:45 +09:00
Hajime Hoshi
ee4ebaaa95 Clean up the 'js' build tags
Updates #1129
2020-10-07 02:07:03 +09:00
Hajime Hoshi
7a0e31a23a Clean up the 'js' build tags
Updates #1129
2020-10-07 01:33:10 +09:00
Hajime Hoshi
00f3d83d4c Remove supporting GopherJS
Fixes #1129
2020-10-07 01:10:09 +09:00
Hajime Hoshi
41cf90a321 ebiten: Change the default value of IsRunningOnUnfocused to be true
Fixes #1180
2020-10-07 00:30:49 +09:00
Hajime Hoshi
c6053bcf14 ebiten: Remove the error returning value from NewImage
Updates #1380
2020-10-06 00:48:56 +09:00
Hajime Hoshi
448a863eb1 ebiten: Remove FilterDefault
Fixes #503
2020-10-05 01:48:47 +09:00
Hajime Hoshi
fe97e7b0a5 ebiten: Remove the filter argument from NewImage and NewImageFromImage
Updates #503
2020-10-05 01:40:44 +09:00
Hajime Hoshi
2dadc6a7a9 ebiten: Make AddressUnsafe default
Fixes #1228
2020-10-04 23:49:35 +09:00
Hajime Hoshi
8f00c8fbf5 ebiten: Remove the argument from Update
Fixes #1260
2020-10-04 19:33:10 +09:00
Hajime Hoshi
e90b5ff277 Update import paths in the documents 2020-10-04 05:07:08 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Bui Quoc Trong
0d29979296
Fix the comment style cause heading in pkgsite (#1369) 2020-09-29 16:55:39 +09:00
Hajime Hoshi
9890dc51da uidriver/glfw: Bug fix: Need to call updateVsync after setWindowSize
Fixes #1363
2020-09-22 18:45:56 +09:00
Hajime Hoshi
3c71eba446 shaderir: Bug fix: Implement atan2 for Metal correctly
Fixes #1360
2020-09-22 04:29:34 +09:00
Hajime Hoshi
ee52c88e98 uidriver/glfw: Bug fix: Set the correct window size when going back from fullscreen 2020-09-21 19:20:58 +09:00
Hajime Hoshi
3fc328db8d uidriver/glfw: Adjust monitor sizes with math.Ceil
deviceScaleFactor() sometimes returns an unnice value (e.g.,
1.502361). Add math.Ceil whenever the calculation involves the
device scale factor.
2020-09-21 18:52:27 +09:00
Hajime Hoshi
f3ef2e2af5 Performance optimization for the path without a shader
Fixes #1355
2020-09-21 05:43:24 +09:00
Hajime Hoshi
cb73230301 graphics: Revive the special allocating method for vertices for Wasm
It looks like the allocation cost is pretty high even on Wasm.
Revive the special method not only on GopherJS but also on Wasm.

examples/sprites kept 30FPS without this fix, but keeps 35FPS with
this fix, on Hajime's MacBook Pro 2020 (macOS Catalina 10.15.6).

Updates #797
2020-09-21 04:21:21 +09:00
Hajime Hoshi
8d17ec837a shareable: Refactoring 2020-09-21 01:58:00 +09:00
Hajime Hoshi
138d9b8e47 shareable: Bug fix: Wrong offset calculation 2020-09-21 01:52:21 +09:00
Hajime Hoshi
41564533f9 ebiten: Allow SubImage at DrawRectShader 2020-09-20 04:48:10 +09:00
Hajime Hoshi
28ce1fc3fb uidriver/glfw: Bug fix: Compile failure 2020-09-19 01:32:33 +09:00
Hajime Hoshi
51f06139a6 uidriver/glfw: Bug fix: Treat X scale (HiDPI) correctly
Fixes #1350
2020-09-19 01:24:18 +09:00
Hajime Hoshi
40e35fa047 uidriver/glfw: Bug fix: Unscale the size for framebuffers on Linux/UNIX
Fixes #1307
2020-09-19 01:04:18 +09:00
Hajime Hoshi
97607f5779 graphicsdriver/glfw: Bug fix: Convert window size unit correctly on Linux/UNIX
Updates #1307
2020-09-19 00:31:34 +09:00
Hajime Hoshi
5278a7c6d6 uidriver/glfw: Bug fix: Use the correct scale for GLFW APIs on Linux/UNIX
Updates #1307
2020-09-19 00:21:10 +09:00
Hajime Hoshi
632b985448 devicescale: Ignore the base scale
The window might be too bit when the base scale is 2.

Updates #1307
Updates #1350
2020-09-18 03:48:42 +09:00
Hajime Hoshi
5f3d6dbc19 devicescale: Choose the correct Cinnamon monitor configuration
Updates #1307
2020-09-18 01:07:48 +09:00
Hajime Hoshi
da94f3c2cb devicescale: Bug fix: Base-scale should be multiplied on Cinnamon
Updates #1307
2020-09-18 00:19:16 +09:00
Hajime Hoshi
65759f33a3 devicescale: Refactoring 2020-09-18 00:11:18 +09:00
Hajime Hoshi
3dab49fc39 graphicsdriver/opengl: Better error message 2020-09-17 20:35:57 +09:00
Hajime Hoshi
ab004031d0 shader: Reland: Bug fix: Checking unused variables defined with var 2020-09-17 17:46:35 +09:00
Hajime Hoshi
ac971f77c5 Revert "shader: Bug fix: Checking unused variables defined with var"
This reverts commit 4d3d3134d5.

Reason: Test failures
2020-09-17 17:32:07 +09:00
Hajime Hoshi
4d3d3134d5 shader: Bug fix: Checking unused variables defined with var 2020-09-17 17:29:37 +09:00
Hajime Hoshi
ded223ead0 shader: Bug fix: selector is not available on a blank identifier 2020-09-14 03:41:25 +09:00
Hajime Hoshi
e1d8629189 shader: Bug fix: a blank identifier lhs and += cannot work 2020-09-14 00:51:27 +09:00
Hajime Hoshi
fd51abfb0d shader: Bug fix ++/-- must not be applied to a blank identifier 2020-09-14 00:32:47 +09:00
Hajime Hoshi
7666987b09 shader: Bug fix: a blank identifier cannot be used as values 2020-09-13 23:55:25 +09:00
Hajime Hoshi
154f86e6c1 shader: Check unused local variables
Fixes #1328
2020-09-13 22:36:41 +09:00
Hajime Hoshi
e543d4f107 shader: Bug fix: true/false should be available as a local variable 2020-09-13 20:38:51 +09:00
Hajime Hoshi
a5af597594 shader: Forbid assigning to special variables 2020-09-13 05:19:20 +09:00
Hajime Hoshi
ed4a7e1856 shader: Forbid init functions
Fixes #1331
2020-09-12 19:50:23 +09:00
Hajime Hoshi
de4ff71544 devicescale: Read ~/.config/cinnamon-monitors.xml on Cinnamon
Updates #1307
2020-09-12 19:15:11 +09:00
Hajime Hoshi
8833e46c7e shader: Refactoring 2020-09-12 18:54:36 +09:00
Hajime Hoshi
a0db26f234 ebiten: Bug fix: Test failuer (TestShaderWrongReturn) 2020-09-12 18:36:22 +09:00
Hajime Hoshi
d001f49ad7 shader: Bug fix: Treat multiple-context at return correctly 2020-09-12 17:44:04 +09:00
Hajime Hoshi
2fb1033183 shader: Initialize output parameters explicitly 2020-09-12 00:35:14 +09:00
Hajime Hoshi
99dcb14582 shaderir/glsl: Refactoring 2020-09-10 02:11:21 +09:00
Hajime Hoshi
e1ae9bdde0 shaderir/glsl, shaderir/metal: Refactoring 2020-09-10 02:04:28 +09:00
Hajime Hoshi
337f44c916 shader: Add Metal tests
Fixes #1340
2020-09-10 01:19:02 +09:00
Hajime Hoshi
031f8376e9 shaderir: Refactoring 2020-09-08 03:51:29 +09:00
Hajime Hoshi
3b040e5f22 Fix test failures 2020-09-08 03:10:59 +09:00
Hajime Hoshi
1786be55f7 shader: Refactoring 2020-09-08 02:43:41 +09:00
Hajime Hoshi
0a0401e217 shader: Refactoring: Simplify calculation of LocalVarIndexOffset 2020-09-08 02:42:43 +09:00
Hajime Hoshi
41d4fc288b shader: Reword 2020-09-08 01:40:49 +09:00
Hajime Hoshi
f61a916e4a shaderir/glsl: Bug fix: Calculate local variable indices correctly
Fixes #1339
2020-09-08 00:19:07 +09:00
Hajime Hoshi
4308bbbc31 shader: Check the existence of 'return' 2020-09-06 22:33:27 +09:00
Hajime Hoshi
e0b8b9945f shader: Check returning value types and the number 2020-09-06 22:08:57 +09:00
Hajime Hoshi
52fcab7a90 graphicsdriver/metal: Fix comments 2020-09-06 16:51:44 +09:00
Hajime Hoshi
e565433fb0 graphicsdriver/metal: Bug fix: Synchronizing textures on iOS was necessary
Fixes #1337
2020-09-06 16:19:50 +09:00
Hajime Hoshi
20ccafce4b uidriver/mobile: Bug fix: Freezing on Pixel 4a by force calling DoWork
When the two channels don't receive for a while, call DoWork forcibly to avoid
freeze.

In theory, this timeout should not be necessary. However, it looks like this
'select' statement sometimes blocks forever on some Android devices like
Pixel 4(a). Apparently workAvailable sometimes not receives even though there
are queued OpenGL functions. Call DoWork for such case as a symptomatic
treatment.

Calling DoWork without waiting for workAvailable is safe. If there are no tasks,
DoWork should return immediately.

Updates #1322
Fixes #1332
2020-09-06 14:34:12 +09:00
Hajime Hoshi
29c7b7687f shaderir: Add Program.UniformNames
Updates #1324
2020-09-06 03:41:17 +09:00
Hajime Hoshi
ac30377297 graphicscommand: Bug fix: Adjusting source regions must be done before checking merging
Fixes #1333
2020-09-05 00:42:51 +09:00
Hajime Hoshi
68c43bb4fb graphicsdriver/opengl: Enable to compile with gldebug tag for gomobile 2020-09-04 15:08:40 +09:00
Hajime Hoshi
760225df75 glfw: Replace the pointer size calc with bits.UintSize / 8
Updates #1306
2020-09-04 01:18:42 +09:00
Hajime Hoshi
ee15e06c50 glfw: Remove some suspicious codes depending on the memory layout 2020-09-04 01:10:39 +09:00
Hajime Hoshi
a3b41515a9 ui: Replace the native window's type (unsafe.Pointer) with uintptr
Updates #1306
2020-09-04 00:51:48 +09:00
Hajime Hoshi
55f0c983ba shader: Bug fix: Ignore blank identifiers for the duplication check
Fixes #1330
2020-09-03 03:03:06 +09:00
Hajime Hoshi
4ac11bf156 shader: Bug fix: Treat number literals in function calls correctly 2020-09-03 02:45:22 +09:00
Hajime Hoshi
0b1d29b6e7 shader: Bug fix: Returning value's integer literals were wrong 2020-09-03 02:10:52 +09:00
Hajime Hoshi
f5829b2cf3 shader: Check at least one variable on left side of :=
Updates #1330
2020-09-03 01:15:41 +09:00
Hajime Hoshi
8336cb6007 uidriver/mobile: Refactoring 2020-08-31 23:28:00 +09:00
Hajime Hoshi
f332fa61c1 uidriver/mobile: Refactoring 2020-08-31 01:01:36 +09:00
Hajime Hoshi
8c779447db shader: Friendly error messages when local variable names are duplicated
Fixes #1254
2020-08-30 21:22:10 +09:00
Hajime Hoshi
349faa0f34 thread: Use an error value instead of context.Context 2020-08-30 02:18:12 +09:00
Hajime Hoshi
1ed2b09ba0 uidriver/glfw: Ensure that canceling happens after all the queued tasks are done 2020-08-29 23:27:20 +09:00
Hajime Hoshi
deb3d4a0c3 uidriver/mobile: Bug fix: Freeze on Pixel 4
An Ebiten application often freezes on Pixel 4. Apparently adding
loggings or runtime.Gosched hides the issue, though this doesn't fix
the root cause. The root cause might be in gomobile itself, but it
seeems really hard to make a minimum case.

As a tentative fix, add runtime.Gosched to avoid freezing.

Fixes #1322
2020-08-29 22:02:54 +09:00
Hajime Hoshi
e19f38bd4f uidriver/mobile: Refactoring 2020-08-29 03:02:20 +09:00
Hajime Hoshi
12878571f6 uidriver/mobile: Refactoring 2020-08-29 02:48:06 +09:00
Hajime Hoshi
b76c34336d uidriver/mobile: Reduce mutex usages 2020-08-29 00:24:30 +09:00
Hajime Hoshi
91aa6a0f3a mobile/ebitenmobileview: Remove mutex usages 2020-08-29 00:18:42 +09:00
Hajime Hoshi
0f21829867 shareable: Bug fix: Add the padding to the offsets when there are no sources
Fixes #1320
2020-08-27 03:42:23 +09:00
Hajime Hoshi
12e5617396 uidriver/glfw: Update comments 2020-08-24 04:07:08 +09:00
Hajime Hoshi
932d599c98 uidriver/glfw: Bug fix compilation failure on macOS and Windows 2020-08-24 03:31:46 +09:00
Hajime Hoshi
a7d234e3c8 uidriver/glfw: Refactoring: make currentMonitorByOS more explicit 2020-08-24 03:27:38 +09:00
Hajime Hoshi
9bff1c79be uidriver/glfw: Refactoring 2020-08-24 03:05:38 +09:00
Hajime Hoshi
af6961fc17 uidriver/glfw: Bug fix: isInitWindowMaximized didn't unlock the mutex 2020-08-24 02:55:31 +09:00
Hajime Hoshi
b1bc06935a uidriver/glfw: Update comments 2020-08-24 00:57:48 +09:00
Hajime Hoshi
ed3a4a734e uidriver/glfw: Refactoring 2020-08-24 00:34:57 +09:00
Hajime Hoshi
9f8054c2d5 uidriver/glfw: Misspelling 2020-08-24 00:10:43 +09:00
Hajime Hoshi
07480ed66d uidriver/glfw: Add better fallbacks for currentMonitorFromPosition
Updates #1119
2020-08-23 23:38:03 +09:00
Hajime Hoshi
10d6a3ad67 uidriver/glfw: Bug fix: Crash on Wine when getting a monitor 2020-08-23 02:31:52 +09:00
Hajime Hoshi
77fa0cb9ef ui: Add SetInitFocused
Fixes #769
2020-08-23 02:19:09 +09:00
Hajime Hoshi
dea716c9a6 uidriver: Remove force focusing by clicking the body
As long as the game is embedded in an iframe, this is no longer
needed.
2020-08-22 18:40:34 +09:00
Hajime Hoshi
bd888f62b9 graphicsdriver/opengl: Exclude bytes.go from non-mobile environments
This requires reflect and reflect prevents Ebiten from being compiiled
with TinyGo.

Updates #747
2020-08-20 22:24:21 +09:00
Hajime Hoshi
85d172c673 uidriver/mobile: Bug fix: The context didn't recovered on gomobile-build
Updates #1176
2020-08-19 23:59:27 +09:00
Hajime Hoshi
7329880f40 restorable: Make the image stale when volatile state changes 2020-08-19 21:13:05 +09:00
Hajime Hoshi
8aef1f9080 restorable: Enable to set the 'volatile' state later
Updates #1309
2020-08-19 00:57:23 +09:00
Hajime Hoshi
c921a63c21 graphicsdriver/opengl/gl: Bug fix: Crash on Parallels
Fixes #1310
2020-08-18 04:33:59 +09:00
Hajime Hoshi
64a6b39240 Revert "restorable: Do not record pixels if restoring is not requried"
This reverts commit 5e1f263d6d.

Reason: Issue #1304
2020-08-17 00:00:12 +09:00
Hajime Hoshi
5e1f263d6d restorable: Do not record pixels if restoring is not requried
Fixes #1022
2020-08-16 20:07:17 +09:00
Hajime Hoshi
a9b94a183b shader: Implement swapping variables
Fixes #1248
2020-08-16 18:40:45 +09:00
Hajime Hoshi
06ed4f5444 shader: Implement len function
Fixes #1279
2020-08-16 02:07:39 +09:00
Hajime Hoshi
a67fd4a2b3 mipmap: Bug fix: Adopt 32 for tooBigScale
I found the case that 64 was not enough on Huawei ALE-L02.
2020-08-15 15:39:27 +09:00
Hajime Hoshi
71e65fa1b7 cmd/ebitenmobile: Use an explict way to detect context lost on Android
Fixes #1176
2020-08-15 01:39:08 +09:00
Hajime Hoshi
d48770cb1c png: Update for Go 1.15 2020-08-14 03:25:02 +09:00
Hajime Hoshi
7307a148f5 glfw: Use Dockerfile for ease to generate the embedding files for Windows
As MinGW version is specified, the result should be more deterministic.

Fixes #1201
2020-08-14 01:34:58 +09:00
Hajime Hoshi
d73472f4f2 Use the library style of file2byteslice 2020-08-14 00:50:09 +09:00
Hajime Hoshi
f6c3e0579f shaderir: Adopt the precision 10 for float literals
Adopted the same precision of (*math/big.Float).String().
2020-08-13 00:01:16 +09:00
Hajime Hoshi
50cd33ed9b shader: Bug fix: Use integer literals in the integer context
Fixes #1299
2020-08-12 13:47:22 +09:00
Hajime Hoshi
39d829d3bf shader: Check the index is an exact integer 2020-08-12 13:47:22 +09:00
Hajime Hoshi
18732ca879 shader: Bug fix: Wrong type deduction with int(x)
Fixes #1298
2020-08-12 12:16:22 +09:00
Hajime Hoshi
d4042a5cfa ebiten: Bug fix: Source regions should not be passed when not needed
The source region information affects the condition of merging
graphics commands. To avoid performance issues by the big number of
graphcis commands, do not pass the source region whenever possible.

Fixes #1293
2020-08-12 02:12:35 +09:00
Hajime Hoshi
08270ee729 shader: Enable to parse ... in an array type 2020-08-11 23:51:22 +09:00
Hajime Hoshi
f71346da6c shaderir: Add bool/int/float conversion
Updates #1289
2020-08-11 23:04:55 +09:00
Hajime Hoshi
609a3c4e22 ebiten: Bug fix: Fix the texel calculation
In shaders, texCoord is always in texture0's texels. Convert them
at imageNTextureAt functions correctly.

Fixes #1290
2020-08-11 04:15:07 +09:00
Hajime Hoshi
69f87d5fd1 ebiten: Add new shader builtin functions: image[N]TextureBoundAt
Fixes #1287
2020-08-11 03:24:54 +09:00
Hajime Hoshi
523dc6f2a0 graphicscommand: Add comments 2020-08-11 03:17:50 +09:00
Hajime Hoshi
985ff2d43f graphicscommand: 0th image must be adopted to calculate the size 2020-08-11 01:38:00 +09:00
Hajime Hoshi
ee049a19ac shader: Bug fix: Wrong local variable index in a block in the fragment entry point 2020-08-10 02:29:49 +09:00
Hajime Hoshi
9b6b306ca3 shader: Bug fix: Wrong local variable index in a block in an entry point 2020-08-10 02:22:09 +09:00
Hajime Hoshi
4d20da9bc0 shader: Refactoring 2020-08-10 02:02:26 +09:00
Hajime Hoshi
e534fe8246 shader: Add more tests using a for-loop 2020-08-10 01:14:42 +09:00
Hajime Hoshi
5d2606b6a5 shader: Bug fix: Wrong local variable indices in blocks 2020-08-10 01:09:02 +09:00
Hajime Hoshi
240e20ad87 shader: Bug fix: Wrong variable index at declaration 2020-08-09 23:23:40 +09:00
Hajime Hoshi
a0494210c3 shader: Bug fix: Wrong local variable index in a block 2020-08-09 23:14:28 +09:00
Hajime Hoshi
eacc9fac6a shader: Indexing with non-consntat value should be allowed 2020-08-09 22:50:53 +09:00
Hajime Hoshi
5dc0d4e1a4 shader: Add more tests about 'for' loops 2020-08-09 22:26:57 +09:00
Hajime Hoshi
dee8690502 shaderir/glsl: Bug fix: Copying an array did not work on GLSL
Fixes #1286
2020-08-09 22:18:58 +09:00
Hajime Hoshi
646518f2e8 shaderir: Fix the test side: local variables for 'for' stmts must be reserved 2020-08-09 22:12:35 +09:00
Hajime Hoshi
b73fecae79 shaderir: Add tests for different counter types 2020-08-09 21:44:06 +09:00
Hajime Hoshi
2707915376 shaderir/glsl, shaderir/metal: Bug fix: Wrong local variables with multiple 'for' statements 2020-08-09 20:12:56 +09:00
Hajime Hoshi
80361443cc shaderir/glsl, shaderir/metal: Bug fix: Wrong local variables in for 2020-08-09 20:06:13 +09:00
Hajime Hoshi
ee9257e626 shaderir: Use pointers for Block 2020-08-09 18:00:55 +09:00
Hajime Hoshi
07514a37c8 shaderir/glsl: Bug fix: Initialize an array
Updates #1285
2020-08-09 04:59:29 +09:00
Hajime Hoshi
febdc46ad5 shaderir/metal: Better array initialization
Updates #1285
2020-08-09 04:40:15 +09:00
Hajime Hoshi
a536b3ee25 shaderir/metal: Bug fix: Array initialization
Updates #1285
2020-08-09 04:22:12 +09:00
Hajime Hoshi
4d1947f711 grpahicsdriver/metal: Better error message 2020-08-09 04:06:30 +09:00
Hajime Hoshi
00a92a21a3 shader: Add compilation tests for Metal 2020-08-08 21:29:01 +09:00
Hajime Hoshi
a45e241da1 shaderir/metal: Implement the shader IR compiler for Metal
Fixes #1165
2020-08-08 19:14:57 +09:00
Hajime Hoshi
18b3859e20 shaderir: Export IsValidSwizzling
This is a preparation for compiling the IR to Metal.

Updates #1165
2020-08-08 19:08:10 +09:00
Hajime Hoshi
2b89710600 graphicsdriver/metal: Refactoring 2020-08-08 18:05:58 +09:00
Hajime Hoshi
caad187cd3 testing: Bug fix: Wrong attribute variables 2020-08-08 17:42:54 +09:00
Hajime Hoshi
6dc74d308b graphicsdriver/metal: Rename viewportSize to internalSize and use it more 2020-08-08 16:07:14 +09:00
Hajime Hoshi
b4046a795e graphics: Reduce the usage of InternalImageSize 2020-08-08 16:01:33 +09:00
Hajime Hoshi
fe1cea533a graphicsdriver/metal: Add a generalized 'draw' function
This is a preparation for rendering shaders.

Updates #1165
2020-08-08 03:12:44 +09:00
Hajime Hoshi
28c638cb5b graphicsdriver/opengl: Unexpose NewShader 2020-08-08 03:12:44 +09:00
Hajime Hoshi
ae28b83d45 testing: Fix wrong comments 2020-08-07 12:26:00 +09:00
Hajime Hoshi
00ccc8ad85 shaderir/glsl: Refactoring 2020-08-07 01:53:22 +09:00
Hajime Hoshi
6576a1da76 shaderir/glsl: Refactoring 2020-08-06 17:53:28 +09:00
Hajime Hoshi
6003d85f75 shaderir: Remove some builtin functions
'degrees' and 'radians' are not defined in Metal.
2020-08-05 02:06:28 +09:00
Hajime Hoshi
ffee5eb6b8 shaderir/glsl: Fix the panic messages 2020-08-05 01:50:41 +09:00
Hajime Hoshi
c22ec580bc shaderir: Remove bultin functions for bvec 2020-08-05 01:41:06 +09:00
Hajime Hoshi
fb59901609 graphicscommand: Bug fix: build error 2020-08-04 01:08:29 +09:00
Hajime Hoshi
cf2f7009aa graphicscommand: Allow shader tests on browsers
Updates #1166
2020-08-04 00:59:27 +09:00
Hajime Hoshi
8bac08cbd9 Add internal/shaderir/glsl 2020-08-03 23:27:27 +09:00
Hajime Hoshi
79e252c158 shaderir: Refactoring 2020-08-02 00:09:12 +09:00
Hajime Hoshi
fa60e31997 shaderir: Bug fix: Pass tests 2020-08-01 21:22:47 +09:00
Hajime Hoshi
4bd01fd038 graphicsdriver/opengl: Implement shaders for browsers
Fixes #1166
2020-08-01 20:27:46 +09:00
Hajime Hoshi
bab05874cd shaderir: Remove unnecessary empty lines 2020-08-01 19:04:10 +09:00
Hajime Hoshi
38dcadb233 graphicsdriver/opengl: Add program error info to the error 2020-08-01 18:58:05 +09:00
Hajime Hoshi
a4334c5464 shader: Use arrays at uniform variables
Fixes #1274
2020-08-01 17:22:10 +09:00
Hajime Hoshi
2b4cf7fd17 shader: Remove unnecessary Println 2020-08-01 16:47:17 +09:00
Hajime Hoshi
073fd329f2 graphicsdriver/opengl: Enable to pass any type of uniform variables
Updates #1274
2020-08-01 05:11:24 +09:00
Hajime Hoshi
a50ef46ed0 graphicsdriver/opengl: Do not allow nil value for uniform variables 2020-08-01 02:01:51 +09:00
Hajime Hoshi
da5642cd0e graphicsdriver/opengl: Add type checks of uniform variables 2020-08-01 02:01:51 +09:00
Hajime Hoshi
ac16564e95 shaderir: Add indexing
Fixes #1235
2020-07-29 23:49:57 +09:00
Hajime Hoshi
a0549820fd shadeir: Add array composite literals
Updates #1235
2020-07-29 23:49:54 +09:00
Hajime Hoshi
004b279e4f shader: Add array initialization
Updates #1235
2020-07-29 22:43:51 +09:00
Hajime Hoshi
62fbac2290 mipmap: Bug fix: HasHighPrecisionFloat cannot be called before the main loop
Instead, use the common number for the too-big scale.

Fixes #1270
2020-07-29 12:46:09 +09:00
Hajime Hoshi
2dc6cbe51a shader: Make parseType return a boolean value indicating ok 2020-07-29 12:02:07 +09:00
Hajime Hoshi
d9c54bc0d0 shader: Implement an array variable
Updates #1235
2020-07-29 02:27:05 +09:00
Hajime Hoshi
da98e67345 mipmap: Bug fix: Wrong level calculation when the indices are empty
Fixes #1269
2020-07-28 14:02:51 +09:00
Hajime Hoshi
a43efb66b2 shaderir: Bug fix: Function prototypes were required for GLSL
Fixes #1267
2020-07-28 00:04:03 +09:00
Hajime Hoshi
a0197d4c2f graphicsdriver/opengl: Bug fix: Build error on Android
Fixes #1266
2020-07-26 17:01:11 +09:00
Hajime Hoshi
ca3fd4eaa4 ebiten: Add texture[ID]Size functions for shaders
Fixes #1239
2020-07-26 15:18:01 +09:00
Hajime Hoshi
d08a04a635 ebiten: Refactoring 2020-07-26 15:05:00 +09:00
Hajime Hoshi
637afe6d67 mipmap: Skip mipmap calculation if possible
If we know we can skip mipmap calculation from GeoM, let's skip it.

Updates #1265
2020-07-26 12:25:03 +09:00
Hajime Hoshi
d017a1b95e Swap the order of the dependencies 'buffered and 'mipmap' 2020-07-26 12:15:23 +09:00
Hajime Hoshi
71aec36ef3 graphics: Update comments 2020-07-26 01:11:11 +09:00
Hajime Hoshi
eb056690aa graphicsdriver/metal: Update the minimum macOS version to 10.12 for Go 1.15 2020-07-25 04:18:26 +09:00
Hajime Hoshi
75d34ab585
graphicsdriver/opengl: Forbids PBO on Raspberry Pi 4 (#1261)
Fixes #1208
2020-07-23 19:15:34 +09:00
Hajime Hoshi
bb1d08a681 shader: Remove the comments 2020-07-20 11:14:54 +09:00
Hajime Hoshi
1217db3b1e ebiten: Remove user-defined vertex shaders
Fixes #1253
2020-07-20 10:07:55 +09:00
Hajime Hoshi
29d53edf1d graphicsdriver/opengl: Bug fix: Rename the attribute variables along with custom shaders 2020-07-20 04:06:35 +09:00
Hajime Hoshi
c8fa937a0a shaderir: Format 2020-07-20 02:12:31 +09:00
Hajime Hoshi
5506491c03 graphicsdriver/opengl: Bug fix: Binding the same texture multiple times did not work
Updates #1193
2020-07-19 04:34:53 +09:00
Hajime Hoshi
36e9803cea shader: Enable to get pixels from multiple images
Updates #1193
2020-07-19 02:33:43 +09:00
Hajime Hoshi
5dd073fcbb restorable, graphicscommand: Remove uniform variables 2020-07-19 01:55:01 +09:00
Hajime Hoshi
fe79bb27af graphicscommand: Refactoring 2020-07-18 23:25:16 +09:00
Hajime Hoshi
6ccb614b08 graphicsdriver/metal: Implement CompositeModeMultiply
Updates #410
2020-07-18 21:51:57 +09:00
nanoslayer
72babcd420
ebiten: Add CompositeModeMultiply (#1251)
This change adds a new composite mode called `CompositeModeMultiply`,
which multiplies the source color with the destination color.

This is tested on Linux and Windows only.

Fixes #410
2020-07-18 21:37:17 +09:00
Hajime Hoshi
4bd3bc16ac shader: Define special variables for textures __t%d
This eanbles to define texture0At to texture3At.

Updates #1193
2020-07-18 19:37:50 +09:00
Hajime Hoshi
e0d5763a60 shader: Use the fixed number of images for shaders
This changes uses arrays rather than slices in order to avoid heap
allocations.

Updates #1193
2020-07-18 18:27:47 +09:00
Hajime Hoshi
52773e1d12 mipmap: Bug fix: Crash at DrawTrianglesWithShader 2020-07-16 23:02:33 +09:00
Hajime Hoshi
c4c9771b78 mipmap: Bug fix: Infinite loop at (*Mipmap).mipmapLevelFromDistance 2020-07-16 03:00:10 +09:00
Hajime Hoshi
bf56492d2d mipmap: Bug fix: mipmapLevelFromDistance must be called from the source 2020-07-16 02:43:08 +09:00
Hajime Hoshi
f927e09f56 mipmap: Unify DrawImage and DrawTriangles
Fixes #909
2020-07-16 02:31:17 +09:00
Hajime Hoshi
7f2be42410 mipmap: Use mipmap for DrawTriangles
Updates #909
2020-07-16 02:31:11 +09:00
Hajime Hoshi
275dd438fa mipmap: Refactoring: Do not use mipmap when the image is volatile 2020-07-16 01:19:57 +09:00
Hajime Hoshi
04b26adf3d mipmap: Refactoring 2020-07-16 00:52:41 +09:00
Hajime Hoshi
38d3811f13 Revert "mipmap: Bug fix: Wrong maximum size of the negative-level mipmap image"
This reverts commit 48b192dbe9.
2020-07-16 00:51:38 +09:00
Hajime Hoshi
48b192dbe9 mipmap: Bug fix: Wrong maximum size of the negative-level mipmap image 2020-07-15 22:59:27 +09:00
Hajime Hoshi
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
ab95c9014d buffered, shareable: Bug fix: Check source images correctly 2020-07-15 03:37:35 +09:00
Hajime Hoshi
f8956941b7 mipmap: Do not allocate independent mipmaps for each sub-image
Fixes #1247
2020-07-15 02:23:45 +09:00
Hajime Hoshi
2a9fd5ef13 mipmap: Avoid using the vertex backend when GopherJS is not used
The backend logic is especially for GopherJS. As the backend logic
tends to consume a lot of memory, let's avoid this when possible.

Updates #797
2020-07-14 12:16:37 +09:00
Hajime Hoshi
385ff8efdf shader: Bug fix: Wrong local variable names at for-loop
Fixes #1245
2020-07-13 22:49:15 +09:00
Hajime Hoshi
0e6f4fccc0 shader: Add break/continue 2020-07-13 02:59:11 +09:00
Hajime Hoshi
c02213e900 shader: Use the loop counters in the test 2020-07-13 01:48:00 +09:00
Hajime Hoshi
2ca551cdc6 shader: Implement 'for' statement
Fixes #1230
2020-07-13 01:44:05 +09:00
Hajime Hoshi
e15ee77e8e shader: Implement operators ++ and -- 2020-07-12 23:07:30 +09:00
Hajime Hoshi
f95ca46c99 shaderir: Add Stmt.ForVarType and use constant.Value
Updates #1230
2020-07-12 22:31:12 +09:00
Hajime Hoshi
291d69500b shaderir: Add Stmt.ForVarIndex
Updates #1230
2020-07-12 21:55:07 +09:00
Hajime Hoshi
4a8bd688a9 shader: Bug fix: index out of range at defining a var 2020-07-12 18:40:01 +09:00
Hajime Hoshi
dcb693460e shader: Refactoring: Let parseDecl return statements 2020-07-12 15:51:06 +09:00
Hajime Hoshi
202bb34bac shaderir: Add builtin funcs dfdx, dfdy, fwidth
Fixes #1242
2020-07-11 21:50:10 +09:00
Hajime Hoshi
aecd29325e shaderir: Bug fix: Wrong function names for some bulitin funcs 2020-07-11 21:46:21 +09:00
Hajime Hoshi
776de77744 shaderir: Remove and rename some builtin functions
Apparently matrixCompMult and outerProduct are not portable.

We adopted the naming rule foobar instead of fooBar.
2020-07-11 21:43:24 +09:00
Hajime Hoshi
d217bc6033 ebiten: Sparate textures from uniforms at DrawTrianglesWithShader
Updates #1193
Updates #1239
2020-07-09 01:59:21 +09:00
Hajime Hoshi
914eb093f8 shader: Bug fix: Compile error on the test 2020-07-08 01:38:27 +09:00
Hajime Hoshi
4021c24534 shader: Separate uniform variables and texture variabls
Textures cannot be treated as a regular variable, then they should
be treated differently from other uniform variables.

Add a new function texture0At replacing texture2D.

Updates #1239
2020-07-08 01:12:07 +09:00
Hajime Hoshi
98ae0826c7 shaderir: Bug fix: Early-returns in the entry points didn't work
Fixes #1238
2020-07-05 17:57:57 +09:00
Hajime Hoshi
f4a72165e4 shader: Bug fix: Comparison with constants didn't work 2020-07-05 17:33:10 +09:00
Hajime Hoshi
3eaa7dd0e1 uidriver/glfw: Set No-API when creating a hidden window first
GLFW tries to create an OpenGL context by default when creating a
window. This is not necessary when OpenGL is not used. This is an
optimization by skipping to create an OpenGL context if possible.
2020-07-05 15:01:06 +09:00
Hajime Hoshi
8369a4cc15 shader: Bug fix: Wrong out-params when returning is in a block 2020-07-05 04:30:14 +09:00
Hajime Hoshi
ce4732a7dc shader: Treat if's 'init' part correctly
Updates #1230
2020-07-05 04:08:57 +09:00
Hajime Hoshi
f3651e23e4 shader: Bug fix: Some oeprators should be evaluated as bool 2020-07-05 03:29:34 +09:00
Hajime Hoshi
fb63df48ae shader: Better error message 2020-07-05 03:23:56 +09:00
Hajime Hoshi
380b7382ac shader: Add 'if'
Updates #1230
2020-07-05 02:33:49 +09:00
Hajime Hoshi
3ca6e41194 shader: Refactoring: Add statements later 2020-07-05 00:33:54 +09:00
Hajime Hoshi
b00666df22 shader: Refactoring: Split files 2020-07-04 23:47:23 +09:00
Hajime Hoshi
49b389c8b1 shader: Add tests for invalid binary expressions 2020-07-04 20:23:37 +09:00
Hajime Hoshi
f362455387 shader: Bug fix: correct type deduction from 'mat2*vec2'
Fixes #1236
2020-07-04 20:08:01 +09:00
Hajime Hoshi
6c33ed107f affine: Add more tests for (*ColorM).Invert 2020-07-04 01:58:37 +09:00
Hajime Hoshi
2e8e35750d affine: Refactoring 2020-07-04 01:36:48 +09:00
Gabriel Ochsenhofer
94b5747806
affine: Add functions to invert ColorM (#1233)
Fixes #548
2020-07-04 01:23:47 +09:00
Hajime Hoshi
d08f57e610 uidriver/glfw: Bug fix: Skip some special 'joysticks'
Apparently, there are some special devices that are recognized as
joysticks by GLFW, even though they are not. Such devices can have
too many 'buttons'. Skip them as a tentative solution.

Updates #1173
2020-07-03 22:58:49 +09:00
Hajime Hoshi
b7a1e85788 uidriver/glfw: Remove unused logics 2020-07-03 22:24:30 +09:00
Hajime Hoshi
02ef92f4cd ebiten: Remove copying pixels from ReplacePixels and copyImage (renamed to imageToBytes)
This optimization utilizes the fact that copying happens in the
'shareable' package to add paddings.

Updates #1222
2020-07-03 03:01:48 +09:00
Hajime Hoshi
b83f0acc4d Remove source-region information from vertices
Fixes #1210
2020-07-02 23:38:39 +09:00
Hajime Hoshi
71c9e7ac40 driver: Add Region and sourceRegion parameter at Draw
This is a preparation to remove source-region information from
vertices.

Updates #1210
2020-07-02 03:26:05 +09:00
Hajime Hoshi
4c640d2500 buffered, restorable: Remove copying pixels
Instead, the callers (ebiten.NewImageFromImage and
(*ebiten.Image).ReplacePixels) have responsibility to copy the
pixels now. This change should reduce unnecessary copying pixels.

Updates #1222
2020-07-01 02:56:40 +09:00
Hajime Hoshi
f636cdf5f7 testing: Bug fix: Wrong uniform variables 2020-06-30 01:49:40 +09:00
Hajime Hoshi
8c5f8c03b7 buffered: Refactoring 2020-06-30 01:16:50 +09:00
Hajime Hoshi
999b726b72 shareable: Bug fix: The first image's region in the uniform vriables was ignored 2020-06-30 00:50:40 +09:00
Hajime Hoshi
1fe2f47701 graphicscommand: Remove the source-region parts from the uniform variables 2020-06-30 00:44:05 +09:00
Hajime Hoshi
780465b702 ebitenutil: Cache ColorM and reuse them at DrawRect
Fixes #1221
2020-06-29 22:35:28 +09:00
Hajime Hoshi
09322dfdc8 buffered: Avoid creating func objects whenever possible
Fixes #1220
2020-06-29 21:50:32 +09:00
Hajime Hoshi
dea3785750 shareable, restorable, graphicscommand: Remove making arrays at DrawTriangles
Updates #1220
2020-06-29 13:37:37 +09:00
Hajime Hoshi
ebd0e11c0d graphicsdriver/metal: Avoid synching texture data at ReplacePixels
Instead, use a temporary texture, transfer texture data to it, and
copy the data on GPU side.
2020-06-28 19:40:37 +09:00
Hajime Hoshi
383ff1e6a7 shareable: Use as big backends as possible
As the shader hack is removed at d74f7d3a77,
any sizes of textures should work regardless of the float precision.
2020-06-28 04:14:55 +09:00
Hajime Hoshi
aea4630b5f Revert "buffered: Defer ReplacePixels when possible"
This reverts commit 1395ab5e84.

Reason: This increases the number of ReplacePixels aggressively.
2020-06-28 02:49:55 +09:00
Hajime Hoshi
36515eb1f5 Revert "ebiten: Make ebiten.Image and buffered.Image 1:1"
This reverts commit 620981a09a.

Fixes #1218
Updates #896
2020-06-28 01:01:39 +09:00
Hajime Hoshi
7e01ba17c1 shareable: Bug fix: wrong size calculation
The size calculation must consider the paddings.

Fixes #1217
2020-06-27 17:21:26 +09:00
Hajime Hoshi
00e8b701c1 graphicsdriver/metal: Optimization 2020-06-27 04:14:21 +09:00
Hajime Hoshi
2bc1475a15 graphicsdriver/metal: Bug fix: Sync textures before replacing a region
Updates #1213
2020-06-27 03:08:17 +09:00
Hajime Hoshi
7b6182d05a shareable: Update comments 2020-06-27 02:46:29 +09:00
Hajime Hoshi
5a176d6f4f graphicsdriver/metal: Bug fix: synchronizing must be skipped on iOS 2020-06-27 01:45:14 +09:00
Hajime Hoshi
9f76b96c1f graphicsdriver/metal: Specify the texture type explicitly 2020-06-26 23:46:12 +09:00
Hajime Hoshi
a1abe6b728 restorable: Add padding when renderingn the empty image 2020-06-26 14:01:49 +09:00
Hajime Hoshi
198621404f buffered: Bug fix: Pixel data was not invalidated after DrawImage/Triangles 2020-06-25 13:11:19 +09:00
Hajime Hoshi
4a7929cf71 buffered: Bug fix: Duplicated calls of resolvePendingPixels 2020-06-25 04:08:24 +09:00
Hajime Hoshi
d3613e13af graphicsdriver/opengl: Fix comments 2020-06-25 01:06:30 +09:00
Hajime Hoshi
2a63512c6e driver: Add AddressUnsafe
This skips the source-region check and reduces 'if' branches from
shader programs.

AddressUnsafe is internal only so far. We might expose this value
later.

Updates #1210
2020-06-25 01:00:38 +09:00
Hajime Hoshi
bfc2fffba6 graphicsdriver/opengl: Move comments 2020-06-24 23:52:39 +09:00
Hajime Hoshi
20b5be0886 graphicsdriver: Bug fix: Tie-breaking when picking a texel
When a texel is picked on texel-borders of a texture, the behavior
(tie-breaking) depends on GPU and unexpected. This change fixes this
issue by shifting 1/512 [texel] when picking a texel up.

Updates #1212
2020-06-24 20:51:16 +09:00
Hajime Hoshi
545342262f examples/shader: Show an image 2020-06-24 01:41:27 +09:00
Hajime Hoshi
f10263fff7 shader: Bug fix: Test failures 2020-06-21 22:32:54 +09:00
Hajime Hoshi
c36d2165e6 shader: Parse number literals in unary expressions correctly
Fixes #1190
2020-06-21 21:47:27 +09:00
Hajime Hoshi
29b70bea95 shader: Parse number literals in binary expressions correctly
Updates #1190
2020-06-21 21:32:40 +09:00
Hajime Hoshi
afc39a100c shader: Reduce the calls of parseExpr so that unneeded variables are reduced 2020-06-21 16:39:26 +09:00
Hajime Hoshi
ac9bb92885 shader: Refactoring: Reduce calls of parseExpr at definings 2020-06-21 05:26:23 +09:00
Hajime Hoshi
40e581c19f shader: Allow to mix an int and a float in a binary expression
Updates #1190
2020-06-21 03:34:55 +09:00
Hajime Hoshi
eb136daa39 testing: Bug fix: Compile error 2020-06-21 02:26:59 +09:00
Hajime Hoshi
ea9fae1faa shader: Abort parsing correctly when an error is found 2020-06-21 02:18:21 +09:00
Hajime Hoshi
912135d1e7 shaderir: Use constant.Value for number literals
Updates #1190
2020-06-21 01:30:23 +09:00
Hajime Hoshi
4b5de9f445 shaderir: Refactoring: Add OpFromToken 2020-06-20 23:27:54 +09:00
Hajime Hoshi
28948a9976 shaderir: Add (*Type).serialize again 2020-06-20 21:08:08 +09:00
Hajime Hoshi
255da0367f shader: Bug fix: a binary expression for an int and a float did not work 2020-06-20 18:10:23 +09:00
Hajime Hoshi
5e0e12d290 shader: Bug fix: Resolve types in a binary expression correctly 2020-06-20 17:49:23 +09:00
Hajime Hoshi
f36d6c02a9 shader: Refactoring: Remove detectType 2020-06-20 17:20:44 +09:00
Hajime Hoshi
3da0af5de2 shader: Make parseExpr return types
Updates #1190
2020-06-19 03:19:07 +09:00
Hajime Hoshi
afb4e6dc3d shaderir: Misspelling 2020-06-18 01:28:17 +09:00
Hajime Hoshi
b620b4334e buffered: Bug fix: Corner case of the race condition
Updates #1195
2020-06-17 03:31:54 +09:00
Hajime Hoshi
0beddf5519 buffered: Bug fix: Race condition at checkDealeydCommandsNil
This change also renames checkDealeydCommandsNil to
checkDealeydCommandsFlushed, which makes more sense.

Updates #1195
2020-06-17 03:19:35 +09:00
Hajime Hoshi
2869885816 shaderir: Fix the initial variable values on GLSL
This is for consistency with number literals we are introducing.

Updates #1190
2020-06-17 01:59:02 +09:00
Hajime Hoshi
d9cf1095d4 buffered: Bug fix: Race conndition on delayedCommands
This CL fixes the race condtion on delayedCommands, which can be
accessed and set to nil at the same time.

This CL separates some operations for delayedCommands into slow-
paths and fast-paths, and use mutex only at slow-paths for
performance. The implementation is based on sync.Once.

Fixes #1195
2020-06-16 23:22:18 +09:00
Hajime Hoshi
1735dda586 shareable: Rename border -> padding 2020-06-16 12:48:20 +09:00
Hajime Hoshi
484473b6d9 graphicscommand: Span to 1/3 pixels
The center of pixels is problematic as the behavior depends on GPU.
In order to avoid this, align the vertices with about 1/3 pixels.

Updates #929
Fixes #1171
2020-06-16 03:56:53 +09:00
Hajime Hoshi
1785b6a670 examples/moire: Add a smaller scale, and remove AdjustTexel function from shaders
This can reproduce the bug reported at #669.

Apparently, the fix (8827520d4a) is
no longer required after 3550abef7a.
That's pretty odd, but examples/moire proves this fact.

Updates #669
Updates #759
2020-06-15 00:29:34 +09:00
Hajime Hoshi
d74f7d3a77 shareable: Add gaps between images
After this change, each image on the texture atlases has a
transparent border around it.

This change removes the hack to round texels not to violate the
source regions.

Fixes #1194
Updates #1171
2020-06-14 18:05:41 +09:00
Hajime Hoshi
22919909d7 shareable: Refactoring 2020-06-14 15:30:03 +09:00
Hajime Hoshi
d98713728a uidriver/glfw: Bug fix: SetVsyncEnabled(false) did not work before the main loop
Fixes #1197
2020-06-14 11:50:58 +09:00
Hajime Hoshi
620981a09a ebiten: Make ebiten.Image and buffered.Image 1:1
This change creates a new buffered.Image even for a sub-image. This
can increase a memory usage a little, but decrease the GPU memory
usage since only the necessary pixels are allocated on a texture
atlas.

Fixes #896
Updates #1194
2020-06-14 11:15:38 +09:00
Hajime Hoshi
e023425be0 graphicsdriver/metal: Reduce calls of SetLayer 2020-06-14 05:07:33 +09:00
Hajime Hoshi
1395ab5e84 buffered: Defer ReplacePixels when possible 2020-06-14 04:41:51 +09:00
Hajime Hoshi
cf3436da21 buffered: Skip filling operation if possible 2020-06-14 04:17:57 +09:00
Hajime Hoshi
96fa0565e4 buffered: Remove mutex and use sync/atomic for performance
This change also enables to remove the optimization at
(*buffered.Image).ReplacePixels.

  // This commit w/ the optimization
  BenchmarkImageDrawOver-8           60225             19241 ns/op

  // This commit w/o the optimization
  BenchmarkImageDrawOver-8           66567             17700 ns/op

  // The previous w/ the optimization
  BenchmarkImageDrawOver-8           62355             19580 ns/op

  // The previous w/o the optimization
  BenchmarkImageDrawOver-8           54460             22768 ns/op

Updates #1137
2020-06-14 01:16:23 +09:00
Hajime Hoshi
40906676e6 buffered: Add 'Pixels' and remove 'At'
This is a preparation to make shareable.Image and ebiten.Image 1:1
Now sub-images doesn't have its own shareable.Image.

Updates #896
Updates #1194
2020-06-13 21:01:50 +09:00
Hajime Hoshi
d04fdbde61 shader: Add more tests 2020-06-11 23:26:32 +09:00
Hajime Hoshi
f39c591252 shader: Enable more Go syntax 2020-06-11 01:13:03 +09:00
Hajime Hoshi
4a60c01f03 shader: Implement assigning 2020-06-10 22:29:45 +09:00
Hajime Hoshi
d0027ebc5f shader: Bug fix: Skip tests on browsers
With wasmbrowsertest, file system is not available.
2020-06-08 12:32:15 +09:00
Hajime Hoshi
91fb8e92d8 shader: Implment defining variables in multiple-value context 2020-06-08 12:15:09 +09:00
Hajime Hoshi
75706504bf shader: Add testdata directory 2020-06-08 11:18:27 +09:00
Hajime Hoshi
acba49952c shaderir: Add a test for nested function calls 2020-06-08 02:19:37 +09:00
Hajime Hoshi
399bb93044 shaderir: Add space lines between functions 2020-06-08 01:41:47 +09:00
Hajime Hoshi
84fb951729 shader: Implement variable initialization in multiple-value context 2020-06-08 01:33:12 +09:00
Hajime Hoshi
1ca5dd16b2 shader: Let parseExpr return multiple values 2020-06-08 01:17:11 +09:00
Hajime Hoshi
bee79e3b67 shader: Refactoring 2020-06-07 23:50:53 +09:00
Hajime Hoshi
2c1e71931e shader: Move some functions 2020-06-07 23:33:47 +09:00
Hajime Hoshi
3fd8062fbe shader: Let detectType return multiple types 2020-06-07 23:32:50 +09:00
Hajime Hoshi
c986da8970 shader: Implement function call 2020-06-07 22:23:20 +09:00
Hajime Hoshi
2ffbd49602 shader: Use shaderir.Type instead of typ struct 2020-06-07 22:06:06 +09:00
Hajime Hoshi
9a5481459a shaderir: Remove inout params 2020-06-07 19:24:27 +09:00
Hajime Hoshi
e64c806698 shader: Let parseExpr return statements for Call 2020-06-07 19:24:27 +09:00
Hajime Hoshi
6d779965f9 shader: Fix misspelling 2020-06-07 17:03:40 +09:00
Hajime Hoshi
869a61d9be shader: Parse initial values of variables 2020-06-07 16:25:04 +09:00
Hajime Hoshi
e14cd559b6 shader: Remove variable.init 2020-06-07 05:20:04 +09:00
Hajime Hoshi
147c82f212 shader: Bug fix: Test compile error 2020-06-07 00:52:51 +09:00
Hajime Hoshi
ba36d5a8e9 shader: Reland: Add a predefined uniform variable: __viewportSize 2020-06-07 00:14:09 +09:00
Hajime Hoshi
dde7d00231 shader: Accept an ast directly
This is a preparation to modify the AST before passign to Compile.
2020-06-06 23:12:01 +09:00
Hajime Hoshi
fe308f1971 Revert "shader: Add a predefined uniform variable: Internal_ViewportSize"
This reverts commit 6f411842f0.

Reason: Test failures on internal/restorable
2020-06-05 04:36:09 +09:00
Hajime Hoshi
6f411842f0 shader: Add a predefined uniform variable: Internal_ViewportSize 2020-06-05 03:00:43 +09:00
Hajime Hoshi
3dbf4c0a83 shader: Enable to specify entrypoint names 2020-06-05 01:11:39 +09:00
Hajime Hoshi
2f843c49a6 shader: Fix the case when the source image is nil for shaders 2020-06-04 01:35:35 +09:00
Hajime Hoshi
fc44589705 shader: Format 2020-06-03 23:58:05 +09:00
Hajime Hoshi
762b9788a0 shader: Parse fragment entry point 2020-06-03 23:56:08 +09:00
Hajime Hoshi
382ba75139 shader: Enable to put global variables anywhere 2020-06-03 23:19:07 +09:00
Hajime Hoshi
39c09a4f88 shaderir: Change the param order of fragment shaders 2020-06-03 02:01:50 +09:00
Hajime Hoshi
cd3d396975 shader: Implement vertex shader entry point 2020-06-03 01:03:27 +09:00
Hajime Hoshi
fa5b2ed730 shaderir: Change the param order 2020-06-03 00:46:52 +09:00
Hajime Hoshi
3118657fff shaderir: Fix integer literals 2020-06-02 21:45:33 +09:00
Hajime Hoshi
909ba638a3 shader: Add more shadowing tests 2020-06-01 03:24:43 +09:00
Hajime Hoshi
37cc30bc38 shader: Add define (:=) 2020-06-01 02:23:27 +09:00
Hajime Hoshi
6fa7b4bb5a shader: Analyze blocks and shadowings 2020-06-01 00:58:33 +09:00
Hajime Hoshi
5de0493294 shader: Implement multiple out params 2020-05-31 19:20:53 +09:00
Hajime Hoshi
afd114e606 shader: Parse function bodies 2020-05-31 19:03:33 +09:00
Hajime Hoshi
91e5dde320 shader: Parse return 2020-05-31 18:01:12 +09:00
Hajime Hoshi
ddba8a911f shader: Parse function signatures 2020-05-31 16:20:36 +09:00
Hajime Hoshi
5ea5dfccfc shader: Remove stmt 2020-05-31 02:23:51 +09:00
Hajime Hoshi
1ede103ce6 shader: Add tests for uniform variables 2020-05-31 02:06:41 +09:00
Hajime Hoshi
e7323e04bf shader: Remove sorting 2020-05-31 01:47:12 +09:00
Hajime Hoshi
8cb70062b7 shader: Remove dumping and original types 2020-05-31 01:25:24 +09:00
Hajime Hoshi
eb1b06c326 graphicscommand: Adjust texels 2020-05-30 22:41:14 +09:00
Hajime Hoshi
e25a6f4d46 graphicsdriver/opengl: Remove isTexture on desktops 2020-05-30 20:56:13 +09:00
Hajime Hoshi
2bdef2e8c4 restorable: Add an explicit way to detect context-lost
isTexture was used to detect context-lost and called every frame.
This was not good for performance.

This change adds a way to notify context-lost from the WebGL
handlers directly, and the package restorable uses it instead of
calling (*Image).isInvalaidated.

Fixes #1175
2020-05-30 20:29:15 +09:00
Hajime Hoshi
117fd61d27 restorable: Do not dispose objects when restoring on browsers
This fix suppresses warnings on the Chrome console.
2020-05-30 19:24:03 +09:00
Hajime Hoshi
1042eb71e0 shaderir: Rename Sampler2D -> Texture2D 2020-05-30 17:48:56 +09:00
Hajime Hoshi
c0cd7ec59c restorable: Update comments 2020-05-30 16:06:22 +09:00
Hajime Hoshi
b2eee7ee8a graphicscommand: Adjust regions for secondory and following images correctly 2020-05-30 15:52:56 +09:00
Hajime Hoshi
915aecb960 graphicscomand: Fix comments 2020-05-30 15:08:28 +09:00
Hajime Hoshi
90e03a65c0 graphicscommand: Update comments 2020-05-30 05:19:49 +09:00
Hajime Hoshi
833a364ba8 testing: Bug fix: Image's size should not be in uniform variables 2020-05-30 05:16:50 +09:00
Hajime Hoshi
f92253487f buffered: Add Shader 2020-05-30 03:36:28 +09:00
Hajime Hoshi
218b6fc172 mipmap: Add Shader 2020-05-29 04:12:41 +09:00
Hajime Hoshi
18c59e44aa shareable: Allow multiple call of (*Shader).Dispose 2020-05-29 03:47:06 +09:00
Hajime Hoshi
9c637c65be shareable: Add Shader 2020-05-29 00:15:42 +09:00
Hajime Hoshi
1c980a16f5 graphicsdriver/opengl: Ignore non-existent uniform locations
Shader users should not have to care about the existence of uniform
variables.

Updates #1168
2020-05-27 11:39:11 +09:00
Hajime Hoshi
f80719ef9a driver: Use slices for uniform variables instead of maps
Fixes #1172
2020-05-26 23:50:11 +09:00
Hajime Hoshi
f14f3b6456 restorable: Fix comments 2020-05-26 00:28:00 +09:00
Hajime Hoshi
7b9cc8deb4 restorable: Add tests to dispose shaders
When a shader is disposed, all the images depending on it should
become stale, i.e., discard its all the rendering history items,
because they cannot be restored due to the lack of data on the GPU.
2020-05-26 00:20:11 +09:00
Hajime Hoshi
8e6f19b37a restorable: Add a test using shaders with multiple sources 2020-05-25 23:57:55 +09:00
Hajime Hoshi
ca73f17dd4 restorable: Bug fix: Fill didn't invalidate its dependencies
Fixes #1170
2020-05-25 23:37:25 +09:00
Hajime Hoshi
1cfc1964bf graphicsdriver/opengl: Bug fix: fmt arguments 2020-05-25 02:36:45 +09:00
Hajime Hoshi
8738d182fb restoreble: Add test with shaders rendering an image
Updates #1168
2020-05-25 02:32:23 +09:00
Hajime Hoshi
85730b433e graphicsdriver: Bug fix: Pass texture natives as uniform variables correctly 2020-05-25 02:31:54 +09:00
Hajime Hoshi
732f288d20 restorable: Add Shader (WIP) 2020-05-25 00:50:01 +09:00
Hajime Hoshi
9bf24ba545 graphicsdriver/opengl: Remove println and add error messages 2020-05-24 23:15:00 +09:00
Hajime Hoshi
fc50f9b0be testing: Refactoring 2020-05-24 22:30:11 +09:00
Hajime Hoshi
155c63ec76 graphicscommand: Move the shader program to testing package 2020-05-24 20:15:07 +09:00
Hajime Hoshi
465d8aa273 graphicscommand: Add IsShaderAvailable for other packages 2020-05-24 19:15:18 +09:00
Hajime Hoshi
c5aba02723 graphicscommand: Update comments 2020-05-24 16:54:28 +09:00
Hajime Hoshi
6506c20f4e graphicscommand: Use an image in the uniform variables 2020-05-24 16:43:08 +09:00
Hajime Hoshi
968c0a9b9a graphicscommand: Bug fix: test failures 2020-05-24 03:04:52 +09:00
Hajime Hoshi
d94b84b8de graphciscommand: Add coments 2020-05-24 02:51:37 +09:00
Hajime Hoshi
a4d419bab1 graphicscommand: Merge DrawTriangles and DrawShader 2020-05-24 02:36:09 +09:00
Hajime Hoshi
3ed9f8ee3b shaderir: Update comments 2020-05-24 02:07:57 +09:00
Hajime Hoshi
3306a957ba graphicscommand: Skip the shader test on browsers
Updates #482
2020-05-23 22:41:06 +09:00
Hajime Hoshi
521f9dcac5 graphicsdriver/opengl: Bug fix: deleted a wrong shader program
Updates #482
2020-05-23 22:40:49 +09:00
Hajime Hoshi
1a0d92267b driver: Add shader API and implement it on OpenGL
Updates #482
2020-05-23 22:09:12 +09:00
Hajime Hoshi
14e90a34aa shaderir: Add more builtin functions 2020-05-23 22:01:10 +09:00
Hajime Hoshi
f38ca35608 shaderir: Remove attribute variables from fragment shaders 2020-05-23 19:06:44 +09:00
Hajime Hoshi
125f85effe shaaderir: Use gl_FragColor 2020-05-23 18:18:22 +09:00
Hajime Hoshi
da4d5b1338 shaderir: Add more builtin functions 2020-05-23 18:07:32 +09:00
Hajime Hoshi
7937b302e3 shaderir: Do not use () for the callees 2020-05-23 18:06:50 +09:00
Hajime Hoshi
7b960a2df4 uidriver/glfw: Use the actual window size for the offscreen
On Windows, a specified window size might not match with the
actual window size when the size is too big. In this case, Ebiten
could not render the offscreen well and the upper side was cropped.

To avoid this, use the actual window size for the offscreen.

Fixes #1163
2020-05-22 18:18:38 +09:00
Hajime Hoshi
a338c7180c shaderir: Split vertex shader and fragment shader at Glsl() 2020-05-21 23:58:08 +09:00
Hajime Hoshi
8fd377f1e3 driver: Add ImageID and use this
This is a preparation to introduce shaders. Shader programs
require images as uniform variables, but the current way would make
API complex unnecessarily.
2020-05-20 00:11:08 +09:00
Hajime Hoshi
7ccc29e3c7 uidriver/js: Clean up 2020-05-19 04:08:33 +09:00
Hajime Hoshi
be1a8bddbf uidriver/js: Bug fix: Create goroutine for a function passed to rAF
This is necessary not to cause dead-lock.

Updates #1161
2020-05-19 03:28:20 +09:00
Hajime Hoshi
7f2092f964 graphicsdriver/opengl: Enable to bind multiple textures (in theory) 2020-05-17 23:57:42 +09:00
Hajime Hoshi
733c463e26 graphicsdriver/opengl: Treat a texture as a uniform variable 2020-05-17 23:25:49 +09:00
Hajime Hoshi
68ef41e256 graphicsdriver/opengl: Integrate uniform variables 2020-05-17 20:20:29 +09:00
Hajime Hoshi
ff311dd564 graphicsdriver/opengl: Pass uniform values to useProgram 2020-05-17 19:43:01 +09:00
Hajime Hoshi
84e2c6f994 graphicsdriver/opengl/gl: Bug fix: misuse of unsafe.Pointer 2020-05-17 19:42:23 +09:00
Hajime Hoshi
8ab12827c0 graphicsdriver/opengl: Refactoring 2020-05-17 19:01:46 +09:00
Hajime Hoshi
9cc128fb40 graphicsdriver/opengl: Integrate last uniform values 2020-05-17 18:36:33 +09:00
Hajime Hoshi
d12b406e0a graphicsdriver/opengl: Remove unused variables 2020-05-17 18:15:27 +09:00
Hajime Hoshi
29dbad28f9 shaderir: Add new lines 2020-05-17 17:06:21 +09:00
Hajime Hoshi
f4a1f90d92 graphicsdriver/opengl/gl: Reduce reflect usage 2020-05-17 14:28:13 +09:00
Hajime Hoshi
156ed320cc shaderir: Remove Variable and VariableType 2020-05-17 04:28:03 +09:00
Hajime Hoshi
094d845edd shaderir: Remove Ident 2020-05-17 03:00:57 +09:00
Hajime Hoshi
dbbe4ee09c shaderir: Add StructMember 2020-05-17 02:46:02 +09:00
Hajime Hoshi
8a6140a92f shaderir: Refactoring 2020-05-17 02:45:03 +09:00
Hajime Hoshi
e1d0800f19 shaderir: Bug fix: Wrong implementation of isValidSwizzling 2020-05-17 02:25:37 +09:00
Hajime Hoshi
7e274050a3 shaderir: Add swizzling 2020-05-17 02:24:35 +09:00
Hajime Hoshi
7648271eff shaderir: Implement bulit-in functions 2020-05-17 00:33:22 +09:00
Hajime Hoshi
6553c237a1 shaderir: Add comments 2020-05-16 23:42:32 +09:00
Hajime Hoshi
8f4e93338c shaderir: Implement sampler2D 2020-05-16 23:33:20 +09:00
Hajime Hoshi
316e502f4b shaderir: Add predefined macros 2020-05-16 23:29:01 +09:00
Hajime Hoshi
66e76597d8 shaderir: Implement fragment function 2020-05-16 23:07:24 +09:00
Hajime Hoshi
ddaed674dd shaderir: Implement vertex function 2020-05-16 22:50:20 +09:00
Hajime Hoshi
eb5a2efad8 shaderir: Implement return 2020-05-16 20:16:04 +09:00
Hajime Hoshi
57d80c185e shaderir: Implement call 2020-05-16 19:19:16 +09:00
Hajime Hoshi
5b69e81bd7 shaderir: Add more tests 2020-05-16 18:09:09 +09:00
Hajime Hoshi
af5249de4d shaderir: Implement selector operator 2020-05-16 17:22:17 +09:00
Hajime Hoshi
d4d43ce193 shaderir: Allow specifying op for 'for' loop 2020-05-16 15:51:54 +09:00
Hajime Hoshi
9f4985943c shaderir: Allow integer literals 2020-05-16 03:40:33 +09:00
Hajime Hoshi
3cffe88334 shaderir: Add for-loop 2020-05-16 03:10:03 +09:00
Hajime Hoshi
931fec9100 shaderir: Refactoring 2020-05-15 03:37:14 +09:00
Hajime Hoshi
4b8e745824 shaderir: Refactoring 2020-05-15 03:12:23 +09:00
Hajime Hoshi
e6d78abd11 shaderir: Implement 'if' 2020-05-15 02:35:58 +09:00
Hajime Hoshi
71ee622997 shaderir: Use auto names for variables 2020-05-15 01:29:39 +09:00
Hajime Hoshi
1ed004ae05 shaderir: Avoid duplications of local variable names 2020-05-14 03:52:36 +09:00
Hajime Hoshi
32a88b3b03 shaderir: Add Return 2020-05-14 03:14:56 +09:00
Hajime Hoshi
d932787e36 shaderir: Add parsing expr and stmt 2020-05-14 02:13:10 +09:00
Hajime Hoshi
c75a35fd64 shaderir: Add more tests 2020-05-14 01:07:53 +09:00
Hajime Hoshi
3d7c102472 shaderir: Add func params 2020-05-13 23:31:17 +09:00
Hajime Hoshi
a3105d6fca shaderir: Add more tests 2020-05-13 02:10:59 +09:00
Hajime Hoshi
a5d570a7a8 Add shaderir 2020-05-12 01:18:18 +09:00
Hajime Hoshi
6d182c4b55 shader: Parse structs 2020-05-11 00:43:17 +09:00
Hajime Hoshi
90fdececa0 shader: Refactoring 2020-05-11 00:00:21 +09:00
Hajime Hoshi
ba9d27b8ba shader: Rename type -> basicType 2020-05-10 23:28:05 +09:00
Hajime Hoshi
02eafb2929 shader: Forbid unexported global variables 2020-05-10 21:57:12 +09:00
Hajime Hoshi
a39376ad47 shader: Add stmtBlock 2020-05-10 21:45:12 +09:00
Hajime Hoshi
73255f4663 shader: Add more tests 2020-05-10 20:41:43 +09:00
Hajime Hoshi
8ede0b3891 shader: Bug fix: fix tests 2020-05-10 19:48:24 +09:00
Hajime Hoshi
b78194afd5 shader: Detect types from rhs 2020-05-10 19:37:09 +09:00
Hajime Hoshi
9430b6be37 shader: Parse assignments 2020-05-10 02:27:14 +09:00
Hajime Hoshi
1a7da0bc63 shader: Do not sort variables since the order matters 2020-05-10 01:21:34 +09:00
Hajime Hoshi
eaf93a532f shader: Unify parsing decls 2020-05-10 01:05:57 +09:00
Hajime Hoshi
4742c49c21 shader: Separate variable and constant 2020-05-10 00:39:26 +09:00
Hajime Hoshi
8b2a22fb47 shader: Parse return 2020-05-10 00:23:40 +09:00
Hajime Hoshi
5e6be91eac shader: Parse block variables 2020-05-09 23:45:53 +09:00
Hajime Hoshi
e848eacedf shader: Parse arguments and returns 2020-05-09 19:21:01 +09:00
Hajime Hoshi
7ba434ad6d shader: Start parsing functions 2020-05-09 18:05:55 +09:00
Hajime Hoshi
1b2c29f6f3 shader: Refactoring 2020-05-09 17:32:10 +09:00
Hajime Hoshi
195c51fe51 shader: Rename test name 2020-05-09 17:19:05 +09:00
Hajime Hoshi
00b32a663e shader: Add token positions to the error message 2020-05-09 16:47:07 +09:00
Hajime Hoshi
c8045210ac shader: Fix comments 2020-05-09 05:13:43 +09:00
Hajime Hoshi
fc0604805a shader: Parse constants 2020-05-09 04:21:45 +09:00
Hajime Hoshi
ffae970c26 shader: Parse uniform and global variables 2020-05-09 03:38:37 +09:00
Hajime Hoshi
b3df3a7864 Add shader package
Updates #482
2020-05-09 01:11:40 +09:00
Hajime Hoshi
4fa52dcc56 Remove MonoGame support
Fixes #1148
2020-05-08 19:32:28 +09:00
Hajime Hoshi
274245e39c graphicsdriver/metal: Refactoring: Invert the viewport's Y direction 2020-05-08 18:12:30 +09:00
Hajime Hoshi
8029dc352a driver: Use framebuffer's Y directions 2020-05-08 16:49:19 +09:00
Hajime Hoshi
c43ba6e17d graphicsdriver/metal: Update comments 2020-05-08 05:49:38 +09:00
Hajime Hoshi
7068eb9284 graphicsdriver/metal: Simplify the projection matrix 2020-05-08 05:06:09 +09:00
Hajime Hoshi
cfe1aa1191 monogame: Add a variable for a namespace that will be overwritten 2020-04-24 16:46:56 +09:00
Hajime Hoshi
9b8c547342 graphicscommand: Do not flush (glFlush) when commands are empty
Fixes #1140
2020-04-23 00:51:28 +09:00
Hajime Hoshi
7ad3343e9c graphicsdriver/monogame: Implement Pixels
Updates #1078
2020-04-22 02:23:16 +09:00
Hajime Hoshi
33e850a6d4 driver: Bug fix: (Key).String might cause infinite loop 2020-04-22 00:32:35 +09:00
Hajime Hoshi
0e75540f8e monogame: Add IsKeyPressed
Updates #1078
2020-04-21 22:48:57 +09:00
Hajime Hoshi
ea99743e0d driver: Add (Key).String() 2020-04-21 22:43:53 +09:00
Hajime Hoshi
691e42f806 graphicsdriver/monogame: Bug fix: An underlying image size should be adjusted 2020-04-21 02:43:47 +09:00
Hajime Hoshi
bbf9b219ec buffered: Skip mutex at ReplacePixels when possible
Updates #1137
2020-04-19 00:18:19 +09:00
Hajime Hoshi
3550abef7a shareable: Replace At with Pixels
This change replaces the API At with Pixels to reduce mutex locks.

Updates #1137
2020-04-18 21:05:51 +09:00
Hajime Hoshi
bbeb0d14e6 buffered: Defer filling an image
This change defers filling an image so that successive fillings
can be merged into one for more efficient rendering.

Fixes #1134
2020-04-18 02:11:25 +09:00
Hajime Hoshi
514c3faebd buffered: Remove unnecessary line and add comments 2020-04-17 21:50:42 +09:00
Hajime Hoshi
b9e0b5f04b graphicsdriver/monogame: Change the V direction 2020-04-17 21:36:59 +09:00
Hajime Hoshi
1d701577d6 buffered: Use the pending pixels when possible at At
(*Image).At can be unnecessarily slow since this tries to get
pixels from GPU. This change reduces the chance to read GPU by
using its pending pixels when possible.

Fixes #1137
2020-04-17 21:34:49 +09:00
Hajime Hoshi
4dad044ad1 monogame: Update
Updates #1078
2020-04-16 01:10:16 +09:00
Hajime Hoshi
de02bcf19f monogame: Update
Updates #1078
2020-04-14 03:23:54 +09:00
Hajime Hoshi
7b77164710 restorable: Ignore the error when restoring failed due to being not ready
(driver.Graphics).BeginFrame tries to restore the images, but
the context might be lost at that time yet. If the attempt to
restore the context because the driver is not ready, return
silently.

Fixes #1133
2020-04-12 20:01:18 +09:00
Hajime Hoshi
d0115f61ae graphicsdriver/monogame: Bug fix: Wrong viewport values 2020-04-11 18:56:50 +09:00
Hajime Hoshi
3437f35444 graphicscommand: Fix debug messages 2020-04-08 13:48:22 +09:00
Hajime Hoshi
f0c2c0e8e9 monogame: Set viewports
Updates #1078
2020-04-06 02:36:15 +09:00
Hajime Hoshi
7f64043ba5 monogame: Implement drawing screens
Updates #1078
2020-04-06 01:51:06 +09:00
Hajime Hoshi
7dd9150b86 monogame: Implement Draw temporarily
Updates #1078
2020-04-06 00:13:08 +09:00
Hajime Hoshi
44088cf14e monogame: Implement SetVertices
Updates #1078
2020-04-05 23:26:45 +09:00
Hajime Hoshi
08ac91fb50 monogame: Refactoring 2020-04-05 20:00:53 +09:00
Hajime Hoshi
3a5f0a7a95 graphicsdriver/monogame: Implement some functions
Updates #1078
2020-04-05 17:36:26 +09:00
Hajime Hoshi
fa90e48eec graphicscommand: Show the number of indices when dumping the command 2020-04-05 14:38:54 +09:00
Hajime Hoshi
57a5783ca0 graphicsdriver/monogame: Implement ReplacePixels
Updates #1078
2020-04-05 04:44:48 +09:00
Hajime Hoshi
8809076682 graphicsdriver/monogame: Create a RenderTarget2D for an image
Updates #1078
2020-04-04 22:59:55 +09:00
Hajime Hoshi
6236ba1f00 Add internal/monogame
Updates #1078
2020-04-04 22:59:13 +09:00
Hajime Hoshi
eabe4152a7 graphicsdriver/opengl: Rename Driver -> Graphics 2020-04-04 17:23:38 +09:00
Hajime Hoshi
01d1afa25c graphicsdriver/metal: Rename Driver -> Graphics 2020-04-04 17:12:24 +09:00
Hajime Hoshi
6cbf37e855 Add graphicsdriver/monogame 2020-04-04 17:03:45 +09:00
Hajime Hoshi
8777140e91 driver: Simplify UIContext.Update 2020-04-03 00:18:27 +09:00
Hajime Hoshi
9b0d95cfcf clock: Integrate now.go and now_js.go
The monotonic timer already uses performance.now, then we don't
have to have the original code.
2020-04-02 01:52:00 +09:00
Hajime Hoshi
4179e6c122 Introduce 'monogame' build tag experimentally
Updates #1078
2020-04-01 23:42:17 +09:00
Hajime Hoshi
5ad9868d85 driver: Refactoring: Reorder functions 2020-04-01 21:28:00 +09:00
Hajime Hoshi
ab94cebd02 buffered: Use RunGame for tests 2020-04-01 18:32:14 +09:00
Hajime Hoshi
16280e9a5a testing: Use RunGame 2020-04-01 18:21:35 +09:00
Hajime Hoshi
47d5c3b5e1 Add testing package 2020-04-01 18:10:48 +09:00
Hajime Hoshi
a718ddbf7e driver: Add UIDriver.Draw
This is a preparation for XNA.

Updates #1078
2020-04-01 02:55:50 +09:00
Hajime Hoshi
ef5e917feb shareable: Remove old comments
This was introduced at cbf36734f8,
but the situation was changed at 9d867850dc
2020-04-01 00:58:33 +09:00
Hajime Hoshi
7ac6b0bfa3 Update dependencies 2020-03-31 03:32:38 +09:00
Hajime Hoshi
9a14d2fb14 thread: Fix comments
Fixes #1121
2020-03-29 16:27:12 +09:00
Hajime Hoshi
41d07706ae Revert "thread: Close channels"
This reverts commit 00e78c1eae.

Reason: (*Thread).Loop can be called multiple times on iOS.

Fixes #1121
2020-03-29 16:25:42 +09:00
Hajime Hoshi
b09fe7157b uidriver/glfw: Update comments 2020-03-29 01:33:23 +09:00
Hajime Hoshi
e3def4ae50 uidriver/glfw: Update comments 2020-03-29 01:12:53 +09:00
Hajime Hoshi
9d5c35f029 uidriver/glfw: Bug fix: Initilizing the window position and the size in this order on Windows
It looks like the order is different on Windows from Linux. We
are not sure why.

Updates #1118
2020-03-29 00:50:19 +09:00
Hajime Hoshi
b7ab3d2df4 uidriver/glfw: Avoid using the window position before initializing
Especially in the initial phase before calling Run/RunGame, the
window position is not reliable and then getting the device scale
factor does not make sense based on the window position. Avoid
using the window position, and instead use the glfw.Monitor in
this situation.
2020-03-29 00:09:08 +09:00
Hajime Hoshi
14200eb42c uidriver/glfw: Add comments 2020-03-29 00:02:33 +09:00
Hajime Hoshi
8480f888dd Revert "uidriver/glfw: Bug fix: Do not use the window position for monitors"
Revert "uidriver/glfw: Bug fix: compile error on Linux"

This reverts commit 0a5126f776.
This reverts commit 3e244d7a7c.

Reason: GetMonitor is available only on fullscreen mode
2020-03-28 23:56:03 +09:00
Hajime Hoshi
e628350d4e uidriver/glfw: Bug fix: Initializing order mattered
Especially on Linux, the window size and the window position must
be initialized in this order.

Fixes #1118
2020-03-28 23:37:21 +09:00
Hajime Hoshi
34acf788d2 uidriver/glfw: Bug fix: Call Maximize explictly instead of the hint
Fixes #1117
2020-03-28 22:34:01 +09:00
Hajime Hoshi
4fe5acd711 ui: Panic on MaximizeWindow when the window is not resizable
On Windows, the window could be maximized even when the window was
not resizable. This behavior is confusing. Forbid it so that the
behavior will be clearer.
2020-03-28 22:08:48 +09:00
Hajime Hoshi
3e244d7a7c uidriver/glfw: Bug fix: compile error on Linux 2020-03-28 21:29:24 +09:00
Hajime Hoshi
8cca713d74 uidriver/glfw: Bug fix: adjustWindowPosition should consider the monitor position 2020-03-28 21:26:57 +09:00
Hajime Hoshi
0a5126f776 uidriver/glfw: Bug fix: Do not use the window position for monitors
Especially in the initial phase before calling Run/RunGame, the
window position is not reliable and then getting the device scale
factor does not make sense based on the window position. Avoid
using the window position, and instead use the glfw.Monitor.
2020-03-28 21:13:30 +09:00
Hajime Hoshi
7b5fb0a0d0 ui: Bug fix: The window was not shown on the secondary monitor on launching
This change changes the behavior of WindowPosition /
SetWindowPosition. The window position is now a relative position
and the origin position is the left-upper of the current monitor.

Fixes #1115
2020-03-28 19:51:47 +09:00
Hajime Hoshi
5e4e76d75c devicescale: Fix comments 2020-03-28 16:31:38 +09:00
Hajime Hoshi
d16477617e devicescale: Bug fix: Wrong calculation to convert Y
Updates #807
Fixes #1113
2020-03-28 16:27:58 +09:00
Hajime Hoshi
4ec49dd4cf mobile/ebitenmobileview: Implement Android gamepad axes
Updates #1083
2020-03-25 01:15:43 +09:00
Hajime Hoshi
8fcee54849 mobile/ebitenmobileview: Implement Android gamepad buttons
This is still work in progress.

Updates #1083
2020-03-23 01:30:17 +09:00
Hajime Hoshi
63caca720b ui: Bug fix: Compile error on Windows 2020-03-21 22:16:23 +09:00
Hajime Hoshi
f317f3b5fd ui: Add fuctions to maximize or minimize the window
This change adds these functions:

  * MaximizeWindow
  * IsWindowMaximized
  * MinimizeWIndow
  * IsWindowMinimized
  * RestoreWindow

Fixes #994
2020-03-21 22:13:58 +09:00
Hajime Hoshi
978ee26898 ui: Add function aliases *OnUnfocused for *InBackground
Now a window can be floating with SetWindowFloating, the functions
that have suffix 'IsBackground' seems misleading. However, we
cannot rename them due to backward compatibility. Then, let's add
aliases and revisit them when updating the major version of Ebiten.

Fixes #1102
2020-03-21 00:42:00 +09:00
Hajime Hoshi
56358fd0c4 ui: Rename IsForeground -> IsFocused
Updates #1102
2020-03-21 00:12:47 +09:00
Hajime Hoshi
4ef3b3e804 ui: Add SetWindowFloating / IsWindowFloating
Fixes #880
2020-03-20 22:16:27 +09:00
Hajime Hoshi
c36d4678a3 mipmap: Bug fix: DrawTriangles with a scale-only color matrix should be optimized
Fixes #1101
2020-03-17 02:48:29 +09:00
Hajime Hoshi
6bc62b8f17 uidriver/glfw: Update comments 2020-03-15 15:42:05 +09:00
Hajime Hoshi
b4a9538e1d graphicsdriver/opengl/gl: Remove a misspelled unused const 2020-02-26 12:06:47 +09:00
Hajime Hoshi
5040b3bcfc thread: Add comments 2020-02-24 01:54:52 +09:00
Hajime Hoshi
00e78c1eae thread: Close channels 2020-02-24 01:50:23 +09:00
Hajime Hoshi
c166fe8eea Update GLFW to v3.3.2
Fixes #1086
2020-02-23 03:10:38 +09:00
Hajime Hoshi
3af869732c uidriver/mobile: Implement InputChars for gomobile-build
This change also fixes InputChars to return only printable Unicode
chars on Android.

Updates #237
2020-02-23 01:01:40 +09:00
Hajime Hoshi
de52eb75e4 mobile/ebitenmobileview: Implement InputChars on Android / ebitenmobile
Updates #237
2020-02-23 00:51:49 +09:00
Hajime Hoshi
a208a026f6 uidriver/mobile: Implement keyboard key inputs for gomobile-build
Updates #237
2020-02-22 23:57:16 +09:00
corfe83
b3c567de89
Fix another ~300 allocations per frame in my test project (#1089)
This simple change brings my simple test project from 752 allocations per frame to 474 allocations per frame. It seems a shame that go's escape analysis is not smart enough to leave this variable on the stack.

GeoM is a 24-byte struct and there is a slight perf difference that we are storing it in stack, but also copying it around with this change (instead of an 8-byte pointer). This could make things faster (due to stack / CPU cache) or slower (due to copying more memory) - when I try a stress test (drawing 100K images per frame), I can't see any actual performance difference (but I do see 100K fewer allocations, and GC is no longer running almost all the time).
2020-02-22 13:40:17 +09:00
corfe83
a18cddb39f
Reduce heap allocations in thread.go and input.go (#1085)
I've been doing some profiling of a very simple ebiten project, and noticed that thread.go was doing a bunch of unnecessary allocations to accomplish its work. This change seeks to reduce GC work.

Input.go was also doing some unnecessary allocations.

The thread.go change reduces the total number of allocations per frame from 1342 to 852 (~36% reduction). The input.go change reduces it further to 752 (~44% total reduction). Perf tests were done on windows.
2020-02-21 09:59:45 +09:00
Hajime Hoshi
5b7151595b mobile/ebitenmobileview: Handle keyboard keys on Android (ebitenmobile)
Updates #237
2020-02-20 01:53:51 +09:00
Hajime Hoshi
682f454fc2 input: Refactoring: Rename variables 2020-02-19 10:52:58 +09:00
Hajime Hoshi
875a529708 graphics: Allow ReplacePixels on a sub-image
Fixes #980
2020-02-16 22:18:07 +09:00
Hajime Hoshi
d9bd7ab07d buffered: Remove (*Image).Set
This is a preparation for ReplacePixels of a sub-image.

Updates #980
2020-02-16 21:45:28 +09:00
Hajime Hoshi
733c1b649a buffered: Bug fix: Copying pixels failed for the delayed commands
Fixes #1082
2020-02-16 20:16:04 +09:00
Hajime Hoshi
911b36ed98 buffered: Refactoring 2020-02-16 20:03:04 +09:00
Hajime Hoshi
405ae99b32 buffered: Refactoring: Flush delayed functions without the lock 2020-02-16 19:53:17 +09:00
Hajime Hoshi
ff8689cfcd buffered: Bug fix: Set and some functions before the main loop caused wrong results
invalidatePendingPixels was not called properly.

Fixes #1081
2020-02-16 19:06:48 +09:00
corfe83
61c2d7cfe8
Simple optimization in IsKeyPressed (#1080)
Simple optimization on IsKeyPressed to avoid iterating through whole map of possible keys.
2020-02-16 02:02:05 +09:00
Hajime Hoshi
883b25f257 uidriver/mobile: Refactoring 2020-02-12 00:36:34 +09:00
Hajime Hoshi
d59aea1db1 driver: Remove the return value from RunWithoutMainLoop 2020-02-11 23:56:53 +09:00
Hajime Hoshi
aef4b4ba53 uidriver/mobile: Refactoring: Give a default outside size 2020-02-11 23:29:52 +09:00
Hajime Hoshi
9298b044e3 graphicsdriver/metal: Bug fix: avoid using mtl.LoadActionDontCare
Fixes #1019
2020-02-11 20:29:03 +09:00
Hajime Hoshi
c927d33457 mobile/ebitenmobileview: Use the common uiContext for layouting
This means that the whole offscreen is cleared correctly.

This change is a little breaking change: SetScreenSize or other
functions no longer works on ebitenmobile. Use Layout instead.

Fixes #1019
2020-02-11 19:40:47 +09:00
Hajime Hoshi
a303487328 uidriver/mobile: Add comments 2020-02-11 14:45:50 +09:00
Hajime Hoshi
099ce1b3b4 Revert "ui: Add SetInitFocused"
This reverts commit bb04fc8a29.

Reason: glfw.Focused / glfw.FocusOnShow did not work

Updates #769
2020-02-10 01:10:40 +09:00
Hajime Hoshi
bb04fc8a29 ui: Add SetInitFocused
Updates #769
2020-02-09 23:45:59 +09:00
Hajime Hoshi
6250dd9f9b buffered: Bug fix: ebiten.Run must be called from the main thread
Updates #1027
2020-02-09 04:53:26 +09:00
Hajime Hoshi
32471af18f uidriver/js: Ensure that the checking-audio loop is finished when the game is finished
After the game loop is finished, any goroutines should not exist.
Otherwise, 'Go program has already exited' error can happen on
Wasm.

This change ensures that the goroutines are finished when the game
is finished. Note that time.Sleep was required to ensure that the
(*time.Ticker) ends.

Fixes #1027
2020-02-09 03:39:08 +09:00
Hajime Hoshi
4159c500bd buffered: Refactoring: Use defer
defer's performance will be much better as of Go 1.14.

https://tip.golang.org/doc/go1.14#runtime
2020-02-08 20:58:28 +09:00
Hajime Hoshi
46601bb516 graphics: Fill the screenshot in black when the screen is not transparent
Fixes #997
2020-02-06 03:08:16 +09:00
Hajime Hoshi
d6d17a7e85 uidriver/js: Implement GamepadSDLID
Fixes #1053
2020-02-05 00:00:00 +09:00
Hajime Hoshi
802693fa20 uidriver/mobile: Implement IsForeground
This adds hooks on resuming/suspending the application, and
switches the foreground state there. This change also updates
the logic to suspend the game loop to be clearer.

Fixes #1037
2020-01-23 02:08:31 +09:00
Hajime Hoshi
38f49c3768 uidriver/js: Implement IsForeground
Updates #1037
2020-01-21 23:56:57 +09:00
Hajime Hoshi
59431e1cad graphicsdriver/opengl: Leave comments why we don't use PBO on Android
Unfotunately, PBO might slow Android applications expecially when
coming back from context lost. Ebiten sends a lot of draw calls to
replace pixels in such case.

Until we find a good solution, let's not use PBO on Android.

Fixes #988
2020-01-19 17:02:34 +09:00
Hajime Hoshi
b3bdf51905
graphicscommand: Return the error immediately (#1060)
Now grpahicscommand saves the error and shows the error after a
while. This was good to simplify the API but was the cause to hide
some issues.

This change fixes all the errors to be returned immediately, and
buffer this in the ebiten package instead.

Fixes #971
2020-01-19 01:18:56 +09:00
Hajime Hoshi
5c285de3db uidriver/mobile: Prevent non-mobile environments from compiling 2020-01-18 21:15:56 +09:00
Hajime Hoshi
2b9cd5aed6 uidriver/mobile: Bug fix: Compile error
TravisCI doesn't compile for mobiles, so we missed this error.

Updates #1037
2020-01-18 17:39:36 +09:00
Zachary Burkett
6686044452 ui: Add IsForeground API to glfw driver (#1058)
Updates #1037
2020-01-16 10:47:23 +09:00
Hajime Hoshi
6eb05a0203 graphicsdriver/opengl: Enable to compile with gldebug 2020-01-13 18:55:30 +09:00
Hajime Hoshi
e797aed6c9 uidriver/glfw: Refactoring 2020-01-13 18:23:18 +09:00
Hajime Hoshi
c1adf60e69 uidriver/glfw: Rename files 2020-01-13 18:15:39 +09:00
Hajime Hoshi
b4819c4523
input: Rename GamepadGUID -> GamepadSDLID (#1049)
Gamepad GUID is a SDL specific notion and, strictly speaking,
they are not GUID (UUID) since they don't follow UUID's
specifications.

Renaming the function makes the situation clearer.

Updates #1048
2020-01-11 15:50:37 +09:00
Hajime Hoshi
68d58d7452 buffered: Refactoring 2020-01-11 03:11:56 +09:00
Hajime Hoshi
52a5ed0ad4 buffered: Add tests for #1050 2020-01-11 02:45:46 +09:00
hiroebe
27404b7ae3 buffered: Fix delayed DrawImage() (#1050) 2020-01-10 23:58:22 +09:00
Jake Bentvelzen
c17946bb82 ui: Add GamepadGUID and GamepadName functions (#1035)
Fixes #1034
2020-01-09 22:11:32 +09:00
hiroebe
6ee587301c Fix multiple close for channel (#1047) 2020-01-08 12:50:57 +09:00
Hajime Hoshi
2cbd5aa16e mipmap: Remove unused members 2020-01-08 02:32:28 +09:00
Hajime Hoshi
4c8137ccf5 mipmap: Bug fix: Use more negative mipmaps when float precision is low
Fixes #1044
2020-01-08 02:06:36 +09:00
Hajime Hoshi
c99fd1a742 mipmap: Create mipmap package and bufferd.Image uses it
Mipmap calculation must be executed after the main loop starts
because the graphics driver's HasHighPrecisionFloat is needed.
Then, operations on mipmap images must be called from images in
buffered package.

Updates #1044
2020-01-08 02:06:01 +09:00
Hajime Hoshi
9be3495077 driver: Remove Graphics.SetWindow
Fixes #1026
2020-01-03 19:04:48 +09:00
Hajime Hoshi
fa95275a02 uidriver/glfw: Bug fix: js should be excluded from compiling targets 2020-01-03 19:01:45 +09:00
Hajime Hoshi
982b7d6ddc driver: Let UI have Graphics
Now UIs own the implementation of Graphics.

Updates #1026
2020-01-03 18:32:27 +09:00
Hajime Hoshi
e66f1fb71e graphicsdriver/opengl: Use glBufferSubData instead of glTexSubImage2D on browsers
Updates #988
2020-01-02 16:27:51 +09:00
Hajime Hoshi
de48a13a6e graphicsdriver/opengl/gl: Remove unused functions 2020-01-02 00:17:39 +09:00
Hajime Hoshi
38815ba801 graphicsdriver/opengl: Use glBufferSubData instead of glMapBuffer
We have confirmed that this does not slow down ReplacePixels.

Fixes #993
Fixes #1040
2020-01-02 00:01:27 +09:00
zamadatix
c4dfc69c81 Typo Corrections from https://goreportcard.com/ (#1042)
Correct typo found by https://goreportcard.com/
2020-01-01 23:59:56 +09:00
Hajime Hoshi
51f4ba1320 graphicsdriver/opengl: Refactoring 2020-01-01 01:57:12 +09:00
Hajime Hoshi
815afe6670 graphicsdriver/opengl: Reduce calls of glBindTexture 2020-01-01 01:39:45 +09:00
Hajime Hoshi
8285fbfac9 graphicsdriver/opengl: Add error checks 2019-12-31 04:22:28 +09:00
Hajime Hoshi
9ed8279fc8 driver: Add interface Window 2019-12-25 00:24:21 +09:00
Hajime Hoshi
049aa552d4 ui: Add SetWindowResizable
This change also fixes example/windowsize.

Fixes #320
2019-12-22 19:26:04 +09:00
Hajime Hoshi
c9863284cf uidriver/glfw: Set a default window size
Now RunGame can be called without SetWindowSize.
2019-12-22 12:51:36 +09:00
Hajime Hoshi
7d56e4335e ui: Add RunGame, WindowSize and SetWindowSize
This change introduces the new APIs RunGame, WindowSize and
SetWindowSize. These new APIs hides the notion of 'scale', and is
more flexible with the outside size change. This means that we can
introduce a resizable window.

This change also adds -legacy flag to examples/windowsize. If the
flag is off, the new APIs are used.

This change deprecates these functions since the notion of 'scale'
is deprecated:

  * ScreenScale
  * ScreenSizeInFullscreen
  * SetScreenScale
  * SetScreenSize

Fixes #943, #571
Updates #320
2019-12-22 03:35:31 +09:00
Hajime Hoshi
57d527bea2 driver: Remove 'title' argument from UI.Run 2019-12-22 01:41:51 +09:00
Hajime Hoshi
8b995b086b driver: Remove some arguments from UI.Run 2019-12-21 22:52:23 +09:00
Hajime Hoshi
8013fef9ea uidriver: Bug fix: Needed to implement MonitorPosition 2019-12-21 21:15:58 +09:00
Hajime Hoshi
dabaf66b81 uidriver: Remove width/height/scale arguments from run
The initial window position is determined on ebiten package side.

Updates #943
2019-12-21 20:10:58 +09:00
Hajime Hoshi
d07028735f uidriver/glfw: Refactoring 2019-12-21 19:52:07 +09:00
Hajime Hoshi
987f333d95 uidriver/glfw: Rename variables 2019-12-21 17:34:58 +09:00
Hajime Hoshi
2e8358529c uidriver/glfw: Bug fix: WindowPos/SetWindowPos should convert pixels
This change also enables these functions even on fullscreen mode.

Fixes #1010
2019-12-21 17:03:19 +09:00
Hajime Hoshi
09ea15e0ff shareable: Bug fix: Unexpected allocation when extending an image
Fixes #1028
2019-12-20 01:13:28 +09:00
Hajime Hoshi
85cbc7e56b Enable to compile Ebiten on js/wasm with Go 1.14
Fixes #1024
2019-12-19 00:45:53 +09:00
Hajime Hoshi
9486defdae uidriver/mobile: Rely on uiContext's Layout function to determine the screen size 2019-12-17 02:16:45 +09:00
Hajime Hoshi
6a8013ed37 ui: Reduce arguments from newUIContext 2019-12-16 11:12:38 +09:00
Hajime Hoshi
bda11b0e17 driver: Add UI.SetWindowSize and UIContext.Layout
This is a preparation to introduce RunGame function.

Updates # 943 (Fix this line before committing)
2019-12-15 02:29:43 +09:00
Hajime Hoshi
d8f02cf03e uidriver/js: Bug fix: Compile error on CursorMode 2019-12-14 12:54:21 +09:00
Zachary Burkett
ed19d6fae9 Add cursor capture functionality (#1016)
Fixes #1016
2019-12-14 12:30:03 +09:00
Hajime Hoshi
ba0e8ef13f uidriver/mobile: Refactoring: Rename variables 2019-12-13 02:50:57 +09:00
Hajime Hoshi
2871795895 uidriver/glfw: Refactoring: Remove mutex from Input
Mixing a thread and a mutex is risky. Use a thread if possible.
2019-12-12 03:20:24 +09:00
Hajime Hoshi
a3343afc36 graphicsdriver/opengl/gl: Use pkg-config instead of LDFLAGS
Updates #1012
2019-12-11 03:00:25 +09:00
Hajime Hoshi
00fb4cd2f9 uidriver/glfw: Refactoring: Remove windowWidthInDP 2019-12-09 01:39:42 +09:00
Hajime Hoshi
190feb6ecd uidriver/glfw: Rename variables
DP represents a device independent pixel.
2019-12-09 00:19:38 +09:00
Hajime Hoshi
7d403930af uidriver/glfw: Bug fix: Compile errors on Windows and Linux 2019-12-08 23:20:09 +09:00
Hajime Hoshi
c243bfcdd8 uidriver/glfw: Fix comments 2019-12-08 23:03:13 +09:00
Hajime Hoshi
3e89e7e561 uidriver/glfw: Bug fix: Show the window at last on initialization 2019-12-08 23:00:10 +09:00
Hajime Hoshi
e00a190f22 uidriver/glfw: Refactoring: Add toDeviceIndependentPixel / toDeviceDependentPixel 2019-12-08 22:09:12 +09:00
Hajime Hoshi
a0cf8bac21 uidriver/glfw: Refactoring: Limit the calls of devicescale.GetAt 2019-12-08 20:55:40 +09:00
Hajime Hoshi
8e9f5b9535 driver: Remove Suspend/ResumeAudio from UIContext 2019-12-08 16:17:02 +09:00
Hajime Hoshi
63fbffa9f6 uidriver/glfw: Fix thread issues at reqWidth/reqHeight 2019-12-08 02:44:14 +09:00
Hajime Hoshi
22e3db6814 uidriver/glfw: Add comments
Updates #1004
2019-12-08 02:04:04 +09:00
Hajime Hoshi
80fbc9701c uidriver/glfw: Force to swap buffer or recreate an window after toggling fullscreen
This change resolves a bug that an image lag remains after
toggling fullscreen.

On OpenGL, swapping buffer is necessary after toggling fullscreen.

On Metal, recreating a window works after toggling fullscreen.

Fixes #1004
2019-12-08 01:47:32 +09:00
Hajime Hoshi
2180613e2a uidriver/glfw: Refactoring: Add createWindow 2019-12-07 19:56:56 +09:00
Hajime Hoshi
67ee0ff5d4 uidriver/glfw: Refactoring: Remove forceSetScreenSize 2019-12-07 17:35:57 +09:00
Hajime Hoshi
c9bc5913fd driver: Refactoring: Remove Graphics.Flush
Updates #226
2019-12-06 08:56:55 +09:00
Hajime Hoshi
7991ba4cfa graphicsdriver/metal: Bug fix: Failed to compile for iOS
The definition of BOOL is different between macOS and iOS. C's
bool is used on iOS, but C's bool is hard to use from Go (e.g.,
an integer cannot be converted to C's bool). Use unsigned char
instead.

Fixes #1006
2019-12-03 01:03:44 +09:00
Hajime Hoshi
42056c2d61 restorable: Refactoring: Remove Clear
Fill now fills the whole texture.
2019-12-02 03:03:07 +09:00
Hajime Hoshi
b35ffa57b3 Revert "uidriver/glfw: Remove the dirty hack for GLFW 3.2"
This reverts commit d1da5b4920.

Reason: The dirty hack might still be needed.
2019-12-02 01:06:55 +09:00
Hajime Hoshi
d1da5b4920 uidriver/glfw: Remove the dirty hack for GLFW 3.2
See also https://github.com/glfw/glfw/issues/1334.

Updates #703
2019-12-02 01:04:28 +09:00
Hajime Hoshi
5153713469 uidriver/glfw: Make the panic messages more consistent 2019-12-01 03:34:09 +09:00
Hajime Hoshi
0ec447e0d0 ui: Add SetScreenTransparent / IsScreenTransparent
Fixes #1001
2019-12-01 03:31:32 +09:00
Hajime Hoshi
b8a099e354 ui: Bug fix: (Set)WindowPosition didn't work well with fullscreen mode 2019-12-01 00:39:04 +09:00
Hajime Hoshi
6cd0b44baa uidriver/glfw: Use invalidPos instead of pointers 2019-12-01 00:21:11 +09:00
Hajime Hoshi
e463f9e611 ui: Make (Set)WindowPosition concurrent safe 2019-12-01 00:11:46 +09:00
Hajime Hoshi
9b2f864fc8 ui: Add SetWindowPosition(x, y int)
Fixes #936
2019-11-30 23:22:39 +09:00
Hajime Hoshi
c021d6be6a ui: Add WindowPosition()
Fixes #936
2019-11-30 22:37:56 +09:00
Hajime Hoshi
e0d780b029 uidriver/glfw: Enable to call SetWindowDecorated after Run
Fixes #556
2019-11-26 11:46:18 +09:00
Hajime Hoshi
995ba3afcf glfw: Update GLFW 3.3 2019-11-26 11:21:07 +09:00
Hajime Hoshi
a040aae83b glfw: Update to GLFW 3.3
Fixes #1000
2019-11-26 01:19:20 +09:00
Hajime Hoshi
5f33d47711 png: Add stdlibfuzz.go 2019-11-26 00:13:50 +09:00
Hajime Hoshi
f6390abad7 png: Update for Go 1.13 2019-11-25 22:24:33 +09:00
Hajime Hoshi
21ba42325c graphicsdriver/opengl: Use smaller PBOs 2019-11-24 18:32:35 +09:00
Hajime Hoshi
78e912e30b graphicsdriver/opengl: Fix comments 2019-11-24 18:11:45 +09:00
Hajime Hoshi
3d3a1be1c4 graphicsdriver/opengl: Use glTexSubImage2D instead of glTexImage2D 2019-11-24 18:07:21 +09:00
Hajime Hoshi
9f483ddc60 graphicsdriver/opengl: Adopt WRITE_ONLY for PBOs
It looks like it is safe to use WRITE_ONLY:
https://stackoverflow.com/questions/30248594/write-only-glmapbuffer-what-if-i-dont-write-it-all
2019-11-24 17:42:28 +09:00
Hajime Hoshi
4c4f67197f graphicsdriver/opengl/gl: Bug fix: compile error on non-Windows (again) 2019-11-24 03:05:14 +09:00
Hajime Hoshi
ac6a3f0900 graphicsdriver/opengl/gl: Bug fix: compile error on non-Windows 2019-11-24 02:02:40 +09:00
Hajime Hoshi
0ef8009c11 graphicsdriver/opengl: Use uintptr whenever possible instead of unsafe.Pointer 2019-11-20 02:00:02 +09:00
Hajime Hoshi
4296c11256 graphicsdriver/opengl: Refactoring 2019-11-24 00:08:38 +09:00
Hajime Hoshi
3df198f68e graphicsdriver/opengl: Use GL_READ_WRITE at glMapBuffer
Updates #993
2019-11-22 00:27:20 +09:00
Hajime Hoshi
65fdf48cbf graphicsdriver: Refactoring: ReplacePixels takes multiple arguments
This reduces the number of graphics commands, and this works more
efficiently if the driver has an efficient way.
2019-11-21 23:52:12 +09:00
Hajime Hoshi
161771cc99 graphicsdriver/opengl: Refactoring 2019-11-20 12:23:45 +09:00
Hajime Hoshi
52f6be2639 graphicsdriver/opengl: Fix suspicious GL function calls
Before this change, the pixel object buffer is unbound just after
getting a pointer by glMapBuffer. This seemed suspicious.

This change fixes to do all pixel manipulations once between
glMapBuffer and glUnmapBuffer without changing a bound buffer.

This might fix a wrong rendering on some machines, but I am not
sure.

Updates #993
2019-11-20 02:41:34 +09:00
Hajime Hoshi
95d3561a3a packing: Better panic message 2019-11-18 00:27:34 +09:00
Hajime Hoshi
63f9ac2ccc packing: Add Rollback/CommitExntension
This enables to dry-run to extend pages without cloning.

Fixes #990
2019-11-18 00:23:13 +09:00
Hajime Hoshi
61839506d8 packing: Add an extending count at Extend 2019-11-17 23:39:16 +09:00
Hajime Hoshi
74902d47af graphicsdriver/metal/mtl: Bug fix: need to link CoreGraphics as of Catalina
Fixes #989
2019-11-17 22:59:21 +09:00
Hajime Hoshi
725cc22200 uidriver/mobile: Rename Render -> Update 2019-11-17 21:52:06 +09:00
Hajime Hoshi
92e056c508 uidriver/glfw: Bug fix: an unexpected window at launching
Fixes #986
2019-11-17 19:58:44 +09:00
Hajime Hoshi
3aaeee78dd graphicsdriver/metal: Reduce flushing at ReplacePixels 2019-11-17 16:00:24 +09:00
Hajime Hoshi
800b98a0c6 ui: Bug fix: a window was alwasy 'unfocused' on Windows
There is an issue in GLFW that a window was recognized as unfoces
on Windows (glfw/glfw#1573). As a workaround, skip the logic for
an unfocused window on Windows. On Windows, even if a window is in
another workspace, vsync works. Then there seems no problem.

Fixes #987
2019-11-17 14:10:38 +09:00
Hajime Hoshi
4120e868be graphicsdriver/opengl: Remove unused functions 2019-11-17 05:10:22 +09:00
Hajime Hoshi
acc933b7c3 graphicsdriver/opengl: Experimental PBO implementation
This change is an experimental implementation to use Pixel Buffer
Objects. This reduces calls of glTexSubImage2D.

This works only on desktops. Unfortunately WebGL does not have
this features. Mobiles can have PBO as of OpenGL ES 3.

Updates #976
2019-11-17 05:01:43 +09:00
Hajime Hoshi
16b3a5c296 buffered: Bug fix: Needed to copy pixels when buffering
Updates #983
2019-11-16 16:39:02 +09:00
Hajime Hoshi
e42cff071c restorable: Merge two 'copy' into one
Fixes #983
2019-11-16 02:10:53 +09:00
Hajime Hoshi
aa6fc67736 Revert "graphics: Avoid all copying pixels"
This reverts commit c60a32a479.

Reason: This breaks backward comptibility and it was not obvious how to fix examples.
2019-11-16 02:04:46 +09:00
Hajime Hoshi
c60a32a479 graphics: Avoid all copying pixels
This is a breaking change: ReplacePixels now takes the ownership
of the given pixels.

Fixes #983
2019-11-16 01:51:36 +09:00
Hajime Hoshi
f1091910bd Revert "graphicscommand: Remove copying pixels"
This reverts commit 339a96b7e6.

Reason: this causes panic on extending textures
2019-11-16 00:43:22 +09:00
Hajime Hoshi
339a96b7e6 graphicscommand: Remove copying pixels
Now ReplacePixels takes the ownership.

Updates #983
2019-11-16 00:29:37 +09:00
Hajime Hoshi
bfd5774faf graphicsdriver/glfw: Bug fix: CPU was busy when the window is hidden
Fixes #982
2019-11-14 23:11:36 +09:00
Hajime Hoshi
8c54cf639a graphicsdriver/opengl: Reduce glFlush calls
Fixes #981
2019-11-14 01:21:08 +09:00
Hajime Hoshi
c2eae69b47 graphicscommand: Refactoring 2019-11-14 00:08:44 +09:00
Hajime Hoshi
a1a294df72 uidriver/glfw: Bug fix: Freeze on Wayland
Fixes #974
2019-11-10 19:26:49 +09:00
Hajime Hoshi
572780ed6d uidriver/glfw: Bug fix: errors are ignored at (*UserInterface).run
Updates #978
2019-11-10 19:09:41 +09:00
Hajime Hoshi
d43e203ccf uidriver/glfw: Remove a redundant 'if' branch 2019-11-10 17:34:14 +09:00
Hajime Hoshi
63f73ddd75 web: Bug fix: iPad was not recognized as iOS
Fixes #979
2019-11-10 16:52:49 +09:00
Hajime Hoshi
8d12446dbe buffered: Bug fix: reset the flag when invalidating the pending pixels
Updates #977
2019-11-09 05:54:27 +09:00
Hajime Hoshi
ec59e9b9ae buffered: Bug fix: Resolve pixels only when Set is called
Fixes #977
2019-11-09 05:43:36 +09:00
Hajime Hoshi
ddba7f0ee0 driver: Bug fix: unused import 2019-11-04 03:15:09 +09:00
Hajime Hoshi
889bc12093 driver: Remove IsPlayground 2019-11-04 03:04:00 +09:00
Hajime Hoshi
3c29fbdce2 jsutil: Refactoring: SliceToTypedArray -> CopySliceToJS
This unifieslocations of the temporary buffer.
2019-10-30 00:35:48 +09:00
Hajime Hoshi
31f56efd75 jsutil: Add doc.go
This is to avoid no-Go-files error on TravisCI.

https://travis-ci.org/hajimehoshi/ebiten/builds/603539948
2019-10-28 01:28:50 +09:00
Hajime Hoshi
49a5a2bf4e uidriver/js: Bug fix: Needed to initialize pseudoScale with the given scale
Updates #960, #973
2019-10-27 17:16:49 +09:00
Hajime Hoshi
06bbc08e9b web: Bug fix: IsAndroidChrome always returned true 2019-10-24 00:20:33 +09:00
Hajime Hoshi
e7611139c3 uidriver/js: Bug fix: Watch the state regularly instead of events
visibilitystate is sometimes not called and in this case the app
does not come back.

This fix creates another goroutine to watch the state, and remove
event handlers.

Fixes #961
2019-10-21 00:04:07 +09:00
Hajime Hoshi
e578b0bd49 graphicscommand: Bug fix: Needed to adjust vertices when highp is not available
Fixes #962
2019-10-19 17:05:04 +09:00
Hajime Hoshi
43a8881ab8 uidriver/ui: Reduce calls of syscall/js 2019-10-16 02:56:58 +09:00
Hajime Hoshi
72248fa3ef ui: Bug fix: Focus canvas explicitly on input
Fixes #961
2019-10-15 23:57:16 +09:00
Hajime Hoshi
75721e6fc1 ui: Auto scaling on browsers
This change forces Ebiten apps on browsers 'fullscreen' mode.
After this change, 'scale' value is no longer used on browsers.

Note that this breaks backward compatibility, but as long as the
game works in an iframe, this should not be problematic.

Fixes #960
2019-10-15 00:02:02 +09:00
Hajime Hoshi
30c185f254 uidriver/js: Bug fix: context must not be accessed before loop 2019-10-14 02:41:04 +09:00
Hajime Hoshi
5027bc1af5 buffered: Allow Set before the game runs
Fixes #949
2019-10-12 03:13:29 +09:00
Hajime Hoshi
cbe4844fa0 Fix misspellings 2019-10-12 01:10:53 +09:00
Hajime Hoshi
4bfe60fb8a graphicsdriver/metal: Bug fix: SetFragmentBytes must be called anytime
Fixes #954
2019-10-10 03:13:55 +09:00
Hajime Hoshi
3c976eae02 cmd/ebitenmobile: Use Metal on iOS
The emulators still use OpenGL.

Fixes #737
2019-10-09 02:13:47 +09:00
Hajime Hoshi
4088de5349 graphicsdriver/opengl/gl: Fix go-vet errors on Windows
Updates #889
2019-10-06 23:19:59 +09:00
Hajime Hoshi
3a0f8655e6 graphicsdriver/opengl/gl: Indentation 2019-10-06 23:02:15 +09:00
Hajime Hoshi
378be6be80 graphicsdriver/opengl/gl: Remove unused functions
This improves `go vet` results.

Updates #889
2019-10-06 22:49:38 +09:00
Hajime Hoshi
0d56207672 graphicsdriver/opengl/gl: Remove unnecessary consts 2019-10-06 04:27:57 +09:00
Hajime Hoshi
7e7751bd43 restorable: Performance tuning
This is based on the result of examples/set (Wasm).
2019-10-04 02:02:36 +09:00
Hajime Hoshi
382f6365fd shareable: Avoid defer for performance 2019-10-04 01:52:27 +09:00
Hajime Hoshi
38ee9113ee graphicsdriver/opengl/gl: Remvoe PtrOffset
Updates #889
2019-10-01 01:48:42 +09:00
Hajime Hoshi
ffbdda9a25 shareable: Avoid defer for performance 2019-09-29 03:50:43 +09:00
Hajime Hoshi
907302c440 graphicscommand: Keep the capacity at q.commands 2019-09-29 03:23:40 +09:00
Hajime Hoshi
86b4e9ffeb restorable: Bug fix: Do not mutate graphics.QuadIndices 2019-09-29 02:57:11 +09:00
Hajime Hoshi
6c8c064a58 restorable: Add TestMutateSlices 2019-09-29 02:36:06 +09:00
Hajime Hoshi
9cb631e30f Reland: graphics: Reuse vertices backend and reduce allocating
This is a reland of 74f1e5519f.

The vertex slice is now copied before saving as the drawing
history items.
2019-09-29 01:36:00 +09:00
Hajime Hoshi
4feb0a4f3e restorable: Bug fix: indices has to be copied 2019-09-29 01:30:26 +09:00
Hajime Hoshi
5e6bdc25e5 gofmt 2019-09-28 23:09:20 +09:00
Hajime Hoshi
f873b66267 graphicscommand: Reduce calling InternalWidth/InternalHeight 2019-09-28 23:03:11 +09:00
Hajime Hoshi
791f96f980 graphicscommand: Reduce division operators 2019-09-28 02:31:04 +09:00
Hajime Hoshi
7bb2895415 clock: Avoid calling (js.Value).Get() for performance 2019-09-28 01:47:48 +09:00
Hajime Hoshi
af6bda48c3 Reduce division operators
It looks like runtime.wasmDiv takes account for a big part at CPU
usages with examples/sprites.
2019-09-27 03:29:10 +09:00
Hajime Hoshi
3cf867035d buffered: Do not delay commands if possible
Delaying commands causes memory allocations, which can be heavy
especially on browsers.

This avoids to use 'defer' for performance.
2019-09-27 03:27:47 +09:00
Hajime Hoshi
3291ec51bb buffered: Use a raw function to avoid allocating structs 2019-09-27 00:37:31 +09:00
Hajime Hoshi
fc3e8bebe4 Use 0-length slice instead of nil to keep capacities 2019-09-27 00:34:55 +09:00
Hajime Hoshi
59333ba1ad jsutil: Avoid allocating ArrayBuffer unnecessarily 2019-09-26 23:59:00 +09:00
Hajime Hoshi
9a42b264fd web: Speed optimization 2019-09-26 22:11:16 +09:00
Hajime Hoshi
899fc38d23 Add wasm test with wasmbrowsertest
Fixes #881
2019-09-23 02:45:37 +09:00
Hajime Hoshi
33c7f39f0f graphicsdriver/opengl/gl: Exclude all the files for Wasm
Fixes #938
2019-09-23 00:42:54 +09:00
Hajime Hoshi
79b32c7601 graphics: Add buffered package
Moved the command queue to the package.
2019-09-21 22:34:37 +09:00
Hajime Hoshi
0a872b342a shareable: Change the argument to color.RGBA at Fill
The argument will be copied explicitly.
2019-09-21 21:16:46 +09:00
Hajime Hoshi
9d867850dc shareable: Rename Dispose -> MarkDisposed
Before this change, it was not clear that shareable's Dispose can
be called from finalizers since finalizers must not be blocked by
a mutex. Actually Dispose could be locked and must not be called
from finalizers.

This change renames the function to avoid confusion of the API,
and make the function available from finalizers.
2019-09-21 20:05:21 +09:00
Hajime Hoshi
053f5a0ce7 shareable: Refactoring 2019-09-21 19:15:49 +09:00
Hajime Hoshi
1c2c932c6c graphics: Remove MakeVolatile/IsVolatile 2019-09-21 14:53:52 +09:00
Hajime Hoshi
06d198cc0e shareable: Rename files 2019-09-21 06:09:52 +09:00
Hajime Hoshi
bc4d092710 shareable: Remove (*Image).Size() 2019-09-21 05:56:34 +09:00
Hajime Hoshi
3023cc69c3 restorable: Remove (*Image).Size() 2019-09-21 05:40:05 +09:00
Hajime Hoshi
629d58b93a graphics: Remove PutQuadVertices 2019-09-21 04:14:25 +09:00
Hajime Hoshi
6095cd965b shareable: Remove (*Image).PutVertex 2019-09-21 04:01:44 +09:00
Hajime Hoshi
ea52aa52bb shareable: Fix tests 2019-09-21 03:58:50 +09:00
Hajime Hoshi
d491cab465 restorable: Remvoe unused arguments 2019-09-21 03:44:45 +09:00
Hajime Hoshi
9e78d8c656 graphicscommand: Bug fix: Fix tests 2019-09-21 03:36:48 +09:00
Hajime Hoshi
6fa7d59468 shareable: Remove lock from (*Image).PutVertex
Updates #941
2019-09-21 02:17:14 +09:00
Hajime Hoshi
70a38dc09a graphicscommand: Move pixel->texel conversion to graphicscommand 2019-09-20 23:59:04 +09:00
Hajime Hoshi
915ed91f25 restorable: Remove (*Image).PutVertices 2019-09-20 23:44:09 +09:00
Hajime Hoshi
93dc9ad589 restorable: Refactoring: Remove (*Image).internalSize() 2019-09-20 01:55:18 +09:00
Hajime Hoshi
e0790ee950 Revert "graphics: Delay draw commands and execute them only when needed"
This reverts commit 0c70823f27.

Reason: Switching apps on Android sometimes broke the screen
2019-09-19 01:18:53 +09:00
Hajime Hoshi
0c70823f27 graphics: Delay draw commands and execute them only when needed
This change introduces a queue for delayed graphics commands.
When an image's pixels are retrieved or the screen is rendered,
Ebiten calculates the set of the necessary draw commands and
execute them.

This reduces the number of draw calls especially for the launching
phase.

Fixes #921
2019-09-19 01:09:48 +09:00
Hajime Hoshi
845f2bdeb8 Remove unneeded comments 2019-09-18 10:49:20 +09:00
Hajime Hoshi
439599a145 mobile/ebitenmobileview: Bug fix: ebitenmobile should be ignored on non-mobile platforms 2019-09-18 10:46:35 +09:00
Hajime Hoshi
695c93efd6 event: Add a converting function from driver.Event to event.Event
Update #926
2019-09-12 21:59:13 +09:00
Hajime Hoshi
529ab5f191
event: Auto-generate event definitions (#935)
As event package needs to depend on driver package, and drvier
package needs to emit events, we need event definitions in both
side. This change add a generator for event definitions.

Updates #926
2019-09-12 11:32:20 +09:00
Hajime Hoshi
3fb9c02e2f graphicsdriver/metal: Bug fix: Use correct pixel format for the screen 2019-09-08 03:52:29 +09:00
Hajime Hoshi
52900fac79 Move back driver getters to ebiten package 2019-09-03 01:46:11 +09:00
Hajime Hoshi
25a2bf3c1f event: Add Modifier
Modifier keys are selected of a common set of GLFW keys [1] and Web
API keys [2].

This change also renames the member Modifiers to Modifer to
follow the convension (e.g., [3]).

Updates #926

[1] https://www.glfw.org/docs/latest/group__mods.html
[2] https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState
[3] https://godoc.org/golang.org/x/tools/go/packages#Config
2019-09-03 01:12:50 +09:00
Hajime Hoshi
05f4ca2a4d input: Refactoring: nameToJSKeyCodes -> nameToJSKeyCode 2019-09-02 00:30:17 +09:00
Hajime Hoshi
83b2d4b112 input: driver.Key now distinguishes left/right modifier keys
This is a preparation for event package, that will have key enum.

Updates #926
2019-09-01 23:49:00 +09:00
Hajime Hoshi
19103dcfeb graphicscommand: Bug fix: Adjust vertices to avoid jaggy
If vertices are (almost) half-integer values, adjust them to avoid
jaggy.

Fixes #929.
2019-08-27 23:18:08 +09:00
Hajime Hoshi
22c31da6c1 restorable: Bug fix: Do not include emptyImage into the dependency graph
Instead, add baseColor to Pixels and use it when restoring.

Fixes #928.
2019-08-27 08:17:14 +09:00
Hajime Hoshi
76330c492c shareable: Refactoring 2019-08-26 00:32:30 +09:00
Hajime Hoshi
d2312f1450 shareable: Lock before BeginFrame
This make package shareable more consistent. The mutex is lock
after EndFrame and before BeginFrame, and the similar rule will be
applied at launching (BeginFrame unlocks the lock in any cases).

Instead, package ebiten queues image operations if BeginFrame and
doesn't create provisional non-shared images. This should improve
performance at launching since this reduces the number of draw
calls, especifally for creating new images.

Updates #879.
Updates #921.
2019-08-25 18:12:04 +09:00
Hajime Hoshi
7907bb43ce shareable: Refactoring: reduce sync.Once 2019-08-25 17:32:32 +09:00
Hajime Hoshi
b53279b1e1 shareable: Remove InitializeGraphicsDriverState 2019-08-25 17:28:59 +09:00
Hajime Hoshi
3960a4bbdf restorable: Add (*Image).Fill
This resets the infomation for restoring if possible. This makes
it more efficient to use offscreens.
2019-08-25 02:57:44 +09:00
Hajime Hoshi
856e2df1ec web: Bug fix: compile error on browsers 2019-08-25 02:40:28 +09:00
Hajime Hoshi
b8eeded538 graphics: Remove 'resetRestoringState'
This is basically a revert of 2d079b123f

As filling can happen on a part of a shared image, resetting the
restoring state was wrong.
2019-08-25 02:18:51 +09:00
Hajime Hoshi
e931494c66 shareable: Allocate the screen framebuffer image lazily
This improves consistency.
2019-08-25 00:43:29 +09:00
Hajime Hoshi
ef56d0a535 Refactoring: isRunning -> isImageAvailable 2019-08-25 00:14:37 +09:00
Hajime Hoshi
42c70e48ff uidriver/mobile: No need to use sync.Once
devicescale.At is already locked by a mutex and keeps values in its
cache.
2019-08-19 02:32:53 +09:00
Hajime Hoshi
2c23860226 uidriver/mobile: Prefer sync.Once to sync.Mutex 2019-08-19 02:25:01 +09:00
Hajime Hoshi
d7aa24c295 uidriver/glfw: Bug fix: Wrong usage of RWLock 2019-08-19 01:47:55 +09:00
Hajime Hoshi
4d0e23c460 uidriver/glfw: Reduce mutex to avoid potential deadlock 2019-08-19 01:01:43 +09:00
Hajime Hoshi
25ac788ee6 uidriver/mobile: Reduce mutex to avoid potential deadlock 2019-08-19 00:32:52 +09:00
Hajime Hoshi
6cd74a9f4d uidriver/mobile: Simplify updating logic 2019-08-19 00:13:56 +09:00
Hajime Hoshi
ccacc4a0b8 restorable: Refactoring: Make (*Image).Size() available even after disposing 2019-08-16 02:36:27 +09:00
Hajime Hoshi
6ba6cdc721 restorable: Bug fix: Dispose all the image before start restoring
A current texture ID and a new texture ID can be duplicated.
Disposing part of textures and creating textures at the same time
can make contradicted situation.
2019-08-16 01:00:09 +09:00
Hajime Hoshi
2cb1ea6fb4 restorable: Remove unnecessary call of clearImage
clearImage is already called in any cases.
2019-08-15 22:40:37 +09:00
Hajime Hoshi
0cbf126b80 restorable: Set nil to the image after disposing
This prevents a bug that a disposed image is used by clearImage.
2019-08-15 22:35:28 +09:00
Hajime Hoshi
9467a67136 restorable: Bug fix: Skip clearImage on emptyImage when restoring 2019-08-15 21:53:43 +09:00
Hajime Hoshi
01297fe015 graphicsdriver: Fix a panic message 2019-08-15 21:29:37 +09:00
Hajime Hoshi
900af20617 shareable: Misspelling 2019-08-15 12:59:50 +09:00
Hajime Hoshi
f835c8ce7f uidriver/mobile: Convert a panic to an error for handling
This is a dirty hack but there is no other way to handle panics to
report to Crashlytics.
2019-08-13 11:30:50 +09:00
Hajime Hoshi
4373bd8b89 restorable: Unify locks with shareable's backendsM and fix the deadlock
This change should make Image operations cuncurrent safe.

Updates #913
Fixes #915
2019-08-13 00:49:47 +09:00
Hajime Hoshi
14ce0c1bcb restorable: Bug fix: Lock before resolving stale states 2019-08-12 23:31:17 +09:00
Hajime Hoshi
9dd501720e restorable: Bug fix: Unlocking should happen after restoring 2019-08-12 23:19:03 +09:00
Hajime Hoshi
1f66c155ae shareable: Bug fix: Lock when backends are allocated 2019-08-12 22:48:48 +09:00
Hajime Hoshi
cbf36734f8 shareable: Bug fix: mutex should not be used at finalizers
Updates #913
2019-08-12 21:01:33 +09:00
Hajime Hoshi
28dd2f6e19 shareable: Refactoring: only finalizers have to be cared
Only finalizers are problematic since they can stop everything,
but other things are not. Let's care finalizers and just use
regular locks.

Updates #913
2019-08-12 20:17:40 +09:00
Hajime Hoshi
eb5ab57cdc shareable: Bug fix: Defer Dispose so that ClearPixels doesn't affect other images later
Updates #913
2019-08-12 19:37:23 +09:00
Hajime Hoshi
613b9bc02a restorable: Panic if an image is stale when restoring 2019-08-12 17:45:43 +09:00
Hajime Hoshi
1156dfdc7e restorable: Lock At operation between frames
Updates #913
2019-08-12 16:54:17 +09:00
Hajime Hoshi
d2719188b4 restorable: Do not call resolveDeferred at the end of a frame
This does not make sense.
2019-08-12 16:48:04 +09:00
Hajime Hoshi
628a8d559a restorable: Bug fix: Dispose should be deferred between frames (again)
Updates #913
2019-08-12 16:27:07 +09:00
Hajime Hoshi
4717baa840 restorable: Bug fix: Dispose should be deferred between frames
Updates #913
2019-08-12 16:26:07 +09:00
Hajime Hoshi
1a2a0aeb76 restorable: Defer operations between the end and the beginning of frames
Updates #913
2019-08-12 16:08:21 +09:00
Hajime Hoshi
df8fdc855a Bug fix: Compile error on GOOS=linux CGO_ENABLED=0 2019-08-01 08:17:58 +09:00
Hajime Hoshi
2003b7d292 Fix misspellings 2019-08-01 01:07:23 +09:00
Hajime Hoshi
de915a1736 Move driver getters to graphicsdriver/uidriver packages
This enables to add internal functions to these packages so that
the driver selector logics can be modified.
2019-08-01 00:40:59 +09:00
Hajime Hoshi
4a9a7f936d Make go vet a little happier on macOS
Updates #889
2019-07-22 20:16:22 +09:00
Hajime Hoshi
e6a88a7d1f uidriver/glfw: Add panic in the case of Windows Remote Desktop
Updates #903
2019-07-21 23:41:55 +09:00
Hajime Hoshi
b348223297 restorable: Refactoring
Reduces accesses to Image member from outside.
2019-07-21 16:44:00 +09:00
Hajime Hoshi
434802af6e restorable: Reland: Refactoring
This is reland of 7917b423f4be9494125c8de76a8a3def15561594

Fixed a bug that an image passed to Apply might not be initialized,
and there was no correct way to treat such an image. Now Apply
accepts only an initialized image.
2019-07-21 14:18:27 +09:00
Hajime Hoshi
a3b35e5fba Revert "restorable: Refactoring"
This reverts commit 777cab5cc3.

Reason: Test failures: https://travis-ci.org/hajimehoshi/ebiten/builds/561553656
2019-07-21 14:03:14 +09:00
Hajime Hoshi
777cab5cc3 restorable: Refactoring 2019-07-21 11:05:02 +09:00
Hajime Hoshi
0cf11d9af8 graphicscommand: Improve debug messages
This change also enables to dump volatile images.
2019-07-20 14:31:28 +09:00
Hajime Hoshi
2d079b123f restorable: Add ResetRestoringState to reset the state
After Fill command, the image doesn't have to keep the restoring
information. Now Fill command is as same as DrawTriangles, there
is no way for restorable.Image to know whether it can reset the
state or not. ResetRestoringState clears the state explicitly.
2019-07-20 14:04:02 +09:00
Hajime Hoshi
3f6628f1cc restorable: Replace Fill with Clear 2019-07-20 05:00:05 +09:00
Hajime Hoshi
0dc1d0eba5 graphics: Clear/Fill is now implemented with DrawImage
Only clearing the screen still requires the special method.
2019-07-20 04:34:42 +09:00
Hajime Hoshi
0bf12d5519 graphics: Unify dumping logic 2019-07-20 01:46:33 +09:00
Hajime Hoshi
d78db1738d graphicscommand: Fix comments 2019-07-20 01:22:13 +09:00
Hajime Hoshi
94852b07b2 graphics: Use ID for dumped internal images
Updates #900
2019-07-19 23:41:56 +09:00
Hajime Hoshi
0793d35c40 graphicscommand: Improve debug messages
Fixes #900
2019-07-19 23:35:13 +09:00
Hajime Hoshi
38a1ee7f57 restorable: Split pixel records into regions
Fixes #897
2019-07-19 10:59:48 +09:00
Hajime Hoshi
b4dddd330a restorable: Refactoring: Use width/height instead of length at Pixels 2019-07-17 23:20:03 +09:00
Hajime Hoshi
efb6f9c453 graphicscommand: Remove CopyPixels command
This is an optimization. This change enables to avoid reading
pixels from GPU when extending an image.

Updates #897
2019-07-17 23:19:57 +09:00
Hajime Hoshi
736a840d53 restorable: More restricted Extend
As a side effect, ReplacePixels always record pixels even when
restoring is not needed. As CopyPixels reads pixels in any cases,
this shortcut was originally useless.
2019-07-17 22:15:37 +09:00
Hajime Hoshi
353d81fd58 restorable: Rename NewImageFromImage to Extend 2019-07-17 03:32:08 +09:00
Hajime Hoshi
91a4329f0d restorable: Disallow ReplacePixels for a part after Fill
This simplifies Pixels struct. This is a preparation to change
how to record pixels.

Updates #897
2019-07-17 03:15:03 +09:00
Hajime Hoshi
2735f4eddc restorable: Fix comments 2019-07-17 02:42:26 +09:00
Hajime Hoshi
349a290aa3 restorable: Refactoring 2019-07-16 03:08:26 +09:00
Hajime Hoshi
8ae2fef817 restorable: Refactoring: Do not have to update basePixels in some cases
If there is no draw-traiangles command, the image can keep its
basePixels.
2019-07-16 02:48:52 +09:00
Hajime Hoshi
6d20e3f951 restorable: Add assertion at fillImage 2019-07-16 02:18:52 +09:00
Hajime Hoshi
2b632d0707 restorable: Remove Pixels.Slice() 2019-07-16 02:03:15 +09:00
Hajime Hoshi
f3fa535afb restorable: Refactoring: Disallow nil at ReplacePixels 2019-07-16 01:44:56 +09:00
Hajime Hoshi
84aabd075f restorable: Use DrawTriangles to restore the image
This can avoid allocating a big byte slice.
2019-07-15 05:03:46 +09:00
Hajime Hoshi
7e4e9cc893 restorable: Refactoring 2019-07-15 04:17:52 +09:00
Hajime Hoshi
701c4eeb7c restorable: Fix comments 2019-07-15 03:24:18 +09:00
Hajime Hoshi
a7e7e007ca restorable: Bug fix: PutQuadVertices should take the source image
Fixes #898
2019-07-15 03:10:03 +09:00
Hajime Hoshi
aee26eec1e restorable: Refactoring: Replace CopyPixels with NewImageFromImage 2019-07-15 02:04:23 +09:00
Hajime Hoshi
fd9e376ff6 restorable: Add ClearPixels
This hides the implementation details of allocating byte slice.

This change also adds comments about #897.
2019-07-10 02:39:36 +09:00
Hajime Hoshi
5ec2f66524 shareable: Bug fix: Updated maxSize wrongly
Updates #892
2019-07-04 01:57:04 +09:00
Hajime Hoshi
3a0dbd3977 graphicsdriver/opengl: Use sync.Once for concurrent safety 2019-07-04 01:15:51 +09:00
Hajime Hoshi
6b7f21f0c8 driver: Add Graphics.MaxImageSize and use it
There are some devices that cannot accept 4096x4096 pixels
textures. Get the maximum size and use it.

Fixes #892
2019-07-04 01:10:11 +09:00
Hajime Hoshi
51951d6087 glfw: Take a byte pointer instead of a uintptr at the callback
Make 'go vet' happy on Windows.
2019-06-27 22:57:44 +09:00
Hajime Hoshi
9a0cefedce glfw: Bug fix: Missed to initialize a member of VidMode on Windows 2019-06-27 03:38:14 +09:00
Hajime Hoshi
480c5527a3 ui/mobile: Move 'DoWork' logic to ui/mobile package
This simplifies driver.Graphics interface, and will make it easy
to use another graphics driver than OpenGL.
2019-06-27 00:32:37 +09:00
Hajime Hoshi
e499535728 graphics: Move functions to the package ebiten 2019-06-26 22:23:09 +09:00
Hajime Hoshi
ed09406655 graphicscommand: Bug fix: wrong adjustment of texels
Fixes #887
2019-06-26 11:45:09 +09:00
Hajime Hoshi
f40798b586 graphics: Move const definitions to driver package
Let's keep 'graphics' package as a package for utility functions
or testable functions as much as possible.
2019-06-26 01:05:13 +09:00
Hajime Hoshi
9963ae332e graphics: Remove FilterDefault from internal/graphics 2019-06-26 00:33:30 +09:00
Hajime Hoshi
847a8b4d53 graphics: Refactoring 2019-06-26 00:18:40 +09:00
Hajime Hoshi
93c31654da graphicscommand: Refactoring 2019-06-25 23:55:33 +09:00
Hajime Hoshi
09d473ea1b restorable: Add comments 2019-06-25 23:42:18 +09:00
Hajime Hoshi
7e0dee0730 graphicscommand: Bug fix: Use graphics.InternalImageSize before specifying the size
Fixes #887
2019-06-25 22:47:37 +09:00
Hajime Hoshi
de4b439228 uidriver/glfw: Bug fix: Thread must be set before the loop starts
The graphics driver needs to have its thread before the loop
starts, or the driver crashes (nil reference) when it tries to use
the thread.
2019-06-24 02:03:14 +09:00
Hajime Hoshi
0cc49b6923 shareable: Refactoring 2019-06-23 11:33:17 +09:00
Hajime Hoshi
7a399c1b82 shareable: Update page sizes dynamically
Also, all the images cannot use the shareable backends before the
game starts, but it is expected that read-only images will use
shareable backends later.

Fixes #879
2019-06-22 23:05:28 +09:00
Hajime Hoshi
f48a72a43e shareable: Refactoring: Remove PutQuadVertices 2019-06-22 21:13:44 +09:00
Hajime Hoshi
5d4f150094 shareable: Add comments about highp
Updates #879
2019-06-22 17:41:19 +09:00
Hajime Hoshi
9bff33472a driver: Add (Graphics).HasHighPrecisionFlaot
This enables to determine whether vertices should be adjusted or
not.

Fixes #879
2019-06-22 14:57:53 +09:00
Hajime Hoshi
cddb93b9f6 graphicscommand: Move the texel adjustment logic to graphicscommand package
This is a preparation for #879. The value of the texel adjustment
depends on the graphics driver (GLSL float precisions), and this
can be accessed only after the run loop runs. The place where
graphics commands are executed seems an appropriate place.

Updates #879
2019-06-22 03:52:51 +09:00
Hajime Hoshi
f3cdb0537b graphics: Move the vertices backend to ebiten package
Now restorable/sharable packages cannot use the same vertices
backend, but I think this won't affect the performance
significantly.
2019-06-22 00:02:22 +09:00
Hajime Hoshi
69ebc481e8 graphics: Refactoring: Unify PutVertex and PutQuadVertices implementation 2019-06-21 23:49:05 +09:00
Hajime Hoshi
8dc2301e54 thread: Bug fix: Queue funcs instead of panic
Now the thread object is created at (*UserInterface).Run, we don't
have to care whether the (main) thread is started or not when
Call is called. Admit queueing the functions.

Fixes #884
2019-06-21 11:10:27 +09:00
Hajime Hoshi
3eee4754c5 graphics: Use the common vertices backend for PutVertex 2019-06-21 02:30:58 +09:00
Hajime Hoshi
008de78cec graphics: Refactoring: Change QuadVertices -> PutQuadVertices for consistency 2019-06-21 02:20:31 +09:00
Hajime Hoshi
c7ab66e0e1 graphicsdriver/metal: Move MTLDevice and CAMetalLayer to the other struct
On iOS, they are given or included in a MTKView and we don't have
to (or should not) make them. Let's move them to a different
struct.
2019-06-19 02:17:45 +09:00
Hajime Hoshi
57d493a549 web: Optimization: Cache user agent value 2019-06-17 10:56:50 +09:00
Hajime Hoshi
4396978d4b jsutil: Refactoring 2019-06-17 10:48:36 +09:00
Hajime Hoshi
34187d03a8 jsutil: Remove unused functions 2019-06-15 01:34:28 +09:00
Hajime Hoshi
c52e043006 Add jsutil package for new API of Go 1.13
Audio part still cannot be compiled due to Oto.

Fixes #878
2019-06-15 00:49:57 +09:00
Hajime Hoshi
a19bf4214b Improve testability on Wasm 2019-06-14 23:59:38 +09:00
Hajime Hoshi
3af351a2aa graphicsdriver/metal: Make this compilable on iOS
This change adds #ifs to enable to compile the driver on iOS.

This also removes BOOL, which can be a duplicated definition.
C's _Bool does not work well with Cgo. Use uint8_t instead for
boolean values.
2019-06-09 05:51:10 +09:00
Hajime Hoshi
67230ec499 graphicsdriver/metal/mtl: Remove CopyAllDevices
CopyAllDevices is not used at Ebiten, and not defined on iOS.
2019-06-09 04:32:48 +09:00
Hajime Hoshi
fa377ce9d1 mobile: Refactoring 2019-06-08 01:57:13 +09:00
Hajime Hoshi
449679665b thread: Use standard context.Context 2019-06-08 01:46:06 +09:00
Hajime Hoshi
1e93d9c699 graphicsdriver/opengl: Use context.Context when possible 2019-06-08 01:30:15 +09:00
Hajime Hoshi
9c283d45b4 thread: started should be reset after Loop 2019-06-06 00:25:57 +09:00
Hajime Hoshi
85dcafe176 thread: Rename Run -> Call 2019-06-06 00:25:57 +09:00
Hajime Hoshi
15a5896efd thread: Rename mainthread -> thread and add struct Thread
This enables thread available not only for the main thread but also
any threads.

This is a preparation for iOS Metal, that runs drawing functions on
a particular thread.

Updates #737
2019-06-06 00:25:53 +09:00
Hajime Hoshi
9b82ec41de graphicsdriver/opengl: Refactoring: Remove unused variables 2019-06-04 02:11:14 +09:00
Hajime Hoshi
dbd5e25b89 uidriver/mobile: Bug fix: Error must be handled whenever possible
Updates #860
2019-06-01 03:12:04 +09:00
Hajime Hoshi
2dc6042858 uidriver/mobile: Remove time-out logic
This was introduced at 8121b2102f.
I am not sure the reason.

As Render must sync with updating and never returns until updating
finishes, the time-out case should never be chosen.
2019-06-01 01:47:01 +09:00
Hajime Hoshi
13ce1c28b4 uidriver/mobile: Use timer.NewTimer instead of time.After
timer.NewTimer is much better than time.After in terms of memory
usage. See also https://golang.org/pkg/time/#After
2019-06-01 01:30:08 +09:00
Hajime Hoshi
ca907e2846 uidriver/mobile: Refactoring 2019-06-01 00:21:59 +09:00
Hajime Hoshi
ffb9871839 restorable: Bug fix: Skip the screen image to check invalidation 2019-05-28 11:29:34 +09:00
Hajime Hoshi
24822c0a10 restorable: Rename clear -> clearForInitialization 2019-05-26 23:13:54 +09:00
Hajime Hoshi
b41a333230 restorable: Reland: Refactoring 2019-05-26 22:16:25 +09:00
Hajime Hoshi
3ab56778e7 graphicscommand: Bug fix: restorable should be enabled if not sure
init function in restorable package might reach this condition,
and for fail-safe, restoring should be enabled.
2019-05-26 22:15:41 +09:00
Hajime Hoshi
83254d30d9 restorable: Bug fix: semantic inconsistency at forceRestoring 2019-05-26 21:40:10 +09:00
Hajime Hoshi
da4fabeaa5 Revert "restorable: Refactoring"
This reverts commit 3c0cd47b1f.

Reason: Crash on macOS
2019-05-26 21:30:08 +09:00
Hajime Hoshi
3c0cd47b1f restorable: Refactoring 2019-05-26 21:24:44 +09:00
Hajime Hoshi
fcb5554aa1 driver: Add Graphics.NeedsRestoring 2019-05-26 19:46:12 +09:00
Acid147
21abd85a63 Small cleanup (#877)
* Remove unused variables and constants
* Remove redundant return statement
* Change flock.NewFlock to flock.New
2019-05-26 18:06:43 +09:00
Hajime Hoshi
f9cec31bf6 clock: Assert that now() must be monotonic
This change adds panics to ensure that now() must be monotonic.

Bug: #875
2019-05-24 22:59:02 +09:00
Hajime Hoshi
22dfefab5b clock: Fix coments 2019-05-24 03:18:47 +09:00
Hajime Hoshi
bbcee77b02 clock: Use time.Since for monotonic timer
Fixes #875
2019-05-24 03:16:43 +09:00
Hajime Hoshi
9c1b760016 clock: Bug fix: The timer should continue even when the clock is adjusted
If the clock is reversed:
* lastSystemTime should be reset with the current time
* FPS/TPS calculation state should be reset
2019-05-24 02:24:32 +09:00
Hajime Hoshi
0eb5ef0141 clock: Remove unused variables 2019-05-24 02:20:23 +09:00
Hajime Hoshi
c2bc6408a3 clock: Bug fix: Do not pacic even when the clock is reversed
It is theoreticaly possible to change the clock. Ebiten should not
panic whatever the clock time is.
2019-05-24 02:14:24 +09:00
Hajime Hoshi
da671a6d8c glfw: Better way to get C files 2019-05-20 03:48:58 +09:00
Hajime Hoshi
289fb77d20 glfw: Sort C files in alphabetical order 2019-05-20 03:48:49 +09:00
Hajime Hoshi
f461ba2379 shareable: Misspelling 2019-05-12 17:53:18 +09:00
Hajime Hoshi
bc4e35a6c5 shareable: Make images shared when possible
Fixes #864
2019-05-12 00:36:15 +09:00
Hajime Hoshi
b03c02dd28 graphicsdriver/metal: Bug fix: Reading pixels from GPU causes blinking
Metal's Drawable should be obtained only when needed, or reading
pixels from GPU causes the blinking screen.

Fixes #865
2019-05-11 23:52:35 +09:00
Hajime Hoshi
0bed5a96d5 clock: Better URL to explain being monotonic 2019-05-09 02:45:43 +09:00
Hajime Hoshi
009fa9accd clock: Ensure that now() is monotonic 2019-05-09 02:44:14 +09:00
Hajime Hoshi
c65d035cc9 clock: Bug fix: Use float64 not to overflow
Bug: #862
2019-05-09 01:14:48 +09:00
Hajime Hoshi
39395c4c76 graphicscommand: Rename draw-image -> draw-triangles 2019-05-08 11:58:17 +09:00
Hajime Hoshi
9a31bcd53d devicescale: Remove the updating loop
Now the value is cached, the updating loop is no longer needed.
2019-05-08 01:14:22 +09:00
Hajime Hoshi
836e320b6b devicescale: Refactoring 2019-05-05 18:09:49 +09:00
Hajime Hoshi
ea284d86fd graphicsdriver/metal: Add setView for iOS and non-iOS 2019-05-03 03:08:46 +09:00
Hajime Hoshi
10fb5e33be Replace GopherWasm with syscall/js
Fixes #857
2019-05-01 17:28:00 +09:00
Hajime Hoshi
cce41e8152 graphics: Rename DrawImage -> DrawTriangles for consistency 2019-04-22 23:12:36 +09:00
Hajime Hoshi
7d9bc8586e graphcisdriver/metal: Better comment 2019-04-20 17:05:05 +09:00
Hajime Hoshi
b99f4c61b5 graphicsdriver/metal: Make (*Driver).Flush do nothing 2019-04-20 16:50:40 +09:00
Hajime Hoshi
72be1bde24 graphicsdriver/metal: Set and reset screenDrawable more correctly 2019-04-20 16:26:34 +09:00
Hajime Hoshi
a064955a13 graphicsdriver/metal: Use NSAutoreleasePool to release drawable correctly
Fixes #847
2019-04-20 15:20:38 +09:00
Hajime Hoshi
bfe1d2208e Revert "graphicsdriver/metal: Bug fix: Release drawable correctly"
This reverts commit c44accbfb5.

Reason: This change doesn't make sense
2019-04-20 00:28:09 +09:00
Hajime Hoshi
c44accbfb5 graphicsdriver/metal: Bug fix: Release drawable correctly
Fixes #847
2019-04-19 20:23:00 +09:00
Hajime Hoshi
865523048d uidriver/js: Bug fix: Touches were not updated correctly
Fixes #846
2019-04-15 03:01:02 +09:00
Hajime Hoshi
e6c0c73b9e graphicscommand: Add assertion (the screen cannot be a render source) 2019-04-13 00:22:11 +09:00
Hajime Hoshi
5afcc65387 shareable: Add comments 2019-04-11 18:15:56 -07:00
Hajime Hoshi
db689f4e50 driver: Remove UI.Loop and add UI.RunWithoutMainLoop 2019-04-09 21:55:59 -04:00
Hajime Hoshi
864c28e8d9 Revert "uidriver/glfw: Rename ui_unix.go -> ui_linbsd.go"
This reverts commit 794ccd6ade.
2019-04-09 01:06:07 -04:00
Hajime Hoshi
794ccd6ade uidriver/glfw: Rename ui_unix.go -> ui_linbsd.go 2019-04-09 00:39:20 -04:00
Hajime Hoshi
24fdcdd8e4 uidriver: Rename updateGraphics -> updateSize 2019-04-08 23:49:31 -04:00
Hajime Hoshi
f6367308fc driver: Rename GraphicsContext -> UIContext 2019-04-08 23:28:08 -04:00
Hajime Hoshi
aecfd6b13d uidriver: Remove dependency on hooks package 2019-04-08 23:13:44 -04:00
Hajime Hoshi
099c7bd5c9 driver: Remove Touch struct 2019-04-07 19:25:10 -04:00
Hajime Hoshi
08308a7edf uidriver/mobile: Refactoring 2019-04-07 18:51:32 -04:00
Hajime Hoshi
0aa3135082 driver: Remove UI.AdjustPosition 2019-04-07 19:31:49 +09:00
Hajime Hoshi
26c32d36b5 uidriver: Move input implementation to uidrivers 2019-04-07 19:16:00 +09:00
Hajime Hoshi
a1697feeb1 driver: Add UI.Input() 2019-04-07 18:37:54 +09:00
Hajime Hoshi
7e5085f15b Add uidriver package and move UI implementation to this packaage 2019-04-07 18:21:16 +09:00
Hajime Hoshi
a4a129e3af ui: Rename currentUI -> theUI 2019-04-07 11:10:55 +09:00
Hajime Hoshi
6b8516c7a5 driver: Move ui.RegularTermination to driver 2019-04-07 10:54:05 +09:00
Hajime Hoshi
1b8d4abfdb driver: Move ui.GraphicsContext to driver 2019-04-07 10:48:18 +09:00
Hajime Hoshi
b579bd7fd0 graphics: Remove GraphicsContext.Invalidated 2019-04-07 10:08:55 +09:00
Hajime Hoshi
6cdcd1ee62 input: Refactoring: Remove input dependencies from ui 2019-04-06 23:42:55 +09:00
Hajime Hoshi
a980de8326 ui: Take the Input driver 2019-04-06 23:29:13 +09:00
Hajime Hoshi
de9f54fd9d driver: Add Input 2019-04-06 21:48:54 +09:00
Hajime Hoshi
bf165ae9d4 devicescale: Refactoring 2019-04-03 23:20:45 +09:00
Hajime Hoshi
0d0b347411 devicescale: Use more runtime.KeepAlive for Windows 2019-04-03 11:57:00 +09:00
Hajime Hoshi
8005682786 devicescale: Use runtime.KeepAlive for Windows
This might be related to the bug #832
2019-04-03 11:53:23 +09:00
Hajime Hoshi
d56668bfdb input: Use sync.Once 2019-03-31 20:38:46 +09:00
Hajime Hoshi
f5c68d2a61 input: Refactoring 2019-03-31 20:20:52 +09:00
Hajime Hoshi
80dcec865d ui: Refactoring: Remove pollEvents 2019-03-31 19:51:53 +09:00
Hajime Hoshi
c21fb4d390 input: Move Touch to driver package 2019-03-31 18:58:43 +09:00
Hajime Hoshi
e273618081 input: Rename Reset -> ResetForFrame 2019-03-31 18:49:00 +09:00
Hajime Hoshi
9e5261c156 input: Change touches type 2019-03-31 17:15:27 +09:00
Hajime Hoshi
64d3e26fb0 input: Rename UpdateTouches -> SetTouches 2019-03-31 16:30:03 +09:00
Hajime Hoshi
06219db2cc input: Replace Touches with TouchIDs and TouchPosition 2019-03-31 02:59:48 +09:00
Hajime Hoshi
0536efd95f ui: Remove AdjustedCursorPosition 2019-03-31 02:06:42 +09:00
Hajime Hoshi
dec6be1a11 ui: Remove AdjustedTouches 2019-03-31 02:03:59 +09:00
Hajime Hoshi
5d6f66935a ui: Remove UpdateTouches 2019-03-31 01:54:38 +09:00
Hajime Hoshi
43ec1e7fb3 input: Refactoring: Make Touch a struct 2019-03-31 01:14:49 +09:00
Hajime Hoshi
853dbdf19d input: Refactoring 2019-03-31 00:45:52 +09:00
Hajime Hoshi
486a6134e4 Bug fix: compilation error on browsers and mobiles 2019-03-30 23:59:17 +09:00
Hajime Hoshi
7dca1889a1 input: Move Key to driver package 2019-03-30 23:39:56 +09:00
Hajime Hoshi
e5b1aa8742 png: Update for Go 1.12 2019-03-30 23:27:09 +09:00
Hajime Hoshi
c5a8c88e2d input: Move MouseButton and GamepadButton to driver package 2019-03-30 23:19:52 +09:00
Hajime Hoshi
7445144194 Move graphicsdriver.GrapahicsDriver to driver.Graphics 2019-03-30 22:38:02 +09:00
Hajime Hoshi
747d1be54e driver: Move getting actual drivers to ebiten package 2019-03-30 22:19:21 +09:00
Hajime Hoshi
f2e42c3ea1 ui: Remove dependencies on driver package 2019-03-30 21:59:11 +09:00
Hajime Hoshi
d6d57fdadf ui: Refactoring 2019-03-28 03:36:31 +09:00
Hajime Hoshi
8ec7ae4c08 Rename drivers -> driver 2019-03-28 01:48:45 +09:00
Hajime Hoshi
5e38f81462 Create packages drivers having actual drivers 2019-03-25 00:29:56 +09:00
Hajime Hoshi
92193b2362 input: Remove unnecessary empty slices 2019-03-24 23:44:36 +09:00
Hajime Hoshi
dbc3461628 ui: Use flexbox for centering 2019-03-20 01:44:36 +09:00
Hajime Hoshi
1392129e41 devicescale: Cache scale values 2019-03-12 01:31:18 +09:00
Hajime Hoshi
a3882dbc37 ui: Bug fix: devicescale.GetAt must be called on the main thread 2019-03-12 00:28:37 +09:00
Hajime Hoshi
f56c3bd096 ui: Unexport SetWindowResizable (#320) 2019-02-25 02:19:47 +09:00
Hajime Hoshi
ea7c2f8da3 ui: Bug fix: Wrong assumption that the position was always >= 0 2019-02-24 23:34:36 +09:00
Hajime Hoshi
ba59cdbc5f ui: Bug fix: The window must be shown on the current monitor (#829) 2019-02-24 23:26:07 +09:00
Hajime Hoshi
d4a522d9da glfw: Bug fix: Do not pass Go's int pointer
Go's int can be 64bit or 32bit, while C's int is always 32bit on
Windows in Ebiten usage. For C's int argument, do not pass Go's
int pointer or broken values are set.

Related to #829
2019-02-24 23:10:18 +09:00
Hajime Hoshi
288e0a33ba ui: Bug fix: SetSizeCallback must be effective only when the window is resizable
This is not a perfect solution but at least this fixes the
regression.

Fix #819
2019-02-24 03:25:38 +09:00
Hajime Hoshi
f19d7a29b8 graphicsdriver/metal: Do not release a nil texture (screen) 2019-02-22 00:37:49 +09:00
Hajime Hoshi
dbe4f27d5f shareable: Add comments
Oops, 0dcb53d290 did not make sense.
2019-02-21 10:58:40 +09:00
Hajime Hoshi
0dcb53d290 shareable: Bug fix: Node-leak when extending a page
This is very rare and not so serious I think, but is still a bug.
2019-02-21 10:49:23 +09:00
Hajime Hoshi
0bf911905a Revert "graphicsdriver/opengl: Call glFinish before glReadPixels"
This reverts commit 04dc1faa9c.

Reason: True fix for #814 is 82178794c3
2019-02-19 10:55:06 +09:00
Hajime Hoshi
82178794c3 shareable: Bug fix: Unlock after filling
Fixes #820
2019-02-19 10:16:27 +09:00
Hajime Hoshi
ccacf015c2 Revert "restorable: Bug fix: Guard images by mutex"
This reverts commit 7967f68073.

Reason: Wrong fix (syncing should be done at shareable package)
2019-02-19 10:15:23 +09:00
Hajime Hoshi
7967f68073 restorable: Bug fix: Guard images by mutex
The map must be guarded by mutex since this can be accessed by
multiple goroutines, including finalizer goroutine.

Fixes #820
2019-02-19 10:10:46 +09:00
Hajime Hoshi
d724e17032 graphicsdriver/metal: Bug fix: Wrong usage of RenderPipelineState for screen 2019-02-17 21:41:47 +09:00
Hajime Hoshi
84b1c282ff graphicsdriver/opengl: Refactoring by reduing unused variables 2019-02-17 20:22:03 +09:00
Hajime Hoshi
3aa6eb3a66 graphicsdriver: Optimize shaders for the case of FILTER_SCREEN
Assume a color matrix or color vertex values are not used when
the filter is FILTER_SCREEN.
2019-02-17 19:40:52 +09:00
Hajime Hoshi
cbb0a1da95 graphicsdriver: Refactoring
This improved FPS on mobiles a little bit. Maybe now texture2D is
called only when necessary, but not sure.
2019-02-17 17:37:11 +09:00
Hajime Hoshi
742bbb4ccd graphicsdriver: Simplify clamping color values
For negative values, OpenGL (and Metal) should take care of them
so we don't have to care.
2019-02-17 15:09:05 +09:00
Hajime Hoshi
3d8a45a770 graphicsdriver/opengl: Refactoring 2019-02-17 14:30:32 +09:00
Hajime Hoshi
d927241223 graphicsdriver/opengl: Remove unnecessary function calls 2019-02-17 11:44:50 +09:00
Hajime Hoshi
3ecb00f717 graphicsdriver: Optimize shaders
Simplified the case when a color matrix is not used.
2019-02-16 23:53:22 +09:00
Hajime Hoshi
a8b97c9755 graphicsdriver: Optimize shader (skip color matrix calculation)
Skip multiplying with a color matrix when possible.
2019-02-16 17:33:12 +09:00
Hajime Hoshi
815ed8cda2 graphicsdriver: Optimize shader by removing 'if' 2019-02-16 16:39:02 +09:00
Hajime Hoshi
1f46299870 graphicsdriver/opengl: Bug fix: source_size can be optimized out with nearest filter 2019-02-16 15:14:48 +09:00
Hajime Hoshi
b1b8d0b4b1 graphics: Move texel-region adjustment from shaders to program
This reduces GPU burden.
2019-02-16 14:50:03 +09:00
Hajime Hoshi
09ca873c41 graphicsdriver/opengl: Use glBindAttribLocation instead of glGetAttribLocation
Attribute variables are often optimized out and it is really hard
to prevent this.

Instead of implicit indices of attribute variables, use explicit
indices by glBindAttribLocation.

Bug: #816
2019-02-16 14:35:53 +09:00
Hajime Hoshi
7ff99d3965 graphicsdriver/opengl: Remove glGetError calls
As glGetError doesn't tell where the error happens, this is not
useful.

Fixes #815
2019-02-16 10:00:27 +09:00
Hajime Hoshi
fc329bd215 graphicsdriver/metal: Use template specialization 2019-02-15 09:46:58 +09:00
Hajime Hoshi
3f28592700 graphics: Refactoring: Remove PutVertex 2019-02-15 00:22:32 +09:00
Hajime Hoshi
7c506bc5bc restorable: Refactoring: Add (*Image).QuadVertices/PutVertex 2019-02-15 00:18:12 +09:00
Hajime Hoshi
a06a2b65c1 shareable: Fix semantically incorrect function usage
In this case, the size equals to the internal size, so this is not
a bug fix.
2019-02-14 23:23:52 +09:00
Hajime Hoshi
fd250c8d8c graphics: Rename NextPowerOf2Int -> InternalImageSize and add image size adjustment
There is a minimum internal image size on some system like old iOS
devices. This change adds adjustment of the size.

Issue: #810
2019-02-14 23:06:01 +09:00
Hajime Hoshi
a2fe3d5962 restorable: Refactoring: Use InternalSize instead of NextPowerOf2Int 2019-02-14 22:39:19 +09:00
Hajime Hoshi
4e8c7f0a75 restorable: Rename SizePowerOf2 -> InternalSize 2019-02-14 20:56:38 +09:00
Hajime Hoshi
a6d3a1e0cb graphicsdriver/metal: Refactoring: Use NextPowerOf2Int 2019-02-14 11:09:16 +09:00
Hajime Hoshi
a1b1bce43a graphicsdriver/metal: Bug fix: Some tests failed due to wrong source size 2019-02-14 11:06:30 +09:00
Hajime Hoshi
7a76a5b42d graphicsdriver/metal: Remove while loop in shader programs 2019-02-14 10:54:32 +09:00
Hajime Hoshi
5c7f34827f graphicsdriver/metal: Use template specialization 2019-02-14 09:57:47 +09:00
Hajime Hoshi
04dc1faa9c graphicsdriver/opengl: Call glFinish before glReadPixels
It looks like glFlush is not enough at least on Travis CI.

Fixes #814
2019-02-14 02:03:05 +09:00
Hajime Hoshi
0546783ad5 restorable: Don't call (*graphicscommand.Image).Pixels twice (2) 2019-02-14 01:00:27 +09:00
Hajime Hoshi
3faa674e32 restorable: Don't call (*graphicscommand.Image).Pixels twice 2019-02-14 00:54:02 +09:00
Hajime Hoshi
3952474690 graphics/metal: Fix comments 2019-02-13 23:36:45 +09:00
Hajime Hoshi
81101e0f48 graphicsdriver/metal: Reduce 'if' from shader programs (#762) 2019-02-13 23:28:17 +09:00
Hajime Hoshi
27dbf1bbb7 restorable: Record more drawing image history items
Fixes #813
2019-02-13 10:45:08 +09:00
Hajime Hoshi
6930176fbb restorable: Add restorable.Pixels 2019-02-13 00:46:24 +09:00
Hajime Hoshi
93d0b0dd09 restorable: Add Fill
This is useful to reduce opportunity to make the image stale.
2019-02-13 00:46:24 +09:00
Hajime Hoshi
40f728a326 shareable: Call (*restorable.Image).Clear() when possible
This is a kind of relanding of c68c36b0b7.
Clearing the restorable.Image state can reduce the operations for
restoring.
2019-02-13 00:41:26 +09:00
Hajime Hoshi
5fed3d3bed shareable: Add MakeVolatile 2019-02-13 00:41:24 +09:00
Hajime Hoshi
5147bbde9d restorable: Add MakeVolatile 2019-02-13 00:39:54 +09:00
Hajime Hoshi
f613cd1407 restorable: Remove Pixels that is not used anywhere 2019-02-13 00:31:00 +09:00
Hajime Hoshi
c2c3579cde graphicsdriver/opengl: Reduce 'if' in shader programs
Fixes #812
2019-02-12 12:46:18 +09:00
Hajime Hoshi
6c4260d0e1 Revert "graphicsdriver/opengl: Use GL_RGBA8 as the internal format at glTexImage2D"
This reverts commit f5044f3d8f.

Reason: This doesn't work on some iOS machines
2019-02-12 03:34:06 +09:00
Hajime Hoshi
4273f1982d devicescale: Bug fix: Need to consider Y axis direction on macOS
Fixes #807
2019-02-10 23:34:15 +09:00
Hajime Hoshi
8e42484294 graphicscommand: Add 'address' to (*DrawImageCommand).String 2019-02-10 14:27:49 +09:00
Hajime Hoshi
6f428c584d shareable: Add comments 2019-02-10 14:13:00 +09:00
Hajime Hoshi
339155f63d shareable: Use CompositeModeSourceOver when possible at Fill 2019-02-10 14:08:59 +09:00
Hajime Hoshi
1150fc69d0 shareable: Use color vertex values instead of ColorM
This is an optimization: using ColorM might cause graphics command
separation.
2019-02-10 14:02:01 +09:00
Hajime Hoshi
f5044f3d8f graphicsdriver/opengl: Use GL_RGBA8 as the internal format at glTexImage2D
Related: #810
2019-02-09 21:27:46 +09:00
Hajime Hoshi
815f2a6b35 shareable: Improve panic messages 2019-02-09 19:47:45 +09:00
Hajime Hoshi
a5421de8ab mainthread: Add comments 2019-02-08 20:32:00 -10:00
Hajime Hoshi
87b4b8b1b4 mainthread: Disable panic temporarily
Fixes #809
2019-02-08 20:11:48 -10:00
Hajime Hoshi
a3eddeb50f Improve panic messages 2019-02-06 23:43:03 -10:00
Hajime Hoshi
9d291f601e graphicsdriver/metal: Bug fix: Make all the tests pass 2019-02-06 23:42:54 -10:00
Hajime Hoshi
207ae08c9d graphicsdriver/metal: Give up reusing buffers
It was inevitable to rely on reference counts, which was too hacky.
Besides, reusing buffers doesn't improve performance.
2019-02-05 03:22:50 +09:00
Hajime Hoshi
19079ae7a2 graphicsdriver/metal: Fix comments 2019-02-05 03:09:40 +09:00
Hajime Hoshi
f29337dc93 graphicsdriver/metal: Add comments 2019-02-03 23:58:45 +09:00
Hajime Hoshi
882d0c0bc8 graphicsdriver/metal: Reuse MTLBuffer instead of re-creating (#762) 2019-02-03 22:55:29 +09:00
Hajime Hoshi
a8dcd5c628 Replace go-flock with flock 2019-02-03 14:20:20 +09:00
Hajime Hoshi
d3d56c076d shareable: Use CopyPixels
CopyPixels is basically Pixels and ReplacePixels, but executed
lazily while Pixels reads pixels from GPU immediately. Thanks to
this, restorable.Image no longer need to keep pixel data if not
needed.
2019-02-03 02:51:56 +09:00
Hajime Hoshi
b89602d900 restorable: Add more comments 2019-02-02 19:19:03 +09:00
Hajime Hoshi
05d78b4232 mainthread: Cause panic when trying to run before initialization 2019-02-02 19:00:15 +09:00
Hajime Hoshi
bcd9db669d Revert "restorable: Don't record pixels when restoring is disabled"
This reverts commit aad7bdc64d.

Reason: This causes application freezing at least on macOS
2019-02-02 18:39:51 +09:00
Hajime Hoshi
204b0e72d6 graphicsdriver/metal: Do not wait until completed when possible (#762) 2019-02-02 04:35:38 +09:00
Hajime Hoshi
aad7bdc64d restorable: Don't record pixels when restoring is disabled 2019-02-02 00:44:02 +09:00
Hajime Hoshi
5be567d58f ui: Implement restoring context lost on browsers correctly
Fixes #734
2019-02-01 01:20:40 +09:00
Hajime Hoshi
ba47a19b17 mobile: Bug fix: error must be received without waiting for renderCh
Even when error happens, the error was not received when renderCh
received. This was the cause of freezing when error happens.
2019-01-28 12:32:48 +09:00
Hajime Hoshi
3ac1996f9d clock: Avoid overflow by using time duration on Windows 2019-01-27 17:31:30 +09:00
Hajime Hoshi
3691083cee clock: Use a more precise timer on Windows
This change is based on @silbinarywolf's change:
https://github.com/hajimehoshi/ebiten/issues/798#issuecomment-457822280

Fixes #798
2019-01-26 21:16:35 +09:00
Hajime Hoshi
b65a3d372b affine: Add ColorM.Scale tests 2019-01-23 02:50:30 +09:00
Hajime Hoshi
54019a4735 affine: Improve speed of ScaleOnly 2019-01-23 02:10:59 +09:00
Hajime Hoshi
2b0dff197e restorable: Fix comments (#793) 2019-01-22 23:33:56 +09:00
Hajime Hoshi
158f4fb3ed restorable: Bug fix: Reading pixels from a volatile image might fail
Fixes #793
2019-01-22 03:35:54 +09:00
Hajime Hoshi
ec08a75332 restorable: Add assertions 2019-01-21 02:17:09 +09:00
Hajime Hoshi
e2cfb2da6f restorable: Fix comments 2019-01-21 00:41:54 +09:00
Hajime Hoshi
eeb8fea778 restorable: Bug fix: dummyImage must be restored first
Fixes #791
2019-01-21 00:36:53 +09:00
Hajime Hoshi
4d05baf97c examples/contextlost: Bug fix: dummyImage must belong to theImages 2019-01-21 00:11:34 +09:00
Hajime Hoshi
55e9a861d0 ui: Bug fix: isRunning should never be 'false' even after Run on GopherJS 2019-01-19 03:29:07 +09:00
Hajime Hoshi
78ed824351 graphics: Make verticesBackend concurrent safe
Fixes #789
2019-01-19 02:06:50 +09:00
Hajime Hoshi
248f51cc02 ui: Fix comments 2019-01-17 23:40:33 +09:00
Hajime Hoshi
fd4cdd445c graphicsdriver/opengl/gl: Unexport or remove C symbols (#786) 2019-01-17 22:16:47 +09:00
Hajime Hoshi
645b94de5f ui: Bug fix: actualScreenScale must be called on the main thread 2019-01-16 23:32:47 +09:00
Hajime Hoshi
107dfe5074 graphics: Improve Set speed
On GopherJS, copying a struct is very heavy. This change avoids
copying (color) structs when possible.
2019-01-14 04:25:43 +09:00
Hajime Hoshi
6ed4bbc0a2 ui: Fix comments 2019-01-13 22:51:24 +09:00
Hajime Hoshi
9e11477d6c restorable: Bug fix: volatile image must be cleared when recovering from the context lost
This fixes the bug that examples/contextlost crashes.
2019-01-13 22:30:08 +09:00
Hajime Hoshi
607186859d ui: Run returns immediately on GopherJS
Fixes #778
2019-01-13 22:16:33 +09:00
Hajime Hoshi
1e1f309a1c shareable: Add Fill
Before introducing Fill, filling an image with a solid color was
implemented by ReplacePixels. When an offscreen image is used, the
offscreen image is not fully cleared or filled with a color and
out of (0,0)-(width,height) region. This causes a glitch thin line
on mobile platforms.

This change adds (*shareable.Image).Fill to fill the whole
framebuffer region of the image.
2019-01-13 02:12:47 +09:00
Hajime Hoshi
90efddd6b3 restorable: Bug fix: Clearing a new image region was wrong 2019-01-12 16:16:50 +09:00
Hajime Hoshi
ce21125345 graphicscommand: Rename functions 2019-01-12 01:33:27 +09:00
Hajime Hoshi
dc0c6e0907 graphicscommand: Use GL on macOS 10.11 or older (#781) 2019-01-12 01:30:47 +09:00
Hajime Hoshi
72c1a73cac graphicsdriver/metal: Avoid using @available syntax for old Xcode (#781) 2019-01-12 00:33:45 +09:00
mebusy
0419aec617 graphicscommand: Use Opengl instead on early MacOSX platform which does not support Metal (#779) 2019-01-11 22:34:23 +09:00
Hajime Hoshi
6783aaae56 graphics: Better test for a crash 2019-01-11 00:31:32 +09:00
Hajime Hoshi
c4e98de804 shareable: Refactoring 2019-01-10 23:31:53 +09:00
Hajime Hoshi
4a587f495d restorable: Bug fix: ReplacePixels might call DrawImage, which violates some assumptions 2019-01-10 23:22:59 +09:00
Hajime Hoshi
a6b3f761f8 audio: Refactoring: Remove dependency on clock package 2019-01-10 00:59:38 +09:00
Hajime Hoshi
5514a9c6ac ui: Bug fix: Changing screen size didn't work correctly on Windows
Fixes #775
2019-01-09 11:08:27 +09:00
Hajime Hoshi
28665cfc4b glfw: Bug fix: Compilation error on Windows 2019-01-09 10:34:54 +09:00
Hajime Hoshi
ae84e79d16 ui: Add IsWindowResizable and SetWindowResizable (again)
Fixes #320
2019-01-09 00:24:16 +09:00
Hajime Hoshi
0d4e903b7a Revert "ui: Add IsWindowResizable and SetWindowResizable"
This reverts commit f403e0716f.

Reason: Compilation error on browsers
2019-01-09 00:12:57 +09:00
Hajime Hoshi
f403e0716f ui: Add IsWindowResizable and SetWindowResizable
Fixes #320
2019-01-08 23:52:53 +09:00
Hajime Hoshi
12f7d14d91 graphicsdriver/opengl: Check the reserved keyword
Fixes #772
2019-01-08 00:07:49 +09:00
Hajime Hoshi
758b957b01 graphicsdriver/opengl: Bug fix: filter is a preserved keyword (#771) 2019-01-07 11:20:29 +09:00
Hajime Hoshi
7f656f11d6 ui: Bug fix: Minimum window width should be 1 when the window is not decorated 2019-01-07 00:46:41 +09:00
Hajime Hoshi
b34834a895 graphicscommand: Explicitly forbide ReplacePixels for a part after DrawImage 2019-01-06 05:15:27 +09:00
Hajime Hoshi
1cfd97cde0 restorable: Clearing is not needed after NewImage 2019-01-06 03:40:59 +09:00
Hajime Hoshi
b5c9cd6253 shareable: Fix comments 2019-01-06 03:15:32 +09:00
Hajime Hoshi
123be16699 graphicsdriver/opengl: Use NewLazySystemDLL instead of NewLazyDLL (#766) 2019-01-04 15:05:27 +09:00
Hajime Hoshi
f2dcc8ccdb devicescale: Use NewLazySystemDLL instead of NewLazyDLL (#766) 2019-01-04 06:11:59 +09:00
Hajime Hoshi
db1b664424 devicescale: Refactoring: define Windows error consts 2019-01-04 06:05:35 +09:00
Hajime Hoshi
75a024e40e devicescale: Bug fix: GetWindowDC returns error on Wine
Fixes #743
2019-01-04 05:58:34 +09:00
Hajime Hoshi
5c1b0bbcec devicescale: Remove 'syscall' package usages (#766) 2019-01-04 05:53:18 +09:00
Hajime Hoshi
f2840bb0dc ui: Remove 'syscall' package usages (#766) 2019-01-04 05:28:46 +09:00
Hajime Hoshi
623bfde007 graphicsdriver/metal/ca: Suppress warnings (#767) 2019-01-02 01:16:54 +09:00
Hajime Hoshi
ac6ad717b7 graphicsdriver/metal: Use selector again to access properties (#767) 2019-01-02 01:09:12 +09:00
Hajime Hoshi
6350cb6bfd graphicsdriver/metal/ca: Add check by respondsToSelector (#767) 2019-01-02 00:52:03 +09:00
Hajime Hoshi
a0a17330ee graphicsdriver/metal: Specify macOS version (#768) 2019-01-02 00:08:46 +09:00
Hajime Hoshi
61afdc8852 graphicsdriver/metal: Remove unused properties (#767) 2019-01-01 05:09:02 +09:00
Hajime Hoshi
947fbe0a2e glwf: Implement SetIcon 2018-12-31 15:49:45 +09:00
Hajime Hoshi
efc7225ee1 glfw: Skip error check at proc call 2018-12-31 15:48:37 +09:00
Hajime Hoshi
a21a4c75b0 glfw: Implement DLL version of the binding 2018-12-31 15:48:34 +09:00
Hajime Hoshi
a9455d1c32 glfw: Add loading DLL 2018-12-31 15:46:06 +09:00
Hajime Hoshi
ad285c2235 glfw: Add DLL build results
This also adds fixes for 32bit machines.
2018-12-31 15:46:01 +09:00
Hajime Hoshi
90f82de5ef glfw: Separate glfw-dependent part and the other part 2018-12-30 20:45:50 +09:00
Hajime Hoshi
55c2fa4de1 Use internal/glfw 2018-12-30 02:35:46 +09:00
Hajime Hoshi
1fd445b0e4 glfw: Start implementing glfw package (Key) 2018-12-30 01:11:49 +09:00
Hajime Hoshi
83787123ac ui: Refactoring 2018-12-28 14:08:44 +09:00
Hajime Hoshi
b349efaa0a graphicsdriver/metal: Make main-thread usages more explicit 2018-12-28 02:43:00 +09:00
Hajime Hoshi
86bda42417 graphicsdriver/metal: Refactoring: vsync member variable was not needed 2018-12-28 02:29:56 +09:00
Hajime Hoshi
105909ab6c graphicsdriver/metal: Bug fix: SetVsyncEnabled before Run didn't work on macOS 2018-12-28 02:23:39 +09:00
Hajime Hoshi
532488ac5c mainthread: RunLockOSThread is mainthread package's responsibility 2018-12-28 02:20:53 +09:00
Hajime Hoshi
c76ce28065 Revert "ui: Bug fix: SetVsyncEnabled before Run didn't work on macOS"
This reverts commit 042b30a516.
2018-12-28 02:18:38 +09:00
Hajime Hoshi
042b30a516 ui: Bug fix: SetVsyncEnabled before Run didn't work on macOS 2018-12-28 02:11:48 +09:00
Hajime Hoshi
25581b2be8 restorable: Fix comments 2018-12-27 03:12:30 +09:00
Hajime Hoshi
4ba47eee32 restorable: Refactoring 2018-12-27 03:06:44 +09:00
Hajime Hoshi
62cdb93105 restorable: Improve tests 2018-12-26 21:14:29 +09:00
Hajime Hoshi
fbf7007056 restorable: Pixels() should return immediately when it doesn't have to access GPU
Fixes #763
2018-12-26 20:25:40 +09:00
Hajime Hoshi
454a7d8ef9 graphicsdriver/opengl: Bug fix: misspelling on variables
Fixes #764
2018-12-26 03:03:06 +09:00
Hajime Hoshi
99e4c874fe Reduce init functions
This mitigates the init-order issue on jsgo.io.
2018-12-26 02:13:47 +09:00
Hajime Hoshi
de788603d6 graphicsdriver/opengl: Remove init order dependency 2018-12-25 23:58:01 +09:00
Hajime Hoshi
ebbbb448fa graphicsdriver/metal: Rename function for consistency 2018-12-25 02:24:02 +09:00
Hajime Hoshi
f5708cb58a graphicsdriver/opengl: Bug fix: Rename a function not to override an existing function 2018-12-24 17:45:16 +09:00
Hajime Hoshi
f1582c2d73 graphics: Add Address representing a sampler address mode
Fixes #761
2018-12-24 17:29:31 +09:00
Hajime Hoshi
7e50ae39c9 graphicsdriver/opengl: Refactoring: Filter as a uniform value 2018-12-24 16:06:25 +09:00
Hajime Hoshi
85df49dc96 graphicsdriver/opengl: Bug fix: variables can be optimized out 2018-12-23 06:04:35 +09:00
Hajime Hoshi
189b8a17e9 graphics: Use source-border check even at DrawTriangles
DrawTriangles can now take a sub-image.
2018-12-23 03:24:39 +09:00
Hajime Hoshi
4149a56524 graphics: Refactoring: Use 12 floats for each vertex
This is a preparation for #761.
2018-12-23 02:36:28 +09:00
Hajime Hoshi
bf67998fc5 graphicscommand: Bug fix: Do not assure the initial state of the image 2018-12-23 01:18:05 +09:00
Hajime Hoshi
4d0cc623fb ui: Rename functions 2018-12-22 02:32:02 +09:00
Hajime Hoshi
e809991c9f shareable: Bug fix: Image invalidation by ReplacePixels
ReplacePixels on a part of image might invalidate the other part of
the image on MacBook Pro 2013, especially when the other part is
rendered by DrawImage.

Fixes #593 #758
2018-12-21 11:50:10 +09:00
Hajime Hoshi
c227934153 graphicsdriver/metal: Bug fix: Adjust texels
Fixes #759
2018-12-21 02:38:00 +09:00
Hajime Hoshi
d520749dcb graphicsdriver/metal: Call Release on the main thread 2018-12-20 23:08:40 +09:00
wasedaigo
6840e9e739 graphicsdriver/metal: Clarify the type of passing parameters (#757)
Fixes #756
2018-12-20 17:04:03 +09:00
Hajime Hoshi
ff62876552 Add Metal implementation
Fixes #621
2018-12-20 02:37:10 +09:00
Hajime Hoshi
d738639c48 graphicsdriver/opengl: Fix panic messages 2018-12-20 02:36:21 +09:00
Hajime Hoshi
294bf855af ui: Fix logic: [NSApp mainWindow] can be nil when borderless 2018-12-19 02:25:12 +09:00
Hajime Hoshi
db4395d71b ui: Bug fix: ScreenSizeFullscreen before Run crashes on Linux 2018-12-19 01:21:00 +09:00
Hajime Hoshi
6ef5cc5857 ui: Bug fix: SetWindowDecorated didn't work
Fixes #753
2018-12-19 01:01:18 +09:00
Hajime Hoshi
b3ce89aab1 ui: Bug fix: SetWindowIcon before Run didn't work
Fixes #755
2018-12-18 23:16:09 +09:00
Hajime Hoshi
241ccc307f ui: Add comments about #753 2018-12-18 03:34:45 +09:00
Hajime Hoshi
eac00c3d83 ui: Bug fix: SetCursorVisible before Run didn't work
Fixes #754
2018-12-18 03:07:16 +09:00
Hajime Hoshi
9628e629ae graphicscommand: Fix tests to be more deterministic
Fixes #751
2018-12-17 21:46:53 +09:00
Hajime Hoshi
5d0420cea0 graphicscommand: Simplify Image
First I thought Metal requried an initialization process by
replacing pixels, but now this is not needed. Initialize images by
the dummy texture.
2018-12-16 22:36:03 +09:00
Hajime Hoshi
8b72ff5ec0 graphicscommand: Add tests 2018-12-16 17:38:02 +09:00
Hajime Hoshi
2c25318634 shareable: Add TestReplacePixelsAfterDrawImage 2018-12-16 15:13:35 +09:00
Hajime Hoshi
5f8a0e34bb graphics: isPowerOf2(0 or negative) should return false 2018-12-16 14:26:16 +09:00
Hajime Hoshi
17b225083d shareable: Improve TestExtend 2018-12-16 05:09:43 +09:00
Hajime Hoshi
22b11aafac shareable: Add TestExtend 2018-12-15 19:51:17 +09:00
Hajime Hoshi
d29cabca43 graphicsdriver: Remove MaxImageSize 2018-12-15 03:46:32 +09:00
Hajime Hoshi
18d109e3df graphicsdriver/opengl/gl: Fix README 2018-12-09 04:41:43 +09:00
Hajime Hoshi
e8a1be7748 graphicsdriver/opengl: Use non-cgo gl package on Windows (#171)
This is a temporal fix until go-gl/glow#102 is applied.
2018-12-09 03:06:11 +09:00
Hajime Hoshi
2fd0daec10 ui: Fix comments 2018-12-04 03:10:54 +01:00
Hajime Hoshi
155ee828b8 Fix misspelling 2018-12-03 18:23:25 +01:00
Hajime Hoshi
f85a62c6a7 restorable: Rename dummyImage -> emptyImage 2018-12-01 21:49:41 +01:00
Hajime Hoshi
e537cb2c27 graphics: Bug fix: render source might not be initialized 2018-12-01 21:36:51 +01:00
Hajime Hoshi
3f75da5f35 restorable: Refactoring: Remove newImageWithoutInit 2018-12-01 21:36:51 +01:00
Hajime Hoshi
c6dd0a75d9 graphicscommand: Optimize replace-image calls
Now ReplacePixels command is called only when necessary.

This also ensures that DrawImage must be called after ReplacePixels
is called since there is a potential problem that rendering images
on a texture without initializing by replacing pixels might cause
problems (escpecially on Metal. Perhaps #593 might be related).
2018-12-01 21:36:47 +01:00
Hajime Hoshi
e799a0c6a8 shareable: Fix wrong variable names 2018-12-01 11:31:32 +01:00
Hajime Hoshi
247e4f5b6b restorable: Skip initializing the screen image 2018-11-30 00:19:52 +01:00
Hajime Hoshi
962a11468b restorable: Fix clearing logic
Fixes #740
2018-11-28 23:00:24 +01:00
Hajime Hoshi
1a54ff34e6 graphics: Forbid nil at ReplacePixels explicitly 2018-11-28 22:26:34 +01:00
Hajime Hoshi
1f538af440 restorable: Refactoring 2018-11-24 21:08:28 +09:00
Hajime Hoshi
d165673789 devicescale: Bug fix: Crash on Wine
GetWindowDC(0) doesn't work on Wine. Let that return an arbitrary
scale 1 in this case.

Fixes #738
2018-11-24 16:37:30 +09:00
Hajime Hoshi
b48d501bc0 graphics: Explicit limitation of indices at DrawTriangles
Fixes #728
2018-11-23 19:02:10 +09:00
Hajime Hoshi
62210c89f3 graphicsdriver/opengl: Add assertion at ReplacePixels 2018-11-18 02:09:44 +09:00
Hajime Hoshi
31f15bc5ad Revert "graphics: Change the number of floats for a vertex from 10 to 12"
This reverts commit 7586c660d5.
2018-11-18 00:07:15 +09:00
Hajime Hoshi
d8f337985d graphicsdriver/opengl: Refactoring 2018-11-17 22:40:21 +09:00
Hajime Hoshi
ef08e218c8 graphicsdriver/opengl: Refactoring: Remove framebuffer.projectionMatrix 2018-11-17 22:29:04 +09:00
Hajime Hoshi
14f5a03a79 Merge math and graphics packages 2018-11-17 20:23:12 +09:00
Hajime Hoshi
de745f00fa graphicsdriver/opengl: Refactoring: Improve logic to generate framebuffer 2018-11-17 19:49:30 +09:00
Hajime Hoshi
44d1b137e7 graphicsdriver/opengl: Refactoring 2018-11-17 19:29:52 +09:00
Hajime Hoshi
7586c660d5 graphics: Change the number of floats for a vertex from 10 to 12
This is a preparation for Metal, that forces 4 floats for a vertex
position.
2018-11-17 15:30:11 +09:00
Hajime Hoshi
d2595c5be7 ui: Refactoring 2018-11-15 01:08:36 +09:00
Hajime Hoshi
e24f6b7848 graphicsdriver/opengl: Rename GetDriver -> Get 2018-11-13 00:01:26 +09:00
Hajime Hoshi
2313f79160 graphicsdriver: Rename Delete -> Dispose 2018-11-12 23:44:39 +09:00
Hajime Hoshi
cc2174bd69 graphicsdriver: Adjust API 2018-11-11 23:57:23 +09:00
Hajime Hoshi
907a28c434 graphicsdriver: Rename BufferSubData -> SetVertices 2018-11-11 23:54:58 +09:00
Hajime Hoshi
846a719d6c graphicsdriver: Merge UseProgram and DrawElements into Draw 2018-11-11 23:53:23 +09:00
Hajime Hoshi
575af7e416 graphicsdriver: Change indexOffsetInBytes -> indexOffset at DrawElements 2018-11-11 23:51:16 +09:00
Hajime Hoshi
b2b51fb1bf graphicsdriver/opengl: Refactoring 2018-11-11 22:08:36 +09:00
Hajime Hoshi
aff77d98e4 graphicsdriver/opengl: Bug fix: compile error on browsers and mobiles 2018-11-11 04:51:17 +09:00
Hajime Hoshi
734aeabc8d graphicsdriver/opengl: Remove theContext 2018-11-11 03:37:37 +09:00
Hajime Hoshi
2f692d98c7 graphicsdriver: Rename TexSubImage2D -> ReplacePixels 2018-11-11 01:35:10 +09:00
Hajime Hoshi
61ca48225c graphicsdriver: Rename MaxTextureSize -> MaxImageSize 2018-11-11 01:26:37 +09:00
Hajime Hoshi
7e363a6f3b graphicsdriver/opengl: Unexport Context 2018-11-11 01:19:11 +09:00
Hajime Hoshi
241716d0e6 Add package graphicsdriver; Move opengl to graphicsdriver/opengl 2018-11-10 22:52:37 +09:00
Ben Echols
5e70fce639 Added monitor cache and scale cache (#731) 2018-11-07 20:54:37 +09:00
Hajime Hoshi
b396b4f88a opengl: Refactoring: Remove theOpenGLState 2018-11-07 02:01:00 +09:00
Hajime Hoshi
09c8516545 graphcis: Move IndicesNum from opengl to graphics 2018-11-07 01:49:45 +09:00
Hajime Hoshi
07ae1db0dd opengl: Add Driver 2018-11-07 01:43:07 +09:00
Hajime Hoshi
ed961505d2 opengl: Refactoring: Hide projection matrix inside opengl package 2018-11-06 03:45:44 +09:00
Hajime Hoshi
57c8c089e9 opengl: Unexport BlendFunc 2018-11-06 03:18:56 +09:00
Hajime Hoshi
c9f49efd41 graphics: Add VertexFlaotNum 2018-11-06 02:34:52 +09:00
Hajime Hoshi
580cd5cc71 opengl: Unexport DataType/Float/Short 2018-11-06 01:58:15 +09:00
Hajime Hoshi
82e9f227d1 opengl: Remove arrayBufferLayoutPart.dataType 2018-11-06 01:13:55 +09:00
Hajime Hoshi
00f28dd896 opengl: Remove BeforeSwapping
I couldn't machines that requre this any longer. Perhaps a bound
framebuffer is always the screen framebuffer before swapping now.
2018-11-05 02:14:56 +09:00
Hajime Hoshi
2c7017534f ui: Remove opengl dependency from ui package (desktop) 2018-11-05 01:24:53 +09:00
Hajime Hoshi
02b570a8e1 opengl: Refactoring: Use value type for theContext 2018-11-05 00:48:15 +09:00
Hajime Hoshi
f7fa4ed8f9 opengl: Refactoring 2018-11-05 00:44:27 +09:00
Hajime Hoshi
4090258904 opengl: Remove Init (except for mobile) 2018-11-05 00:21:39 +09:00
Hajime Hoshi
16ada03928 opengl: Unexport (*Image).Framebuffer 2018-11-04 20:00:13 +09:00
Hajime Hoshi
293857d3a3 opengl: Remove (*Image).Size 2018-11-04 19:59:27 +09:00
Hajime Hoshi
beae772287 opengl: Unexport Framebuffer 2018-11-04 19:55:27 +09:00
Hajime Hoshi
7bbc32ce0e opengl: Unexport Texture 2018-11-04 19:46:20 +09:00
Hajime Hoshi
786b349579 opengl: Unexport TexSubImage2D 2018-11-04 19:44:30 +09:00
Hajime Hoshi
531251d4ad opengl: Unexport NewTexture 2018-11-04 19:39:14 +09:00
Hajime Hoshi
bc7dd2f050 opengl: Unexport some functions 2018-11-04 19:13:41 +09:00
Hajime Hoshi
2a7caf7755 opengl: Move ensureFramebuffer to opengl.Image 2018-11-04 19:06:33 +09:00
Hajime Hoshi
95a925ec9a opengl: Refactoring 2018-11-04 18:51:50 +09:00
Hajime Hoshi
7fbf9f652e opengl: Unexport DeleteTexture 2018-11-04 18:46:05 +09:00
Hajime Hoshi
96f1a8aff6 opengl: Add Image struct 2018-11-04 18:39:28 +09:00
Hajime Hoshi
c7ea761031 opengl: Rename FramebufferStruct -> Framebuffer 2018-11-04 17:49:40 +09:00
Hajime Hoshi
9dae11808f opengl: Rename Framebuffer -> framebufferNative 2018-11-04 17:48:45 +09:00
Hajime Hoshi
c935c28498 opengl: Move Framebuffer from graphicscommand to opengl and rename it to FramebufferStruct 2018-11-04 17:39:01 +09:00
Hajime Hoshi
97a9e99112 opengl: Rename: BindScreenFramebuffer -> BeforeSwapping 2018-11-03 04:08:00 +09:00
Hajime Hoshi
841353670f opengl: Unexport BindTexture 2018-11-02 03:45:37 +09:00
Hajime Hoshi
6dceeb343c opengl: Refactoring: Remove ResetViewportSize 2018-11-02 03:24:35 +09:00
Hajime Hoshi
09fe1886d7 graphicscommand: Add comments
Add explanation why ResetViewportSize is needed.
2018-11-02 03:06:26 +09:00
Hajime Hoshi
3a8ddd6279 graphicscontext: Rename createFramebufferIfNeeded -> ensureFramebuffer 2018-11-01 03:42:30 +09:00