Commit Graph

556 Commits

Author SHA1 Message Date
Hajime Hoshi
c2ee8e8d59 ebiten: Remove returning values from (*Image).Clear and Fill
Updates #1380
2020-10-06 00:08:55 +09:00
Hajime Hoshi
83ead375a4 ebiten: Update comments 2020-10-05 02:00:50 +09:00
Hajime Hoshi
448a863eb1 ebiten: Remove FilterDefault
Fixes #503
2020-10-05 01:48:47 +09:00
Hajime Hoshi
fe97e7b0a5 ebiten: Remove the filter argument from NewImage and NewImageFromImage
Updates #503
2020-10-05 01:40:44 +09:00
Hajime Hoshi
2dadc6a7a9 ebiten: Make AddressUnsafe default
Fixes #1228
2020-10-04 23:49:35 +09:00
Hajime Hoshi
0c85100898 ebiten: Remove some deprecated members from DrawImageOptions
Updates #1127
2020-10-04 04:51:56 +09:00
Hajime Hoshi
1d4ff9a906 ebiten: Remove the deprecated functions and constants
Updates #1127
2020-10-04 04:47:24 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Bui Quoc Trong
0d29979296
Fix the comment style cause heading in pkgsite (#1369) 2020-09-29 16:55:39 +09:00
Hajime Hoshi
9f49e68fea ebiten: Add links to documents/shader.html 2020-09-23 16:45:00 +09:00
Hajime Hoshi
76b701a03d ebiten: Better comments about uniform variables 2020-09-23 16:24:41 +09:00
Hajime Hoshi
b2f6cc5791 ebiten: Revive DrawTrianglesShader
Updates #1325
2020-09-20 18:55:24 +09:00
Hajime Hoshi
938d78122f ebiten: Remove shaders from DrawImage
Updates #1325
2020-09-20 18:14:01 +09:00
Hajime Hoshi
0db7dc22b2 ebiten: Allow SubImage at DrawTriangles 2020-09-20 05:10:08 +09:00
Hajime Hoshi
41564533f9 ebiten: Allow SubImage at DrawRectShader 2020-09-20 04:48:10 +09:00
Hajime Hoshi
f287fada13 ebiten: Update comments 2020-09-20 01:05:16 +09:00
Hajime Hoshi
85a6ef2ea6 ebiten: Add comments 2020-09-19 21:07:23 +09:00
Hajime Hoshi
1d51be7f68 ebiten: Merge DrawTriangles and DrawTrianglesShader
Updates #1325
2020-09-19 19:18:02 +09:00
Hajime Hoshi
abbb929148 ebiten: Bug fix: Wrong uniform type was used
This change also includes PanicOnErrorAtImageAt, which panics when
an error is detected at (*Image).At. This function is only for testing.

Fixes #1349
2020-09-17 20:52:32 +09:00
Hajime Hoshi
850303b770 ebiten: Change the type of Uniforms to map[string]interface{}
Fixes #1324
2020-09-06 21:02:30 +09:00
Hajime Hoshi
8aef1f9080 restorable: Enable to set the 'volatile' state later
Updates #1309
2020-08-19 00:57:23 +09:00
Hajime Hoshi
d4042a5cfa ebiten: Bug fix: Source regions should not be passed when not needed
The source region information affects the condition of merging
graphics commands. To avoid performance issues by the big number of
graphcis commands, do not pass the source region whenever possible.

Fixes #1293
2020-08-12 02:12:35 +09:00
Hajime Hoshi
69f87d5fd1 ebiten: Add new shader builtin functions: image[N]TextureBoundAt
Fixes #1287
2020-08-11 03:24:54 +09:00
Muang
5a5a45a42f
ebiten: Correct a typo (#1282) 2020-08-08 03:12:18 +09:00
szzhiyang
4249697062
Fix typo in the documentation for DrawImageOptions (#1275)
"The default (zero) value is identify" -> "The default (zero) value is identity"
2020-07-30 11:32:57 +09:00
Hajime Hoshi
52a5ea2d44 ebiten: More precise calculation for mipmap 2020-07-26 18:41:59 +09:00
Hajime Hoshi
637afe6d67 mipmap: Skip mipmap calculation if possible
If we know we can skip mipmap calculation from GeoM, let's skip it.

Updates #1265
2020-07-26 12:25:03 +09:00
Hajime Hoshi
d017a1b95e Swap the order of the dependencies 'buffered and 'mipmap' 2020-07-26 12:15:23 +09:00
Hajime Hoshi
968f077bab ebiten: Enable to specify a shader to (*Image).DrawTriangles 2020-07-25 23:29:10 +09:00
Hajime Hoshi
2bdbcd724d ebiten: Rename Draw*WithShader -> Draw*Shader
Updates #1168
2020-07-25 23:15:11 +09:00
Hajime Hoshi
434c58e8b3 ebiten: Use the term 'sub-image' instead of subimage 2020-07-23 19:57:43 +09:00
Hajime Hoshi
96921668ca ebiten: Move the definition DrawImageOptions 2020-07-23 18:55:19 +09:00
Hajime Hoshi
0123c0676a ebiten: Fix comments 2020-07-23 17:14:36 +09:00
Hajime Hoshi
388e2623e8 ebiten: Merge DrawImage and DrawImageWithShader
Updates #1168
2020-07-23 17:08:35 +09:00
Hajime Hoshi
ec9863dfef ebiten: Bug fix: Wrong argument type at DrawImageWithShader 2020-07-21 06:23:39 +09:00
Hajime Hoshi
65783489a5 ebiten: Panic when a sub-image is specified at DrawRectangleWithImage and DrawTrianglesWithShader
Updates #1168
2020-07-20 23:04:19 +09:00
Hajime Hoshi
63f83ceeaa ebiten: Add DrawImageWithShader
Fixes #1168
2020-07-20 22:55:21 +09:00
Hajime Hoshi
c567a7b507 ebiten: Add DrawRectangleWithShader
Updates #1168
2020-07-20 22:48:22 +09:00
Hajime Hoshi
76534fcf5f ebiten: Fix comments: a triangle -> triangles 2020-07-20 20:54:12 +09:00
Hajime Hoshi
1123cf46f9 ebiten: DrawTriangles is no longer experimental 2020-07-20 20:38:24 +09:00
Hajime Hoshi
e34bb20dcd ebiten: Add comments for DrawTrianglesWithShader(Options) 2020-07-20 20:37:10 +09:00
Hajime Hoshi
fe79bb27af graphicscommand: Refactoring 2020-07-18 23:25:16 +09:00
Hajime Hoshi
e0d5763a60 shader: Use the fixed number of images for shaders
This changes uses arrays rather than slices in order to avoid heap
allocations.

Updates #1193
2020-07-18 18:27:47 +09:00
Hajime Hoshi
0c13fff62a ebiten: Add a restriction that all the source image sizes are same
Updates #1193
2020-07-17 02:17:31 +09:00
Hajime Hoshi
f927e09f56 mipmap: Unify DrawImage and DrawTriangles
Fixes #909
2020-07-16 02:31:17 +09:00
Hajime Hoshi
7f2be42410 mipmap: Use mipmap for DrawTriangles
Updates #909
2020-07-16 02:31:11 +09:00
Hajime Hoshi
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
d6bce5b9d2 ebiten: Add a comment 2020-07-12 03:17:05 +09:00
Hajime Hoshi
d217bc6033 ebiten: Sparate textures from uniforms at DrawTrianglesWithShader
Updates #1193
Updates #1239
2020-07-09 01:59:21 +09:00
Hajime Hoshi
02ef92f4cd ebiten: Remove copying pixels from ReplacePixels and copyImage (renamed to imageToBytes)
This optimization utilizes the fact that copying happens in the
'shareable' package to add paddings.

Updates #1222
2020-07-03 03:01:48 +09:00
Hajime Hoshi
f7757ae025 ebiten: Add AddressUnsafe
Fixes #1219
2020-07-03 00:33:07 +09:00
Hajime Hoshi
b83f0acc4d Remove source-region information from vertices
Fixes #1210
2020-07-02 23:38:39 +09:00
Hajime Hoshi
71c9e7ac40 driver: Add Region and sourceRegion parameter at Draw
This is a preparation to remove source-region information from
vertices.

Updates #1210
2020-07-02 03:26:05 +09:00
Hajime Hoshi
4c640d2500 buffered, restorable: Remove copying pixels
Instead, the callers (ebiten.NewImageFromImage and
(*ebiten.Image).ReplacePixels) have responsibility to copy the
pixels now. This change should reduce unnecessary copying pixels.

Updates #1222
2020-07-01 02:56:40 +09:00
Hajime Hoshi
6fd2a82614 ebiten: Fix comments 2020-06-30 22:01:28 +09:00
Hajime Hoshi
1fe2f47701 graphicscommand: Remove the source-region parts from the uniform variables 2020-06-30 00:44:05 +09:00
Hajime Hoshi
36515eb1f5 Revert "ebiten: Make ebiten.Image and buffered.Image 1:1"
This reverts commit 620981a09a.

Fixes #1218
Updates #896
2020-06-28 01:01:39 +09:00
Hajime Hoshi
2a63512c6e driver: Add AddressUnsafe
This skips the source-region check and reduces 'if' branches from
shader programs.

AddressUnsafe is internal only so far. We might expose this value
later.

Updates #1210
2020-06-25 01:00:38 +09:00
Hajime Hoshi
530723ec66 ebiten: Bug fix: Crash at examples/shader 2020-06-17 01:47:01 +09:00
Hajime Hoshi
620981a09a ebiten: Make ebiten.Image and buffered.Image 1:1
This change creates a new buffered.Image even for a sub-image. This
can increase a memory usage a little, but decrease the GPU memory
usage since only the necessary pixels are allocated on a texture
atlas.

Fixes #896
Updates #1194
2020-06-14 11:15:38 +09:00
Hajime Hoshi
e180598ce0 ebiten: Rename a variable 2020-06-14 02:35:46 +09:00
Hajime Hoshi
137663c0df ebiten: Refactoring 2020-06-13 21:21:37 +09:00
Hajime Hoshi
40906676e6 buffered: Add 'Pixels' and remove 'At'
This is a preparation to make shareable.Image and ebiten.Image 1:1
Now sub-images doesn't have its own shareable.Image.

Updates #896
Updates #1194
2020-06-13 21:01:50 +09:00
Hajime Hoshi
5db4a55a07 ebiten: Check the source images are not disposed at DrawTriangles and DrawTrianglesWithShader 2020-06-13 18:12:21 +09:00
Hajime Hoshi
3566dddfbf ebiten: Refactoring 2020-06-13 17:33:29 +09:00
Hajime Hoshi
ba36d5a8e9 shader: Reland: Add a predefined uniform variable: __viewportSize 2020-06-07 00:14:09 +09:00
Hajime Hoshi
fe308f1971 Revert "shader: Add a predefined uniform variable: Internal_ViewportSize"
This reverts commit 6f411842f0.

Reason: Test failures on internal/restorable
2020-06-05 04:36:09 +09:00
Hajime Hoshi
6f411842f0 shader: Add a predefined uniform variable: Internal_ViewportSize 2020-06-05 03:00:43 +09:00
Hajime Hoshi
d0aa18ddb9 Add shader public APIs experimentally
Updates #1168
2020-06-04 01:40:50 +09:00
Hajime Hoshi
f92253487f buffered: Add Shader 2020-05-30 03:36:28 +09:00
Hajime Hoshi
a1ac574a60 docs: Use 'Deprecated:' annotation
Fixes #1160
2020-05-19 01:50:55 +09:00
Hajime Hoshi
4b63be0156 graphics: Use float64 in GeoM
The reason why float32 was adopted was forgotten. Using float64
should not be problematic.

Fixes #883
2020-03-16 00:38:33 +09:00
Hajime Hoshi
dc96d25457 graphics: Fix comments on ReplacePixels 2020-02-16 22:25:32 +09:00
Hajime Hoshi
875a529708 graphics: Allow ReplacePixels on a sub-image
Fixes #980
2020-02-16 22:18:07 +09:00
Hajime Hoshi
d9bd7ab07d buffered: Remove (*Image).Set
This is a preparation for ReplacePixels of a sub-image.

Updates #980
2020-02-16 21:45:28 +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
c99fd1a742 mipmap: Create mipmap package and bufferd.Image uses it
Mipmap calculation must be executed after the main loop starts
because the graphics driver's HasHighPrecisionFloat is needed.
Then, operations on mipmap images must be called from images in
buffered package.

Updates #1044
2020-01-08 02:06:01 +09:00
Hajime Hoshi
8243c1838a docs: Update the links 2019-11-19 01:59:36 +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
75a88fd112 Revert "graphics: Fix comments"
This reverts commit 7ac1f62c52.
2019-11-16 02:04:31 +09:00
Hajime Hoshi
7ac1f62c52 graphics: Fix comments
Updates #983
2019-11-16 01:54:21 +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
77a8ece691 graphics: Remove unnecessary copying pixels
Updates #983
2019-11-16 01:38:38 +09:00
Hajime Hoshi
5027bc1af5 buffered: Allow Set before the game runs
Fixes #949
2019-10-12 03:13:29 +09:00
Hajime Hoshi
1b011e3864 graphics: Bug fix: unexpected panic at Set with an out-of-range position 2019-10-12 02:28:55 +09:00
Hajime Hoshi
2d2da09b85 graphics: At doesn't have to discard pending pixels 2019-10-05 00:18:45 +09:00
Hajime Hoshi
4c90674e17 graphics: Keep pendingPixels not to read pixels from GPU unnecessarily
Fixes #947
2019-10-05 00:14:52 +09:00
Hajime Hoshi
79b32c7601 graphics: Add buffered package
Moved the command queue to the package.
2019-09-21 22:34:37 +09:00
Hajime Hoshi
0a872b342a shareable: Change the argument to color.RGBA at Fill
The argument will be copied explicitly.
2019-09-21 21:16:46 +09:00
Hajime Hoshi
1c2c932c6c graphics: Remove MakeVolatile/IsVolatile 2019-09-21 14:53:52 +09:00
Hajime Hoshi
52b52e7d92 grpahics: Move DrawImage implementation to mipmap and remove (*mipmap).original() 2019-09-19 11:25:33 +09:00
Hajime Hoshi
e585fda253 grpahics: Move DrawTriangles implementation to mipmap 2019-09-19 11:15:14 +09:00
Hajime Hoshi
504a433540 graphics: Reduce original() usage 2019-09-19 02:27:20 +09:00
Hajime Hoshi
95bc445fea graphics: Refactoring: Remove imports 2019-09-19 02:17:35 +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
464713f19d graphics: Refactoring 2019-08-25 22:06:20 +09:00
Hajime Hoshi
3646e7930d graphics: Bug fix: the flag and the enqueueing operation must be protected by a same mutex
It was theoretically possible that an item was enqueued even
though the flag said it should not.
2019-08-25 21:22:54 +09:00
Hajime Hoshi
fc939fabb8 graphics: Bug fix: Copy variables out of the closures 2019-08-25 21:06:44 +09:00
Hajime Hoshi
d2312f1450 shareable: Lock before BeginFrame
This make package shareable more consistent. The mutex is lock
after EndFrame and before BeginFrame, and the similar rule will be
applied at launching (BeginFrame unlocks the lock in any cases).

Instead, package ebiten queues image operations if BeginFrame and
doesn't create provisional non-shared images. This should improve
performance at launching since this reduces the number of draw
calls, especifally for creating new images.

Updates #879.
Updates #921.
2019-08-25 18:12:04 +09:00