Commit Graph

1707 Commits

Author SHA1 Message Date
Hajime Hoshi
2d079b123f restorable: Add ResetRestoringState to reset the state
After Fill command, the image doesn't have to keep the restoring
information. Now Fill command is as same as DrawTriangles, there
is no way for restorable.Image to know whether it can reset the
state or not. ResetRestoringState clears the state explicitly.
2019-07-20 14:04:02 +09:00
Hajime Hoshi
3f6628f1cc restorable: Replace Fill with Clear 2019-07-20 05:00:05 +09:00
Hajime Hoshi
0dc1d0eba5 graphics: Clear/Fill is now implemented with DrawImage
Only clearing the screen still requires the special method.
2019-07-20 04:34:42 +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
38a1ee7f57 restorable: Split pixel records into regions
Fixes #897
2019-07-19 10:59:48 +09:00
Hajime Hoshi
b4dddd330a restorable: Refactoring: Use width/height instead of length at Pixels 2019-07-17 23:20:03 +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
736a840d53 restorable: More restricted Extend
As a side effect, ReplacePixels always record pixels even when
restoring is not needed. As CopyPixels reads pixels in any cases,
this shortcut was originally useless.
2019-07-17 22:15:37 +09:00
Hajime Hoshi
353d81fd58 restorable: Rename NewImageFromImage to Extend 2019-07-17 03:32:08 +09:00
Hajime Hoshi
91a4329f0d restorable: Disallow ReplacePixels for a part after Fill
This simplifies Pixels struct. This is a preparation to change
how to record pixels.

Updates #897
2019-07-17 03:15:03 +09:00
Hajime Hoshi
2735f4eddc restorable: Fix comments 2019-07-17 02:42:26 +09:00
Hajime Hoshi
349a290aa3 restorable: Refactoring 2019-07-16 03:08:26 +09:00
Hajime Hoshi
8ae2fef817 restorable: Refactoring: Do not have to update basePixels in some cases
If there is no draw-traiangles command, the image can keep its
basePixels.
2019-07-16 02:48:52 +09:00
Hajime Hoshi
6d20e3f951 restorable: Add assertion at fillImage 2019-07-16 02:18:52 +09:00
Hajime Hoshi
2b632d0707 restorable: Remove Pixels.Slice() 2019-07-16 02:03:15 +09:00
Hajime Hoshi
f3fa535afb restorable: Refactoring: Disallow nil at ReplacePixels 2019-07-16 01:44:56 +09:00
Hajime Hoshi
84aabd075f restorable: Use DrawTriangles to restore the image
This can avoid allocating a big byte slice.
2019-07-15 05:03:46 +09:00
Hajime Hoshi
7e4e9cc893 restorable: Refactoring 2019-07-15 04:17:52 +09:00
Hajime Hoshi
701c4eeb7c restorable: Fix comments 2019-07-15 03:24:18 +09:00
Hajime Hoshi
a7e7e007ca restorable: Bug fix: PutQuadVertices should take the source image
Fixes #898
2019-07-15 03:10:03 +09:00
Hajime Hoshi
aee26eec1e restorable: Refactoring: Replace CopyPixels with NewImageFromImage 2019-07-15 02:04:23 +09:00
Hajime Hoshi
fd9e376ff6 restorable: Add ClearPixels
This hides the implementation details of allocating byte slice.

This change also adds comments about #897.
2019-07-10 02:39:36 +09:00
Hajime Hoshi
5ec2f66524 shareable: Bug fix: Updated maxSize wrongly
Updates #892
2019-07-04 01:57:04 +09:00
Hajime Hoshi
3a0dbd3977 graphicsdriver/opengl: Use sync.Once for concurrent safety 2019-07-04 01:15:51 +09:00
Hajime Hoshi
6b7f21f0c8 driver: Add Graphics.MaxImageSize and use it
There are some devices that cannot accept 4096x4096 pixels
textures. Get the maximum size and use it.

Fixes #892
2019-07-04 01:10:11 +09:00
Hajime Hoshi
51951d6087 glfw: Take a byte pointer instead of a uintptr at the callback
Make 'go vet' happy on Windows.
2019-06-27 22:57:44 +09:00
Hajime Hoshi
9a0cefedce glfw: Bug fix: Missed to initialize a member of VidMode on Windows 2019-06-27 03:38:14 +09:00
Hajime Hoshi
480c5527a3 ui/mobile: Move 'DoWork' logic to ui/mobile package
This simplifies driver.Graphics interface, and will make it easy
to use another graphics driver than OpenGL.
2019-06-27 00:32:37 +09:00
Hajime Hoshi
e499535728 graphics: Move functions to the package ebiten 2019-06-26 22:23:09 +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
9963ae332e graphics: Remove FilterDefault from internal/graphics 2019-06-26 00:33:30 +09:00
Hajime Hoshi
847a8b4d53 graphics: Refactoring 2019-06-26 00:18:40 +09:00
Hajime Hoshi
93c31654da graphicscommand: Refactoring 2019-06-25 23:55:33 +09:00
Hajime Hoshi
09d473ea1b restorable: Add comments 2019-06-25 23:42:18 +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
de4b439228 uidriver/glfw: Bug fix: Thread must be set before the loop starts
The graphics driver needs to have its thread before the loop
starts, or the driver crashes (nil reference) when it tries to use
the thread.
2019-06-24 02:03:14 +09:00
Hajime Hoshi
0cc49b6923 shareable: Refactoring 2019-06-23 11:33:17 +09:00
Hajime Hoshi
7a399c1b82 shareable: Update page sizes dynamically
Also, all the images cannot use the shareable backends before the
game starts, but it is expected that read-only images will use
shareable backends later.

Fixes #879
2019-06-22 23:05:28 +09:00
Hajime Hoshi
f48a72a43e shareable: Refactoring: Remove PutQuadVertices 2019-06-22 21:13:44 +09:00
Hajime Hoshi
5d4f150094 shareable: Add comments about highp
Updates #879
2019-06-22 17:41:19 +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
8dc2301e54 thread: Bug fix: Queue funcs instead of panic
Now the thread object is created at (*UserInterface).Run, we don't
have to care whether the (main) thread is started or not when
Call is called. Admit queueing the functions.

Fixes #884
2019-06-21 11:10:27 +09:00
Hajime Hoshi
3eee4754c5 graphics: Use the common vertices backend for PutVertex 2019-06-21 02:30:58 +09:00