Commit Graph

152 Commits

Author SHA1 Message Date
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
629d58b93a graphics: Remove PutQuadVertices 2019-09-21 04:14:25 +09:00
Hajime Hoshi
9e78d8c656 graphicscommand: Bug fix: Fix tests 2019-09-21 03:36:48 +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
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
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
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
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
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
93c31654da graphicscommand: Refactoring 2019-06-25 23:55:33 +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
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
008de78cec graphics: Refactoring: Change QuadVertices -> PutQuadVertices for consistency 2019-06-21 02:20:31 +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
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
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
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
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
bf67998fc5 graphicscommand: Bug fix: Do not assure the initial state of the image 2018-12-23 01:18:05 +09:00
Hajime Hoshi
ff62876552 Add Metal implementation
Fixes #621
2018-12-20 02:37:10 +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
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
b48d501bc0 graphics: Explicit limitation of indices at DrawTriangles
Fixes #728
2018-11-23 19:02:10 +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
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
241716d0e6 Add package graphicsdriver; Move opengl to graphicsdriver/opengl 2018-11-10 22:52:37 +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
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
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
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
c935c28498 opengl: Move Framebuffer from graphicscommand to opengl and rename it to FramebufferStruct 2018-11-04 17:39:01 +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
Hajime Hoshi
45017213a7 opengl: Unexport (Element)ArrayBufferSubData 2018-10-31 00:59:44 +09:00
Hajime Hoshi
99594fe732 opengl: Remove type mode 2018-10-30 22:36:12 +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
395b46d8da graphicsutil: Remove dependency on graphicscommand 2018-10-28 23:00:10 +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