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
Hajime Hoshi
61c2331ac4
graphicscommand: Refactoring
2018-11-01 03:34:58 +09:00
Hajime Hoshi
e28c7b0f50
graphicscommand: Remove Texture
2018-11-01 03:29:23 +09:00
Hajime Hoshi
bc3ca38f76
opengl: Rename ResetGLState -> Reset and other functions
2018-11-01 03:02:08 +09:00
Hajime Hoshi
b8aa35373a
graphicscommand: Remove unneeded type conversion
2018-10-31 10:54:45 +09:00
seebs
74e204d952
graphics: Speed up DrawTriangles ( #723 )
...
DrawTriangles is expensive and slow because of massive memory
allocation and garbage collection costs. This patch moves from ~47TPS
on my laptop (with ~24k triangles) to 60TPS. The first part
is just allocating the right size of vertex buffer up front; that
got to about 55TPS. The second part replaces the frequent
allocations of []float32 in Vertex() calls with writing the
desired values into a provided destination slice.
Time spent in drawing triangles for 1,000 frames:
13.07s baseline
11.09s preallocate whole buffer to avoid resizing
6.13s use new PutVertex function
This might need some cleanup, but I think it's good evidence that
the design change is viable.
2018-10-31 10:53:17 +09:00
Hajime Hoshi
45017213a7
opengl: Unexport (Element)ArrayBufferSubData
2018-10-31 00:59:44 +09:00
Hajime Hoshi
5be08cac19
opengl: Unexport BindBuffer
2018-10-30 23:59:20 +09:00
Hajime Hoshi
23a832c0a7
opengl: Unexport consts
2018-10-30 22:41:05 +09:00
Hajime Hoshi
99594fe732
opengl: Remove type mode
2018-10-30 22:36:12 +09:00
Hajime Hoshi
b2b09ccec0
restorable: Avoid memory allocating when an entire image is cleared
2018-10-30 11:08:38 +09:00
Hajime Hoshi
bb0b8ca83b
opengl: Unexport (*Context).Reset()
2018-10-30 02:18:10 +09:00
Hajime Hoshi
ac7bf354a9
opengl: Unexport types
2018-10-30 02:13:51 +09:00
Hajime Hoshi
e4179aee37
opengl: Unexport functions
2018-10-30 01:50:30 +09:00
Hajime Hoshi
6b95a5140c
opengl: Move program.go and shader.go to opengl
2018-10-30 01:27:31 +09:00
Hajime Hoshi
6b02f0ae9e
graphicscommand: Move OrthoProjectionMatrix to opengl package
2018-10-29 01:08:51 +09:00
Hajime Hoshi
ce1c616f69
Merge graphics and graphicsutil
2018-10-28 23:03:06 +09:00
Hajime Hoshi
395b46d8da
graphicsutil: Remove dependency on graphicscommand
2018-10-28 23:00:10 +09:00
Hajime Hoshi
7767bcfdd8
graphicsutil: Better allocation of vertices
2018-10-28 22:54:36 +09:00
Hajime Hoshi
fde9fd2d0e
graphicsutil: Remove dependency on opengl
2018-10-28 22:01:59 +09:00
Hajime Hoshi
ff54d3b681
Move CompositeMode to graphics package
2018-10-28 21:49:47 +09:00
Hajime Hoshi
06f2052817
Add graphics package and move Filter to graphics
2018-10-28 20:25:52 +09:00
Hajime Hoshi
2da5192510
Rename graphics -> graphicscommand
2018-10-28 20:10:05 +09:00
Hajime Hoshi
7e29a81177
ui: Refactoring
2018-10-14 18:28:27 +09:00
Hajime Hoshi
0c4ef7ee8e
ui: Bug fix: fix the initial window position on multiple monitors
2018-10-14 16:59:14 +09:00
Hajime Hoshi
b56061281d
ui: Add comments
2018-10-13 22:41:21 +09:00
Hajime Hoshi
a073f48faf
input: Bug fix: keypress event were not fired
...
This change suspends to 'preventDefault' on keydown events.
Now preventing navigation by pressing backspace is deprecated in
Chrome. For other keys, it looks like keyup's preventDefault is
enough to disable the browser default behavior.
2018-10-13 19:18:13 +09:00
Hajime Hoshi
faf32b9d37
devicescale: Plan 9 support
2018-10-13 04:08:40 +09:00
Hajime Hoshi
34596bb1cf
ui: Bug fix: IsVsyncEnabled can cause deadlock
2018-10-10 23:17:45 +09:00
Hajime Hoshi
b4a4b87b56
ui: Bug fix: ScreenSizeInFullscreen returned wrong scaled values
...
Fixes #708
2018-10-10 03:10:18 +09:00
Hajime Hoshi
e971f6d41c
ui: Avoid glfw.GetCurrentContext for threading issues
2018-10-10 01:45:39 +09:00
Hajime Hoshi
b5344bc994
ui: glfwScale must be called on the main thread
2018-10-10 01:07:47 +09:00
Hajime Hoshi
c758a1f8c6
ui: Rename MonitorSize -> ScreenSizeInFullscreen ( #708 )
2018-10-09 23:42:03 +09:00
Hajime Hoshi
dbe71e81bd
ui: Bug fix: currentMonitorPos returned wrong values on macOS
...
[NSScreen mainScreen] sometimes returned a wrong screen for the
window. Use [[NSApp mainWindow] screen] when possible.
Fixes #703
2018-10-08 05:40:07 +09:00
Hajime Hoshi
c4a066ecd0
ui: Fix wrong comments about Windows
2018-10-08 04:06:44 +09:00
Hajime Hoshi
8d2820efb0
ui: Bug fix: the window is shown on the current monitor on Windows
...
Fixes #704
2018-10-08 03:24:14 +09:00
Hajime Hoshi
96a657025f
ui: Bug fix: DeviceScaleFactor and MonitorSize were not correct on Windows
2018-10-08 03:18:24 +09:00
Hajime Hoshi
9264e38324
ui: Add comments
2018-10-08 01:45:07 +09:00
Hajime Hoshi
f6c2d899f1
ui: Bug fix: compile error on browsers and mobiles
2018-10-08 01:26:05 +09:00
Hajime Hoshi
4a5548a4a0
ui: MonitorSize should return the 'current' monitor size instead of the primary monitor size
2018-10-08 01:15:57 +09:00
Hajime Hoshi
f3b7148564
ui: Bug fix: DeviceScaleFactor should return the current monitor's scale
2018-10-08 01:11:13 +09:00
Hajime Hoshi
16a9bac487
ui: Remove deviceScale struct
2018-10-08 01:03:18 +09:00
Hajime Hoshi
effd530026
ui: Show the window on the current monitor ( #704 )
...
Tested on macOS. This doesn't work on Windows yet since there are
some codes that depends on the primary monitor.
2018-10-08 00:46:01 +09:00
Hajime Hoshi
fb7a3f2736
ui: Bug fix: Call SetPos multiple times to render correctly ( #703 )
2018-10-08 00:25:21 +09:00
Hajime Hoshi
e0d2d5e753
ui: Bug fix: wrong scaling when a window move across monitors
...
Fixes #701
2018-10-07 23:05:20 +09:00
Hajime Hoshi
0e7dab3707
ui: Fix comment
2018-10-06 20:04:48 +09:00
Hajime Hoshi
f9edfd7d57
ui: Remove unused variables
2018-10-06 19:55:10 +09:00
Hajime Hoshi
cc336a4c38
ui: Use more stable way to determine the current monitor
2018-10-06 19:53:43 +09:00
Hajime Hoshi
55a397bd65
devicescale: Specify the monitor to get the scale
...
Fixes #695
2018-10-06 19:43:23 +09:00
Hajime Hoshi
b99cc6ca8e
ui: Bug fix: compile error on mobiles
2018-10-06 18:26:22 +09:00
Hajime Hoshi
8771d27d64
devicescale: Rename variables
2018-10-06 17:29:40 +09:00
Hajime Hoshi
d08ae0dd66
graphicsutil: Fix comments
2018-10-06 15:01:12 +09:00
Hajime Hoshi
ca2fe22e4a
ui: Bug fix: Set the proper window position when coming back from fullscreen
2018-10-06 03:53:34 +09:00
Hajime Hoshi
7ea1ab6b58
ui: Bug fix: currentMonitor should not return nil
...
Fixes #700
2018-10-06 03:22:33 +09:00
Hajime Hoshi
cae9e39453
ui: Use the best suitable monitor for fullscreen
...
This change also changes the definition of MonitorSize.
2018-10-06 02:59:38 +09:00
Hajime Hoshi
16f6aeaa4a
ui: Refactoring: Use the current monitor
2018-10-06 02:38:02 +09:00
Hajime Hoshi
bd1fc4439a
graphicsutil: Avoid passing NaN to shaders experimentally ( #696 )
2018-10-04 02:02:19 +09:00
Hajime Hoshi
1807a3f530
devicescale: Rename function
2018-10-04 01:28:53 +09:00
Hajime Hoshi
10b49bb0a3
ui: Don't call devicescale.DeviceScale too often
2018-10-03 04:29:12 +09:00
Hajime Hoshi
11d23bafa9
devicescale: Bug fix: the active window can't be passed to ReleaseDC
2018-10-03 04:16:28 +09:00
Hajime Hoshi
02a2fc2d44
ui: Bug fix: Force to adjust window size when scale is changed
...
Fixes #644
2018-10-03 03:26:11 +09:00
Hajime Hoshi
eef9c01735
gofmt -s -w
2018-10-03 03:25:44 +09:00
Hajime Hoshi
cf41e0aa0a
devicescale: Rename logPixelSx -> logPixelsX
2018-10-03 03:13:36 +09:00
Hajime Hoshi
399317a2cf
devicescale: Get the current monitor's scale on Windows ( #644 )
2018-10-03 03:09:42 +09:00
Hajime Hoshi
c494b53822
ui: Refactoring: Add deviceScale struct
2018-10-02 23:06:56 +09:00
Hajime Hoshi
635d624b77
ui: Update device scale on browsers ( #644 )
2018-10-02 11:43:45 +09:00
Hajime Hoshi
21c1ee5dfb
ui: Cache devicescale value on mobiles
2018-10-02 03:51:13 +09:00
Hajime Hoshi
9906c935f6
ui: Remove unnecessary lock protection
2018-10-02 03:25:30 +09:00
Hajime Hoshi
fce82e1502
ui: Use frame counter to update device scale
2018-10-02 03:21:59 +09:00
Hajime Hoshi
78f2946797
ui: Bug fix: timer condition was wrong
2018-10-02 02:53:17 +09:00
Hajime Hoshi
bf850e12a4
ui: Recalc device scale repeatedly for multiple displays ( #644 )
2018-10-02 02:49:08 +09:00
Hajime Hoshi
308c8091cd
ui: Fix comments
2018-09-30 18:53:38 +09:00
Hajime Hoshi
8df596396c
input: Bug fix: wheel direction is opposite on browsers
2018-09-30 17:14:52 +09:00
Hajime Hoshi
0224858b7b
examples/wheel: Improve message
2018-09-30 17:13:22 +09:00
Hajime Hoshi
803e42714e
input: Implement wheel event on browsers
...
Fixes #630
2018-09-30 17:08:18 +09:00
Hajime Hoshi
237f6a2014
input: Rename MouseWheel -> Wheel
2018-09-30 17:01:45 +09:00
Hajime Hoshi
b6f0ea0100
input: Remove unused variables
2018-09-30 15:40:16 +09:00
Hajime Hoshi
25a5f1dd83
ui: Sleep when vsync doesn't work ( #692 )
2018-09-30 14:44:54 +09:00
Hajime Hoshi
15260537a2
graphics: Bug fix: fullscreen rendering was wrong
...
After fad65f2f5d
, the viewport size
is always same as the framebuffer size. The 'screen' image size
was the actual rendering region size, and padding was not
considered in the size. The padding is added on the fullscreen
mode.
This fix adds the extra padding values to the 'screen' image size
so that the 'screen' framebuffer will be same size as the monitor
size.
Fixes #693
2018-09-29 21:47:41 +09:00
Hajime Hoshi
fad65f2f5d
graphics: Use the viewport size same as the framebuffer size
...
Fixes #691
2018-09-29 19:53:22 +09:00
Hajime Hoshi
c4abed0a22
opengl: Add coments about #629
2018-09-29 02:20:23 +09:00
Hajime Hoshi
ce8d9df647
graphics: Update glTexImage2D signature
2018-09-10 12:44:42 +09:00
Hajime Hoshi
3d24ffe3e0
clock: Bug fix: function registerd OnStart might not be called
...
Fixes #645
2018-09-03 00:35:55 +09:00
Hajime Hoshi
42757b735b
internal/png: Update
2018-09-02 23:09:08 +09:00
Hajime Hoshi
8827520d4a
graphics: Bug fix: avoid jaggy rendering on macOS by adjusting texels ( #669 )
2018-08-30 00:17:03 +09:00
Hajime Hoshi
2360b2930f
graphics: Add DrawTriangles
...
Fixes #624
2018-08-14 01:23:14 +09:00
Hajime Hoshi
690c3cf981
graphics: Embed 'scale' part of the color matrix
...
If the color matrix includes only 'scale' part, they are embedded
into vertices in order to reduce draw calls.
Fixes #662
2018-08-10 23:20:55 +09:00
Hajime Hoshi
e46f9c6305
graphics: Bug fix: compile error
2018-08-10 03:10:57 +09:00
Hajime Hoshi
a03b335c24
graphics: Add logging when 'ebitendebug' tag is specified
...
Fixes #563
2018-08-10 02:39:07 +09:00
Hajime Hoshi
1aabdd58f1
restorable: Fix comments
2018-08-09 01:27:38 +09:00
Hajime Hoshi
3daaef2cab
restorable: Refactoring: Use ReplacePixels(nil, ...) for clearing an image
2018-08-09 01:16:46 +09:00
Hajime Hoshi
a988082be1
shareable: Bug fix: disable tests
2018-08-09 00:19:55 +09:00
Hajime Hoshi
c68c36b0b7
restoreable: Add ClearState to clear the state explicitly
...
Fixes #566
2018-08-09 00:12:45 +09:00
Hajime Hoshi
cdc408d2c2
shareable: Suspend re-using shared images
...
Fixes #661
2018-08-08 18:40:52 +09:00
Hajime Hoshi
ed99719fdb
devicescale: Use app.RunOnJVM and remove internal/jni
2018-08-06 23:50:37 +09:00
Hajime Hoshi
77e905eb25
Revert "graphics: Embed color matrices values to vertices ( #655 )"
...
This reverts commit 5a9235aaf9
.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
9af8e621bd
Revert "affine: Refactoring: Unify two element slices into one"
...
This reverts commit da662b384c
.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
af77a17aaa
devicescale: Use mainScreen instead of screens[0] to get the 'current' screen state
2018-08-05 19:18:40 +09:00
Hajime Hoshi
063edfcc4a
opengl: Use the safer way to pass Go string to C
2018-08-04 05:22:59 +09:00
Hajime Hoshi
18d77d3f6e
shareable: Rename variables
2018-08-03 02:50:11 +09:00
Hajime Hoshi
0956ca0ea6
graphicsutil: Add MipmapLevel
2018-07-31 01:47:03 +09:00
Hajime Hoshi
d7d02e6d6a
Reland: graphics: mipmap images should be volatile when the base image is volatile
...
This is not a bug fix, but should improve performance.
2018-07-30 00:26:36 +09:00
Hajime Hoshi
5be58086b5
Revert "graphics: Bug fix: mipmap images should be volatile when the base image is volatile"
...
This reverts commit 0f82330009
.
2018-07-29 23:58:46 +09:00
Hajime Hoshi
0f82330009
graphics: Bug fix: mipmap images should be volatile when the base image is volatile
2018-07-29 23:54:46 +09:00
Hajime Hoshi
0bf62f392f
shareable: Bug fix: forceShared should allocate backend as shareable
2018-07-29 23:49:53 +09:00
Hajime Hoshi
81094da3a1
shareable: Bug fix: test failures
2018-07-29 23:28:13 +09:00
Hajime Hoshi
056ed1c6db
shareable: Return color.RGBA instead of color.Color
2018-07-29 21:59:18 +09:00
Hajime Hoshi
b9265d5120
Enable to go-generate under non-GOPATH directories
2018-07-28 19:21:19 +09:00
Hajime Hoshi
88e488a5a6
docs: Update
2018-07-28 19:00:05 +09:00
Hajime Hoshi
da662b384c
affine: Refactoring: Unify two element slices into one
2018-07-27 01:51:49 +09:00
Hajime Hoshi
2b4785f863
affine: Remove unused function
2018-07-27 01:23:14 +09:00
Hajime Hoshi
5a9235aaf9
graphics: Embed color matrices values to vertices ( #655 )
...
Fixes #531
2018-07-26 11:37:27 +09:00
Hajime Hoshi
2559979c2b
shareable: Add tests
2018-07-25 01:08:04 +09:00
Hajime Hoshi
5beaf843a6
shareable: Bug fix: volatile or screen must not use shareable texture
2018-07-24 22:25:15 +09:00
Hajime Hoshi
b2a4ddf853
shareable: Refactoring: Add moveTo
2018-07-22 06:29:31 +09:00
Hajime Hoshi
693116ffd6
shareable: Bug fix: Double free
2018-07-22 05:52:11 +09:00
Hajime Hoshi
6687ffe8ba
shareable: Bug fix: SetFinalizer must not be reset at dispose(false)
2018-07-22 05:40:04 +09:00
Hajime Hoshi
c15348f939
packing: Improve panic messages
2018-07-22 05:29:02 +09:00
Hajime Hoshi
09dcba40ab
shareable: Rename variables
2018-07-22 04:32:36 +09:00
Hajime Hoshi
a6edb90898
shareable: Use the shared backend again in some conditions
...
Fixes #633
2018-07-22 04:03:35 +09:00
Hajime Hoshi
e3ab158d7d
affine: Allow absence of the translate part
2018-07-21 17:21:55 +09:00
Hajime Hoshi
9047e54ae6
shareable: Remove comments
2018-07-21 03:43:12 +09:00
Hajime Hoshi
5249afc06b
graphicsutil: Add QuadIndices
2018-07-21 03:40:37 +09:00
Hajime Hoshi
2e7745044d
shareable: Fix Image.DrawImage to accept vertices and indices
2018-07-21 03:30:27 +09:00
Hajime Hoshi
0593b77eb8
ui: Implement CurrentTPS
2018-07-18 02:11:00 +09:00
Hajime Hoshi
eb68cdad6e
ui: Bug fix: Freezing on calling SetVsyncEnabled
2018-07-17 02:37:22 +09:00
Hajime Hoshi
3a8ca5ad73
ui: Implement TPS/SetTPS
...
Fixes #605
Fixes #321
2018-07-17 01:58:00 +09:00
Hajime Hoshi
93f8c76310
internal/clock: Remove unused variables
2018-07-17 00:35:51 +09:00
Hajime Hoshi
408cc1e833
internal/clock: Refactoring
...
Update now returns 0 when tps is 0, and 1 when tps is negative.
2018-07-17 00:29:10 +09:00
Hajime Hoshi
88e6768a30
Use the term 'TPS' ticks per second
2018-07-16 04:36:47 +09:00
Hajime Hoshi
bbb777eecc
internal/clock: Use constant time to detect if the game is delayed too much
2018-07-16 03:02:55 +09:00
Hajime Hoshi
18ec1d8265
internal/clock: Update takes FPS
2018-07-16 01:03:23 +09:00
Hajime Hoshi
09c93ac86d
ui: Avoid using eval
2018-07-14 23:47:31 +09:00
Hajime Hoshi
e25c237a01
Add IsVsyncEnabled / SetVsyncEnabled
...
This enables the game to work more efficiently (but consume much
more CPU).
Fixes #405 .
2018-07-14 21:43:55 +09:00
Hajime Hoshi
6c8b7f8e9c
graphics: Refactoring: Reduce error propagations
2018-07-12 03:08:50 +09:00
Hajime Hoshi
a9a21132ae
graphics: Refactoring: Add pixelCommand
2018-07-12 02:40:06 +09:00
Hajime Hoshi
8f12dfc496
Use js.TypedArray
...
This is still WIP. There is a rendering issue on Wasm.
2018-07-06 02:48:51 +09:00
Hajime Hoshi
e4f157d9cd
opengl: Remove unused code
2018-06-30 12:34:40 +09:00
Hajime Hoshi
2c0f3d4302
opengl: Bug fix: wrong argument to js.Value.Call
2018-06-30 12:32:15 +09:00
Hajime Hoshi
6e51d31524
Use new GopherWasm API ( #634 )
...
I plan to merge this right after
https://github.com/gopherjs/gopherwasm/pull/3 is merged.
2018-06-30 00:02:15 +09:00
Hajime Hoshi
abdf52bc74
shareable: Bug fix: Call SetFinalizer whenever a new image is created
...
Fixes #637
2018-06-28 22:23:07 +09:00
Hajime Hoshi
f765966742
web: Remove unused variables
2018-06-28 00:17:05 +09:00
Hajime Hoshi
f19e349d38
web: Remove IsNodeJS
...
gjbt now creates a pseudo-Node environment by creating
window.process object, and this conflicted with an assumption that
Ebiten doesn't nothing on Node environment. See
https://github.com/myitcv/gjbt/pull/13 for the detail.
This change allows Ebiten work on pseudo-Node environment. Even
after this change, Ebiten doesn't work on real Node environment
due to lack of DOM.
2018-06-28 00:12:24 +09:00
Hajime Hoshi
dec921809b
shareable: Refactoring
2018-06-26 01:59:12 +09:00
Hajime Hoshi
a9359e4ef8
Use GopherJS/GopherWasm
2018-06-24 16:10:24 +09:00
Hajime Hoshi
8c9a11ddf4
opengl: Rely on gopherwasm for typed-array creation
2018-06-24 02:02:39 +09:00
Hajime Hoshi
ff86f8bd93
opengl: Refactoring
2018-06-23 04:43:56 +09:00
Hajime Hoshi
33e4f82d7c
graphicsutil: Optimization to avoid boundary checks
2018-06-23 03:18:54 +09:00
Hajime Hoshi
6c1c60d40d
opengl: Make Program struct to avoid Get()
2018-06-22 01:45:25 +09:00
Hajime Hoshi
55d832fc63
shareable: Don't extend textures on macOS
...
Fixes #593
2018-06-20 11:57:39 +09:00
Hajime Hoshi
d83799acf8
opengl: Bug fix: mobile build failure
2018-06-20 11:16:21 +09:00
Hajime Hoshi
8d644479cc
opengl: Initialize consts first to avoid 'Get' calls
2018-06-19 04:02:56 +09:00
Hajime Hoshi
62bd35e412
Avoid 'Get' call if possible
...
(*js.Value).Get has some overhead especially on Wasm.
2018-06-19 03:43:24 +09:00
Hajime Hoshi
702a429afb
opengl: Faster conversion from []float32 to Float32Array
2018-06-19 03:31:53 +09:00
Hajime Hoshi
840c4d24df
graphicsutil: Accept matrix parameters directly for performance
2018-06-19 00:19:32 +09:00
Philipp Steinhaus
39b3170185
input: Enable mouse wheel input ( #628 )
2018-06-18 00:38:30 +09:00
Hajime Hoshi
a3c754d2cc
graphics: Restrict QuadVertices to allow only power of 2 sizes
...
Now QuadVertices can skip calculating power of 2 values.
2018-06-17 23:05:19 +09:00
Hajime Hoshi
12287a8382
graphicsutil: Reduce multiplying
2018-06-17 20:11:31 +09:00
Hajime Hoshi
ac24a8382f
graphicsutil: Extract matrix applying for performance
2018-06-17 19:45:09 +09:00
Hajime Hoshi
1849b59741
graphicsutil: Refactoring
2018-06-17 17:29:36 +09:00
Hajime Hoshi
5d37c331bb
graphicsutil: Remove unused arguments
2018-06-17 16:38:21 +09:00
Hajime Hoshi
95561bbf6b
affine: Use float32 values for GeoM
...
float32 was slow on GopherJS, but not slow on Wasm.
2018-06-17 15:38:10 +09:00
Hajime Hoshi
4c2fc30311
graphicsutil: Don't allow nil GeoM
2018-06-17 01:48:56 +09:00
Hajime Hoshi
f6b7a6be73
graphics: Use copy function in appendVertices
2018-06-17 01:09:05 +09:00
Hajime Hoshi
b4ace53596
affine: Remove GeoM to avoid GeoM allocations on the heap
2018-06-17 00:59:50 +09:00
Hajime Hoshi
460c47a9eb
opengl: Pass slices to js.Value
2018-06-16 02:19:18 +09:00
Hajime Hoshi
3fbe8d8ecb
opengl: Change Shader/Program/Buffer to js.Value
2018-06-16 00:30:16 +09:00
Hajime Hoshi
2497b64cf7
opengl: Change uniformLocation to js.Value
2018-06-16 00:30:16 +09:00
Hajime Hoshi
17ccf06755
opengl: Change Texture/Framebuffer to js.Value
2018-06-16 00:30:16 +09:00
Hajime Hoshi
48e2c2aba9
opengl: Use gopherwasm
2018-06-16 00:30:16 +09:00
Hajime Hoshi
b87a851c0e
ui: New GopherWASM API
2018-06-16 00:26:28 +09:00
Hajime Hoshi
a90b7efdf4
shareable: Refactoring
2018-06-11 01:02:25 +09:00
Hajime Hoshi
3ee76ffd8e
graphicsutil: Move vertices.go to graphicsutil
2018-06-10 23:08:22 +09:00
Hajime Hoshi
9745ccee47
restorable: Make (*Image).DrawImage accept vertices and indices
2018-06-10 22:59:00 +09:00
Hajime Hoshi
97a54548df
restorable: Rename vertices -> quadVertices
2018-06-10 20:41:17 +09:00
Hajime Hoshi
600983e028
restorable: Record indices for restoring
2018-06-10 20:17:48 +09:00
Hajime Hoshi
2e5e7e6e24
restorable: Remove merging commands for code simplicity
2018-06-10 20:06:17 +09:00
Hajime Hoshi
03079ba067
restorable: Refactoring
2018-06-10 18:40:46 +09:00
Hajime Hoshi
c782380a1c
restorable: Specify indices from restorable package
2018-06-10 18:17:58 +09:00
Hajime Hoshi
2853895e6b
graphics: Refactoring: Rename functions
2018-06-10 17:53:57 +09:00
Hajime Hoshi
32ac3840a7
graphics: Add comments
2018-06-10 17:10:11 +09:00
Hajime Hoshi
4e21bfd005
graphics: Rename elements -> indices
2018-06-10 17:06:40 +09:00
Hajime Hoshi
8a268e871f
graphics: Specify indices before commands
2018-06-10 17:04:58 +09:00
Hajime Hoshi
be665a3526
ui: Better way to avoid blocking
...
Fixes #625
2018-06-09 13:36:35 +09:00
Hajime Hoshi
6e12f287b0
ui: Use goroutine to avoid blocking on GopherJS
2018-06-09 03:05:37 +09:00
Hajime Hoshi
e6d0943366
graphics: Rename color_matrix -> color_matrix_body
2018-06-06 02:46:54 +09:00
Hajime Hoshi
b86860abcc
graphics: Call BindBuffer only when the program was null
2018-06-04 00:13:23 +09:00
Hajime Hoshi
fac639f9b7
graphics: Refactoring: Remove drawImageCommand.quadsNum
2018-06-03 23:58:08 +09:00
Hajime Hoshi
c9dd04d471
graphics: Refactoring: Remove command groups
2018-06-03 23:13:01 +09:00
Hajime Hoshi
9d87622a19
graphics: Set elements for every EnqueueDrawImageCommand
2018-06-03 20:42:45 +09:00
Hajime Hoshi
525ad04568
graphics: Split the notion of vertices and elements
2018-06-03 16:07:26 +09:00
Hajime Hoshi
25f2dfc677
graphics: Refactoring
2018-06-03 01:43:10 +09:00
Hajime Hoshi
03e3f0f5f7
graphics: Call glBufferSubData for element array buffer every frame
...
This is a preparation for more flexible drawing commands.
2018-05-31 00:53:05 +09:00
Hajime Hoshi
5e93d75ae0
graphics: Fix comments
2018-05-28 02:38:26 +09:00
Hajime Hoshi
399f965729
opengl: Add BindBuffer accepting both element-array-buffer and array-buffer
...
This change is a pure refactoring to clarify that array buffer is
binded before its usage.
2018-05-28 00:34:00 +09:00
Hajime Hoshi
311788dfe2
ui: Remove warnings of deadlock
...
Now gopherwasm fixed this problem by avoiding js.MakeFunc.
See also: 3fe87b73c0
2018-05-27 04:10:14 +09:00
Hajime Hoshi
8e9c3bd304
ui: Use gopherwasm
2018-05-27 02:35:17 +09:00
Hajime Hoshi
faaf391619
audio: Give up syncing audio timer and game timer ( #617 )
...
Syncing was already incomplete (e.g. decoding takes more than one
frame and delays can happen in this case). Giving up syncing audio
timer and game timer should not affect the game experience so much.
Instead, clock implementation will be much simpler.
2018-05-27 00:30:12 +09:00
Hajime Hoshi
5976e4bbbc
audio: More intellegent suspending/resuming ( #617 )
...
Before this change, the audio is suspended when the game stops for
1/12[s]. However, as game often stops for more than 1/12[s]
especially on mobiles, this implemntation caused some audio
glitches.
This change fixes this problem by re-implementing suspending/
resumeing audio by detecting the window is active/focused or not.
2018-05-26 23:31:04 +09:00
Hajime Hoshi
d88d1be4ad
mobile: Refactoring
2018-05-26 22:51:30 +09:00
Hajime Hoshi
980055e07a
devicescale: Use gopherwasm
2018-05-25 02:00:41 +09:00
Hajime Hoshi
d894a13698
web: Use gopherwasm
2018-05-25 01:59:50 +09:00
Hajime Hoshi
2ec075004a
clock: Use gopherwasm
2018-05-25 01:14:31 +09:00
Hajime Hoshi
4c5613d73c
opengl: Remove unneeded casts
2018-05-23 01:29:16 +09:00
Hajime Hoshi
b84dc0585d
opengl: Remove dependencies on gopherjs/webgl
...
This is a preparation for #528
2018-05-23 00:48:24 +09:00
Hajime Hoshi
81a1fd4744
testflock: Use just sync.Mutex on browsers ( #615 )
2018-05-19 21:10:34 +09:00
Hajime Hoshi
0637a812bc
web: Fix detecting mobile browsers for NodeJS
2018-05-16 22:29:19 +09:00
Hajime Hoshi
a5eb1b84ab
web: Better way to detect NodeJS
2018-05-16 22:10:35 +09:00
Hajime Hoshi
c2df8326fc
ui: Refactoring: Use IsNodeJS
2018-05-16 22:02:33 +09:00
Hajime Hoshi
d7d892f2d6
graphics: Allow a little margin for edge pixels
2018-05-13 23:00:06 +09:00
Hajime Hoshi
a1dd7b39a3
graphics: Remove roundTexel function
...
Actually, at least 704d4cf464
,
examples/moire doesn't work well without roundTexel on MacBook Pro.
However, now other parts are fixed (e.g. highp is used), it looks
like roundTexel is no longer needed.
2018-05-13 22:30:22 +09:00
Hajime Hoshi
b402cddd01
graphics: Bug fix: wrong refactoring in shader
2018-05-13 14:20:54 +09:00
Hajime Hoshi
efaa5aa17a
graphics: Refactor shader
2018-05-13 03:31:28 +09:00
Hajime Hoshi
3ccfe087d9
Refactoring
2018-05-12 15:25:01 +09:00
Hajime Hoshi
453921f1d3
ui: Bug fix: sizeChange must be set after updateFullscreenScaleIfNeeded
2018-05-12 02:11:37 +09:00
Hajime Hoshi
f5336ce7bc
opengl: Use 'EXT' functions for framebuffers
...
Some pretty old machines don't support OpenGL 3.x or later, and in
such environment, some framebuffer functions like glGenFramebuffers
are not available. Instead, EXT versions can be used even on
machines that don't support OpenGL 3.x.
After this change, Ebiten always tries to use EXT version of
framebuffer functions. I believe EXT version is always available
when non-EXT version is available, so this chang eshould be safe.
Fixes #602
2018-05-10 02:11:23 +09:00
Hajime Hoshi
92631e64ed
Remove internal/sync
...
nosync package for GopherJS is problematic since nosync's mutex
assumes that Lock call is never duplicated, which is not true in
actual applications.
See also #603 .
2018-05-09 23:41:08 +09:00
Hajime Hoshi
167d21ec46
devicescale: Panic on Android when called from init funcs
2018-05-05 03:16:29 +09:00
Hajime Hoshi
d8dba69b47
ui: Add MonitorSize
...
Fixes #470
2018-05-05 02:42:45 +09:00
Hajime Hoshi
9a06b31556
ui: Don't panic at DeviceScaleFactor in init
...
Fixes #597
2018-05-05 01:28:29 +09:00
Hajime Hoshi
d41f959b96
ui: Initialize GLFW before Run
2018-05-04 23:55:23 +09:00
Hajime Hoshi
f1927d8aca
shareable: Add tests
2018-05-03 14:10:43 +09:00
Hajime Hoshi
03dcd94884
shareable: Bug fix: Don't mark disposed when the image becomes not shared
2018-05-03 11:49:55 +09:00
Hajime Hoshi
9efccea31c
ui: Add SetWindowTitle
...
Fixes #595
2018-05-02 19:21:17 +09:00
Hajime Hoshi
0e19aa558a
graphics: Remove unneeded GL calls
2018-05-02 01:12:17 +09:00
Hajime Hoshi
6a34b87a6c
opengl: Refactoring
2018-05-02 01:01:04 +09:00
Hajime Hoshi
ea1444ea7e
shareable: Add checks at operations for disposed images
2018-04-30 03:34:35 +09:00
Hajime Hoshi
9df977dff8
shareable: Add 'disposed' state instead of 'allocated' state
2018-04-30 03:30:10 +09:00
Hajime Hoshi
5dc1df3260
shareable: Fix tests
2018-04-29 19:15:04 +09:00
Hajime Hoshi
1f1847c259
shareable: Remove println
2018-04-29 19:10:36 +09:00
Hajime Hoshi
9c408dce7c
shareable: Lazy allocation ( #592 )
...
Clear is called when an image becomes a render target, and it
looks like Clear causes the memory spikes.
Before this change, when an image is created, shared region on a GL
texture is allocated. After that, the image's region is copied to
non-shared region when the image becomes a rendering target.
After this change, an image is not allocated on a GL texture first,
and allocated only when it is necessary. Then, Clear calls can be
avoided as much as possible.
2018-04-29 18:51:51 +09:00
Hajime Hoshi
916c7aac8a
restorable: Fix comments
2018-04-29 13:49:33 +09:00
Hajime Hoshi
45afb6db67
Reland: restorable: Merge Clear to ReplacePixel
2018-04-29 13:40:18 +09:00
Hajime Hoshi
613f384cb5
graphics: Add EBITEN_DUMP_IMAGES_KEY
...
Fixes #589
2018-04-28 22:08:20 +09:00
Hajime Hoshi
eb357f61b5
restorable: Bug fix: Calling At must resolve the image's stale state
2018-04-28 21:56:20 +09:00
Hajime Hoshi
b22cc9d4be
Add periods after 'DO NOT EDIT'
2018-04-28 03:37:19 +09:00
Hajime Hoshi
0bc712422f
restorable: Bug fix: Remove SetFinalizer for disposing
...
SetFinalizer causes concurrent issue
2018-04-27 12:08:59 +09:00
Hajime Hoshi
dff492955d
shareable: Reset finalizer in any cases
2018-04-26 01:51:57 +09:00
Hajime Hoshi
1cf4f30541
Revert "restorable: Merge Clear to ReplacePixels"
...
This reverts commit fb641d88cd
.
Reason: When restoring the image where ReplacePixels is called,
dummyImage might not be restored since there is no record of
relationships between this image and dummyImage. Now pixels is not
nil when reverting by chance, but this would cause problems in the
future.
2018-04-25 22:31:48 +09:00
Hajime Hoshi
fb641d88cd
restorable: Merge Clear to ReplacePixels
...
This can avoid unnecessary stale images that requires loading
pixels from GPU.
2018-04-25 01:30:57 +09:00
Hajime Hoshi
1571e04753
Revert "graphics: Call glFlush after glTexSubImage2D for MacBook Pro"
...
This reverts commit 7f5719fadd
.
Reason: This didn't change the situation
2018-04-22 22:06:38 +09:00
Jake Bentvelzen
2f4ca72dbd
input: Add Pause and Print Screen buttons ( #555 )
...
Fixes #579
2018-04-21 09:36:28 -07:00
Hajime Hoshi
3fa2beb502
Fix the do-not-edit comment https://golang.org/s/generatedcode
2018-04-20 00:54:33 -07:00
Hajime Hoshi
b691e73342
Revert "graphics: Experimental fix: call glFlush always after glTexSubImage2D"
...
This reverts commit d2da77eb96
.
Reason: This doesn't solve the issue on MacBook Late 2013.
2018-04-14 23:16:26 +09:00
Hajime Hoshi
d2da77eb96
graphics: Experimental fix: call glFlush always after glTexSubImage2D
2018-04-14 23:06:20 +09:00
Hajime Hoshi
7f5719fadd
graphics: Call glFlush after glTexSubImage2D for MacBook Pro
2018-04-14 17:59:10 +09:00
Hajime Hoshi
d1ef57c280
input: Remove the last period from do-not-edit comment
2018-04-14 04:22:09 +09:00
Hajime Hoshi
61d4df0e04
input: Add numpad keys for Edge ( #580 )
2018-04-14 02:43:31 +09:00
Hajime Hoshi
dd6110fbf8
input: Add KeyNumLock ( #580 )
2018-04-14 02:43:26 +09:00
Hajime Hoshi
5229e5a713
input: Add numpad keys except for Edge browser ( #580 )
2018-04-14 02:43:21 +09:00
Hajime Hoshi
4708d4a6f9
Add internal/png
2018-04-10 04:17:41 +09:00