Commit Graph

89 Commits

Author SHA1 Message Date
Hajime Hoshi
3869e2e4f6 internal/ui: refactoring: integrate the render thread usages into internal/graphicscommand
Updates #2664
2023-07-30 03:50:49 +09:00
Hajime Hoshi
20edb04e5e internal/restorable: refactoring: add EndFrame 2023-05-08 01:09:25 +09:00
Hajime Hoshi
e5bb89aa35 internal/restorable: use a special shader to clear an image
This reduces one extra internal texture.
2023-03-01 15:47:03 +09:00
Hajime Hoshi
110ba5403d internal/buffered: remove redundant pixel data if possible 2023-02-26 01:55:43 +09:00
Hajime Hoshi
965fd4cac8 internal/restoring: bug fix: stop keeping pixel data on 32bit architecture
Updates #4259
2023-02-25 23:11:42 +09:00
Pierre Curto
4de807cc44
all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Hajime Hoshi
8cc6fa82fd internal/graphicsdriver/opengl: remove fnIsContextLost
As restoring from context lost doesn't happen on browsers, isContextLost
doesn't have to be called.
2022-11-17 12:43:26 +09:00
Hajime Hoshi
e796646abd internal/graphicscommand: rename arguments 2022-10-15 03:36:25 +09:00
Hajime Hoshi
daf349ab72 internal/graphicscommand: bug fix: present at the end of the frame explicitly
Before this change, presenting happened when the rendering destination
was the final screen. Now this assumption is wrong as the final screen
might be used in the middle of the commands due to DrawFinalScreen.

Instead, this change adds a new argument `present` to FlushCommands to
present the screen explicitly at the end of the frame.

Closes #2386
2022-10-15 01:54:46 +09:00
Hajime Hoshi
ae41530f1c internal/graphicscommand: move availableFilename to graphicscommand 2022-08-31 13:26:14 +09:00
Terra Brown
26a58d20b3
internal/graphicscommand: enable EBITENGINE_INTERNAL_IMAGES_KEY on browsers (#2283)
Closes #2270

Co-authored-by: Hajime Hoshi <hajimehoshi@gmail.com>
2022-08-31 03:10:10 +09:00
Hajime Hoshi
f7c44f086f replace Ebiten with Ebitengine in comments 2022-08-29 11:17:17 +09:00
Hajime Hoshi
6b814888b5 internal/atlas: always use DrawTriangles at putOnAtlas
DrawTriangles was introduced at #1508, and apparently there is no
reason we should use ReplacePixels here. So, simplify the logic by
using only DrawTriangles.
2022-06-10 02:58:04 +09:00
Hajime Hoshi
b8e8d72377 internal/restorable: rename ImageTypeScreenFramebuffer -> ImageTypeScreen 2022-06-07 23:45:35 +09:00
Hajime Hoshi
cb0cbb4efa internal/restorable: refactoring: introduce ImageType 2022-06-06 09:13:55 +09:00
Hajime Hoshi
151dfffad6 internal/restorable: simplify canDetectContextLostExplicitly
This constant was set with some wrong assumptions:

 1. On Android, recovering was needed.
 2. On iOS, OpenGL ES was used when
    a. The architecture was 386 or amd64 == an emulator is used
    b. The build tag ebitengl was not specified
    c. gomobile-build was used
 3. On browsers, recovering was needed.

1., 2b, and 2c are correct.

2a. is not correct: Now emulators are available on all the
architectures with both Metal and OpenGL.

3. is not correct: Ebiten no longer recovers the contest lost.

Now, Ebiten can detect a context lost explicitly when

 1. On Android
 2. On iOS and on gomobile-build
    (When gomobile-build is used, OpenGL should always be used)

Based on this fact, this change changes the constant to a variable,
and fixes the logic to set the variable.
2022-03-23 03:01:59 +09:00
Hajime Hoshi
4cbce71b2b internal/graphicscommand: move the choice of graphics drivers to internal/ui 2022-03-20 02:51:31 +09:00
Hajime Hoshi
df60c4c92d internal/driver: rename to internal/graphicsdriver 2022-02-06 20:41:32 +09:00
Hajime Hoshi
96dc80fd08 internal/restorable: Remove needsDisposingWhenRestoring
Now restoring from context lost doesn't work on browsers. Then,
the constant needsDisposingWhenRestoring is actually always true.
2021-10-23 23:46:29 +09:00
Hajime Hoshi
8f857daf3e internal/restorable: Bug fix: Forbid NewImage before the graphics driver is ready 2021-09-09 03:58:58 +09:00
Hajime Hoshi
60b8f82bfd graphicscommand: Dump internal image info on the debug mode
Closes #1714
2021-08-05 01:16:42 +09:00
Hajime Hoshi
18903db1c6 internal/atlas: Bug fix: Unexpected padding in screenshots
Closes #1736
2021-07-29 16:09:29 +09:00
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