Commit Graph

82 Commits

Author SHA1 Message Date
Hajime Hoshi
1a0d92267b driver: Add shader API and implement it on OpenGL
Updates #482
2020-05-23 22:09:12 +09:00
Hajime Hoshi
8fd377f1e3 driver: Add ImageID and use this
This is a preparation to introduce shaders. Shader programs
require images as uniform variables, but the current way would make
API complex unnecessarily.
2020-05-20 00:11:08 +09:00
Hajime Hoshi
9b8c547342 graphicscommand: Do not flush (glFlush) when commands are empty
Fixes #1140
2020-04-23 00:51:28 +09:00
Hajime Hoshi
3437f35444 graphicscommand: Fix debug messages 2020-04-08 13:48:22 +09:00
Hajime Hoshi
fa90e48eec graphicscommand: Show the number of indices when dumping the command 2020-04-05 14:38:54 +09:00
Hajime Hoshi
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
c9bc5913fd driver: Refactoring: Remove Graphics.Flush
Updates #226
2019-12-06 08:56:55 +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
c2eae69b47 graphicscommand: Refactoring 2019-11-14 00:08:44 +09:00
Hajime Hoshi
e578b0bd49 graphicscommand: Bug fix: Needed to adjust vertices when highp is not available
Fixes #962
2019-10-19 17:05:04 +09:00
Hajime Hoshi
907302c440 graphicscommand: Keep the capacity at q.commands 2019-09-29 03:23:40 +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
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
fc3e8bebe4 Use 0-length slice instead of nil to keep capacities 2019-09-27 00:34:55 +09:00
Hajime Hoshi
70a38dc09a graphicscommand: Move pixel->texel conversion to graphicscommand 2019-09-20 23:59:04 +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
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
0cf11d9af8 graphicscommand: Improve debug messages
This change also enables to dump volatile images.
2019-07-20 14:31:28 +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
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
7e0dee0730 graphicscommand: Bug fix: Use graphics.InternalImageSize before specifying the size
Fixes #887
2019-06-25 22:47:37 +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
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
fcb5554aa1 driver: Add Graphics.NeedsRestoring 2019-05-26 19:46:12 +09:00
Hajime Hoshi
39395c4c76 graphicscommand: Rename draw-image -> draw-triangles 2019-05-08 11:58:17 +09:00
Hajime Hoshi
cce41e8152 graphics: Rename DrawImage -> DrawTriangles for consistency 2019-04-22 23:12:36 +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
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
747d1be54e driver: Move getting actual drivers to ebiten package 2019-03-30 22:19:21 +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
8e42484294 graphicscommand: Add 'address' to (*DrawImageCommand).String 2019-02-10 14:27:49 +09:00
Hajime Hoshi
a3eddeb50f Improve panic messages 2019-02-06 23:43:03 -10: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
f1582c2d73 graphics: Add Address representing a sampler address mode
Fixes #761
2018-12-24 17:29:31 +09:00
Hajime Hoshi
ff62876552 Add Metal implementation
Fixes #621
2018-12-20 02:37:10 +09:00
Hajime Hoshi
b48d501bc0 graphics: Explicit limitation of indices at DrawTriangles
Fixes #728
2018-11-23 19:02:10 +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