Hajime Hoshi
8522bfd0bf
internal/graphicscommand: bug fix: replacePixelsCommand should not read pixels
...
Reading pixels, writing pixels, and using the image as a source might
cause a flaky behavior with Metal. Stop reading pixels if possible.
Closes #2180
2022-07-05 23:30:26 +09:00
Hajime Hoshi
6b814888b5
internal/atlas: always use DrawTriangles at putOnAtlas
...
DrawTriangles was introduced at #1508 , and apparently there is no
reason we should use ReplacePixels here. So, simplify the logic by
using only DrawTriangles.
2022-06-10 02:58:04 +09:00
Hajime Hoshi
6b212d7642
internal/restorable: refactoring: add Image.needsRestoring
2022-06-08 02:24:10 +09:00
Hajime Hoshi
9f729cf5c3
internal/restorable: remove SetVolatile
2022-06-08 02:20:09 +09:00
Hajime Hoshi
b8e8d72377
internal/restorable: rename ImageTypeScreenFramebuffer -> ImageTypeScreen
2022-06-07 23:45:35 +09:00
Hajime Hoshi
73c893e977
internal/restorable: refactoring: unify NewScreenFramebufferImage and NewImage
2022-06-06 09:33:50 +09:00
Hajime Hoshi
31fd736ca5
internal/graphicscommand: refactoring: unify NewScreenFrameBufferImage and NewImage
2022-06-06 09:21:11 +09:00
Hajime Hoshi
cb0cbb4efa
internal/restorable: refactoring: introduce ImageType
2022-06-06 09:13:55 +09:00
Hajime Hoshi
6710808cd1
ebiten: compile shaders at NewShader
...
Closes #2035
2022-04-04 02:52:57 +09:00
Hajime Hoshi
f75a70dc40
internal/graphicscommand: treat []float32 instead of interface{} for uniform variables
2022-04-03 03:51:52 +09:00
Hajime Hoshi
34e23f5256
internal/restorable: treat texels instead of pixels
...
Updates #1820
2022-04-02 04:25:27 +09:00
Hajime Hoshi
81b9f91f86
internal/graphicscommand: compile shaders lazily
...
With DirectX, the graphics driver cannot be determined until the
main loop starts, as a transparent window cannot be treated with
DirectX so far. On the other hand, compiling shaders requires a
graphics driver as it requires information about Y directions of
NDCs and framebuffers.
This change delays compiling shaders until the graphics commands
are actually executed in the main loop.
Updates #1007
Updates #2019
2022-03-21 21:09:02 +09:00
Hajime Hoshi
dfc9eeaaec
internal/restorable: bug fix: the parameter mask was not passed correctly
2022-03-21 05:40:13 +09:00
Hajime Hoshi
5c79b86412
internal/restorable: add a new parameter specifying a mask for ReplacePixels
2022-03-21 03:08:58 +09:00
Hajime Hoshi
5fe6791b5d
internal/graphicscommand: add a new paramter 'mask' to ReplacePixels
2022-03-21 01:11:01 +09:00
Hajime Hoshi
c1a0d83f8d
internal/restorable: simplify the implementation of rect
...
Allow overlapped regions at pixelsRecords.
This removes the members `last*` for caching. These were introduced
at 7e7751bd43
, and apparently these
are no longer needed.
2022-03-21 00:06:30 +09:00
Hajime Hoshi
54b4e87506
internal/restorable: bug fix: ReplacePixels on a sub-image might panic on Android
...
If regions by ReplacePixel are overlapped, this can panics. This can
happen only on Android, where a context lost can happen.
Thus, a sub-image cannot call a direct ReplacePixels. internal/buffer
has to care this.
2022-03-20 18:01:37 +09:00
Hajime Hoshi
4cbce71b2b
internal/graphicscommand: move the choice of graphics drivers to internal/ui
2022-03-20 02:51:31 +09:00
Hajime Hoshi
7d0f95e9be
internal/graphicsdriver: refactoring: replace Uniform with []float32
...
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
b22309a0e5
internal/graphicsdriver: replace Pixels with ReadPixels
...
Now preparing a byte slice is the caller's responsibility.
2022-02-27 20:03:13 +09:00
Hajime Hoshi
df60c4c92d
internal/driver: rename to internal/graphicsdriver
2022-02-06 20:41:32 +09:00
Hajime Hoshi
06f4142ca0
internal/driver: Optimization: Replace interface{} with driver.Uniform
...
Converting a value from/to interface{} can create a value in heap
and this is not efficient.
2021-10-30 02:58:28 +09:00
Hajime Hoshi
dbe101a8ef
internal/restorable: Remove draw-triangles-history items explicitly
...
Updates #1803
2021-09-09 12:57:50 +09:00
Hajime Hoshi
8f857daf3e
internal/restorable: Bug fix: Forbid NewImage before the graphics driver is ready
2021-09-09 03:58:58 +09:00
Hajime Hoshi
a3570331dd
internal/restorable: Delay initializing emptyImage
...
Now NeedsRestorable can always return a correct value.
2021-09-09 03:27:22 +09:00
Hajime Hoshi
18903db1c6
internal/atlas: Bug fix: Unexpected padding in screenshots
...
Closes #1736
2021-07-29 16:09:29 +09:00
Hajime Hoshi
21aa96f9f5
internal/affine: Refactoring: Make ColorM interface
2021-07-27 12:10:22 +09:00
Hajime Hoshi
b466a0cbd7
ebiten: Add EvenOdd to DrawTrianglesOptions and DrawShaderTrianglesOptions
...
Updates #844
Closes #1684
2021-07-05 03:35:55 +09:00
Hajime Hoshi
c725937cc6
internal/graphics: Reuse the vertices backend
...
This is basically a reland of 9cb631e30f
.
This change locks the vertices backend at the end-frame phase to
protect from vertices usages by other goroutines.
Updates #1546
Closes #1681
2021-06-27 02:31:01 +09:00
Hajime Hoshi
38ce46328a
internal/atlas: Reuse byte array for ReplacePixels
...
This reduces memory allocation at ReplacePixels.
Updates #1681
2021-06-26 03:48:25 +09:00
Hajime Hoshi
26b9fa20c1
internal/graphics: Bug fix: Race condition at QuadVertices
...
QuadVertices or verticesBackend.slice reused its backend slice.
This caused a race condition. QuadVertices can be accessed from
multiple goroutines, and resetting the head and copying the data
at internal/graphicscommand might not be synced.
This change fixes this issue by basically reverting
9cb631e30f
.
Closes #1546
2021-03-20 16:32:13 +09:00
Hajime Hoshi
6b3c51921c
internal/driver: Remove Image.Sync
...
Syncing is no longer needed for Metal, and additionally, OpenGL's sync
implementation was mock.
Updates #1508
2021-02-26 23:16:28 +09:00
Hajime Hoshi
9341d21614
internal/shareable: Call DrawTriangles instead of ReplacePixels at makeShared ( #1513 )
...
When context losts never happen, reading pixels and call replace-pixels command are not needed.
Closes #1508
2021-02-26 12:56:22 +09:00
Hajime Hoshi
44bb004cb7
internal/restorable: Avoid allocating new slices for drawTrianglesHistory
2021-01-30 19:13:03 +09:00
Hajime Hoshi
ed494dbf59
restorable: Reland: Do not record pixels if restoring is not requried
...
This change also remove the restrictions of operations on
graphicscommand.Image. For example, now DrawTriangles and
ReplacePixels can be mixed on the same image.
Fixes #1022
2020-11-14 15:00:16 +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
48b46345d7
restorable: Refactoring
2020-11-04 02:03:47 +09:00
Hajime Hoshi
831c7ca6f4
restorable: Refactoring: Use the smaller empty image
2020-10-31 03:06:44 +09:00
Hajime Hoshi
fa53160e18
mipmap: Stop using negative mipmaps
...
Negative mipmaps tend to allocate extremely big images.
Instead, encourage to use images with explicit padding when enlarging
the image.
Fixes #1400
2020-10-31 02:52:40 +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
7329880f40
restorable: Make the image stale when volatile state changes
2020-08-19 21:13:05 +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
64a6b39240
Revert "restorable: Do not record pixels if restoring is not requried"
...
This reverts commit 5e1f263d6d
.
Reason: Issue #1304
2020-08-17 00:00:12 +09:00
Hajime Hoshi
5e1f263d6d
restorable: Do not record pixels if restoring is not requried
...
Fixes #1022
2020-08-16 20:07:17 +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