Commit Graph

234 Commits

Author SHA1 Message Date
Hajime Hoshi
e60e6ca5ac internal/shareable: Optimization 2021-01-26 00:43:45 +09:00
Hajime Hoshi
34695dc845 shareable: Refactoring 2021-01-18 00:35:09 +09:00
Hajime Hoshi
0c578f1670 shareable: Rename notUpdatedCount -> usedAsSourceCount and modify implementation
Before this change, the image automatically becomes on a shareable
texture again when the image is not modified for a while. This was
problematic when an offscreen is not updated for a while, but used
as a render target again, as an independent image for the image is
created every time when the image is used as a render target.

After this change, the count is updated only when the image is used
as a rendering source.

Closes #1465
2021-01-17 19:00:16 +09:00
Hajime Hoshi
c92ccfff79 shareable: Limit the texture size to 8192
Closes #1453
2020-12-31 17:52:18 +09:00
Hajime Hoshi
257d747f7d shareable: Refactoring 2020-11-14 13:15:42 +09:00
Hajime Hoshi
d179dab314 shareable: Refactoring 2020-11-14 01:03:18 +09:00
Hajime Hoshi
0366103b2e shareable: Bug fix: Crash when syncing pixels of a disposed image
When an image was disposed, the image was not unregistered from the
set of 'imagesToMakeShared'. This caused a crash when trying to sync
the pixel data of the disposed image.

This change fixes the issue by unregistering the image when the
image is disposed.

Fixes #1421
2020-11-12 23:37:51 +09:00
Hajime Hoshi
c7330883ef restorable: Remove Fill and make (*ebiten.Image).Fill available for sub-images
Now a scissor (a clipping region) can be specified, we don't have to
worry about the rendering results out of the specified region.
Replace the implmenetation of the Fill with just a DrawTriangles with
an empty white image.

As a side effect, SubImage is avilable for Fill.

Fixes #1416
2020-11-08 02:50:06 +09:00
Hajime Hoshi
ed028110cf ebiten: Allow rendering on a sub-image by scissor test
Fixes #1255
2020-11-08 00:58:44 +09:00
Hajime Hoshi
a8f96ee9af graphicsdriver/metal: Add Sync to sync CPU and GPU asynchronously
Fixes #1414
2020-11-07 04:09:47 +09:00
Hajime Hoshi
e30d46e947 shareable: Reset non-updated-count at ReplacePixels
Before this change, ReplacePixels didn't affect the non-updated-count,
and an image using ReplacePixels tended to be on a shared image.
This was OK, but as lazy pixel loading is going to be introduced,
ReplacePixels also needs to reset the count.

Updates #1414
2020-11-06 02:19:02 +09:00
Hajime Hoshi
34d7385e6d shareable: Refactoring 2020-11-06 01:45:08 +09:00
Hajime Hoshi
a3bccf5ff7 shareable: Refactoring 2020-11-06 00:48:32 +09:00
Hajime Hoshi
b2d618c2be mipmap, shareable: Refactoring: Remove SetGraphicsDriver 2020-10-13 01:36:52 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
f3ef2e2af5 Performance optimization for the path without a shader
Fixes #1355
2020-09-21 05:43:24 +09:00
Hajime Hoshi
8d17ec837a shareable: Refactoring 2020-09-21 01:58:00 +09:00
Hajime Hoshi
138d9b8e47 shareable: Bug fix: Wrong offset calculation 2020-09-21 01:52:21 +09:00
Hajime Hoshi
41564533f9 ebiten: Allow SubImage at DrawRectShader 2020-09-20 04:48:10 +09:00
Hajime Hoshi
0f21829867 shareable: Bug fix: Add the padding to the offsets when there are no sources
Fixes #1320
2020-08-27 03:42:23 +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
Hajime Hoshi
36e9803cea shader: Enable to get pixels from multiple images
Updates #1193
2020-07-19 02:33:43 +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
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
ab95c9014d buffered, shareable: Bug fix: Check source images correctly 2020-07-15 03:37:35 +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
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
999b726b72 shareable: Bug fix: The first image's region in the uniform vriables was ignored 2020-06-30 00:50:40 +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
dea3785750 shareable, restorable, graphicscommand: Remove making arrays at DrawTriangles
Updates #1220
2020-06-29 13:37:37 +09:00
Hajime Hoshi
383ff1e6a7 shareable: Use as big backends as possible
As the shader hack is removed at d74f7d3a77,
any sizes of textures should work regardless of the float precision.
2020-06-28 04:14:55 +09:00
Hajime Hoshi
7e01ba17c1 shareable: Bug fix: wrong size calculation
The size calculation must consider the paddings.

Fixes #1217
2020-06-27 17:21:26 +09:00
Hajime Hoshi
7b6182d05a shareable: Update comments 2020-06-27 02:46:29 +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
1735dda586 shareable: Rename border -> padding 2020-06-16 12:48:20 +09:00
Hajime Hoshi
d74f7d3a77 shareable: Add gaps between images
After this change, each image on the texture atlases has a
transparent border around it.

This change removes the hack to round texels not to violate the
source regions.

Fixes #1194
Updates #1171
2020-06-14 18:05:41 +09:00
Hajime Hoshi
22919909d7 shareable: Refactoring 2020-06-14 15:30:03 +09:00
Hajime Hoshi
2f843c49a6 shader: Fix the case when the source image is nil for shaders 2020-06-04 01:35:35 +09:00
Hajime Hoshi
b2eee7ee8a graphicscommand: Adjust regions for secondory and following images correctly 2020-05-30 15:52:56 +09:00
Hajime Hoshi
833a364ba8 testing: Bug fix: Image's size should not be in uniform variables 2020-05-30 05:16:50 +09:00
Hajime Hoshi
18c59e44aa shareable: Allow multiple call of (*Shader).Dispose 2020-05-29 03:47:06 +09:00
Hajime Hoshi
9c637c65be shareable: Add Shader 2020-05-29 00:15:42 +09:00
Hajime Hoshi
732f288d20 restorable: Add Shader (WIP) 2020-05-25 00:50:01 +09:00
Hajime Hoshi
3550abef7a shareable: Replace At with Pixels
This change replaces the API At with Pixels to reduce mutex locks.

Updates #1137
2020-04-18 21:05:51 +09:00
Hajime Hoshi
47d5c3b5e1 Add testing package 2020-04-01 18:10:48 +09:00
Hajime Hoshi
ef5e917feb shareable: Remove old comments
This was introduced at cbf36734f8,
but the situation was changed at 9d867850dc
2020-04-01 00:58:33 +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