Commit Graph

49 Commits

Author SHA1 Message Date
Hajime Hoshi
8fd377f1e3 driver: Add ImageID and use this
This is a preparation to introduce shaders. Shader programs
require images as uniform variables, but the current way would make
API complex unnecessarily.
2020-05-20 00:11:08 +09:00
Hajime Hoshi
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
65fdf48cbf graphicsdriver: Refactoring: ReplacePixels takes multiple arguments
This reduces the number of graphics commands, and this works more
efficiently if the driver has an efficient way.
2019-11-21 23:52:12 +09:00
Hajime Hoshi
e42cff071c restorable: Merge two 'copy' into one
Fixes #983
2019-11-16 02:10:53 +09:00
Hajime Hoshi
aa6fc67736 Revert "graphics: Avoid all copying pixels"
This reverts commit c60a32a479.

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

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

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

Updates #983
2019-11-16 00:29:37 +09:00
Hajime Hoshi
f873b66267 graphicscommand: Reduce calling InternalWidth/InternalHeight 2019-09-28 23:03:11 +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
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
ccacc4a0b8 restorable: Refactoring: Make (*Image).Size() available even after disposing 2019-08-16 02:36:27 +09:00
Hajime Hoshi
b348223297 restorable: Refactoring
Reduces accesses to Image member from outside.
2019-07-21 16:44:00 +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
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
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
93c31654da graphicscommand: Refactoring 2019-06-25 23:55:33 +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
cce41e8152 graphics: Rename DrawImage -> DrawTriangles for consistency 2019-04-22 23:12:36 +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
7445144194 Move graphicsdriver.GrapahicsDriver to driver.Graphics 2019-03-30 22:38:02 +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
b34834a895 graphicscommand: Explicitly forbide ReplacePixels for a part after DrawImage 2019-01-06 05:15:27 +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
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
d29cabca43 graphicsdriver: Remove MaxImageSize 2018-12-15 03:46:32 +09:00
Hajime Hoshi
e537cb2c27 graphics: Bug fix: render source might not be initialized 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
61ca48225c graphicsdriver: Rename MaxTextureSize -> MaxImageSize 2018-11-11 01:26:37 +09:00
Hajime Hoshi
241716d0e6 Add package graphicsdriver; Move opengl to graphicsdriver/opengl 2018-11-10 22:52:37 +09:00
Hajime Hoshi
07ae1db0dd opengl: Add Driver 2018-11-07 01:43:07 +09:00
Hajime Hoshi
531251d4ad opengl: Unexport NewTexture 2018-11-04 19:39:14 +09:00
Hajime Hoshi
2a7caf7755 opengl: Move ensureFramebuffer to opengl.Image 2018-11-04 19:06:33 +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
c935c28498 opengl: Move Framebuffer from graphicscommand to opengl and rename it to FramebufferStruct 2018-11-04 17:39:01 +09:00
Hajime Hoshi
3a8ddd6279 graphicscontext: Rename createFramebufferIfNeeded -> ensureFramebuffer 2018-11-01 03:42:30 +09:00
Hajime Hoshi
e28c7b0f50 graphicscommand: Remove Texture 2018-11-01 03:29:23 +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