Commit Graph

67 Commits

Author SHA1 Message Date
Hajime Hoshi
6213c17abc internal/driver: Add Graphics.Initialize 2021-07-07 13:58:42 +09:00
Hajime Hoshi
9341d21614
internal/shareable: Call DrawTriangles instead of ReplacePixels at makeShared (#1513)
When context losts never happen, reading pixels and call replace-pixels command are not needed.

Closes #1508
2021-02-26 12:56:22 +09:00
Hajime Hoshi
b2d618c2be mipmap, shareable: Refactoring: Remove SetGraphicsDriver 2020-10-13 01:36:52 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
2bdef2e8c4 restorable: Add an explicit way to detect context-lost
isTexture was used to detect context-lost and called every frame.
This was not good for performance.

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

Fixes #1175
2020-05-30 20:29:15 +09:00
Hajime Hoshi
117fd61d27 restorable: Do not dispose objects when restoring on browsers
This fix suppresses warnings on the Chrome console.
2020-05-30 19:24:03 +09:00
Hajime Hoshi
7b9cc8deb4 restorable: Add tests to dispose shaders
When a shader is disposed, all the images depending on it should
become stale, i.e., discard its all the rendering history items,
because they cannot be restored due to the lack of data on the GPU.
2020-05-26 00:20:11 +09:00
Hajime Hoshi
8e6f19b37a restorable: Add a test using shaders with multiple sources 2020-05-25 23:57:55 +09:00
Hajime Hoshi
732f288d20 restorable: Add Shader (WIP) 2020-05-25 00:50:01 +09:00
Hajime Hoshi
7b77164710 restorable: Ignore the error when restoring failed due to being not ready
(driver.Graphics).BeginFrame tries to restore the images, but
the context might be lost at that time yet. If the attempt to
restore the context because the driver is not ready, return
silently.

Fixes #1133
2020-04-12 20:01:18 +09:00
Hajime Hoshi
46601bb516 graphics: Fill the screenshot in black when the screen is not transparent
Fixes #997
2020-02-06 03:08:16 +09:00
Hajime Hoshi
b3bdf51905
graphicscommand: Return the error immediately (#1060)
Now grpahicscommand saves the error and shows the error after a
while. This was good to simplify the API but was the cause to hide
some issues.

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

Fixes #971
2020-01-19 01:18:56 +09:00
Hajime Hoshi
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
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
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
613b9bc02a restorable: Panic if an image is stale when restoring 2019-08-12 17:45:43 +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
1a2a0aeb76 restorable: Defer operations between the end and the beginning of frames
Updates #913
2019-08-12 16:08:21 +09:00
Hajime Hoshi
b348223297 restorable: Refactoring
Reduces accesses to Image member from outside.
2019-07-21 16:44:00 +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
0bf12d5519 graphics: Unify dumping logic 2019-07-20 01:46:33 +09:00
Hajime Hoshi
94852b07b2 graphics: Use ID for dumped internal images
Updates #900
2019-07-19 23:41:56 +09:00
Hajime Hoshi
7e4e9cc893 restorable: Refactoring 2019-07-15 04:17:52 +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
b41a333230 restorable: Reland: Refactoring 2019-05-26 22:16:25 +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
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
a3eddeb50f Improve panic messages 2019-02-06 23:43:03 -10:00
Hajime Hoshi
eeb8fea778 restorable: Bug fix: dummyImage must be restored first
Fixes #791
2019-01-21 00:36:53 +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
bc3ca38f76 opengl: Rename ResetGLState -> Reset and other functions 2018-11-01 03:02:08 +09:00
Hajime Hoshi
2da5192510 Rename graphics -> graphicscommand 2018-10-28 20:10:05 +09:00
Hajime Hoshi
6c8b7f8e9c graphics: Refactoring: Reduce error propagations 2018-07-12 03:08:50 +09:00
Hajime Hoshi
613f384cb5 graphics: Add EBITEN_DUMP_IMAGES_KEY
Fixes #589
2018-04-28 22:08:20 +09:00
Hajime Hoshi
c767c0631e restorable: Remove unneeded mutex 2018-03-25 23:40:39 +09:00
Hajime Hoshi
fc47d2843a restorable: Add TestRestoreChain2 2018-03-25 19:43:32 +09:00
Hajime Hoshi
c47b549fd1 restorable: Refactoring: Make functions more atomic 2018-03-25 18:21:43 +09:00
Hajime Hoshi
0acf021e03 restorable: Dispose images explicitly when restoring (#567) 2018-03-24 23:27:08 +09:00
Hajime Hoshi
1616373819 restorable: Ensure the given image is not nil at makeStaleIfDependingOn 2018-03-24 21:57:22 +09:00
Hajime Hoshi
d0592d30e0 graphics: Improve clearing the offscreen performance 2018-03-02 01:55:40 +09:00
Hajime Hoshi
2507379494 restorable: Skip resolving stale images when possible 2018-02-23 03:19:20 +09:00
Hajime Hoshi
80940f9070 restorable: Add comments 2017-09-15 00:24:18 +09:00