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