Commit Graph

45 Commits

Author SHA1 Message Date
Hajime Hoshi
b466a0cbd7 ebiten: Add EvenOdd to DrawTrianglesOptions and DrawShaderTrianglesOptions
Updates #844
Closes #1684
2021-07-05 03:35:55 +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
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
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
e7d080ca4a mipmap: Bug fix: Too big scale tried to allocate too big images
Fixes #1399
2020-10-21 11:28:05 +09:00
Hajime Hoshi
a3cb78558b mipmap: Bug fix: Scale could be Inf/0 and caused a forever loop
Fixes #1398
2020-10-21 10:55:36 +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
41564533f9 ebiten: Allow SubImage at DrawRectShader 2020-09-20 04:48:10 +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
a67fd4a2b3 mipmap: Bug fix: Adopt 32 for tooBigScale
I found the case that 64 was not enough on Huawei ALE-L02.
2020-08-15 15:39:27 +09:00
Hajime Hoshi
62fbac2290 mipmap: Bug fix: HasHighPrecisionFloat cannot be called before the main loop
Instead, use the common number for the too-big scale.

Fixes #1270
2020-07-29 12:46:09 +09:00
Hajime Hoshi
da98e67345 mipmap: Bug fix: Wrong level calculation when the indices are empty
Fixes #1269
2020-07-28 14:02:51 +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
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
52773e1d12 mipmap: Bug fix: Crash at DrawTrianglesWithShader 2020-07-16 23:02:33 +09:00
Hajime Hoshi
c4c9771b78 mipmap: Bug fix: Infinite loop at (*Mipmap).mipmapLevelFromDistance 2020-07-16 03:00:10 +09:00
Hajime Hoshi
bf56492d2d mipmap: Bug fix: mipmapLevelFromDistance must be called from the source 2020-07-16 02:43:08 +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
275dd438fa mipmap: Refactoring: Do not use mipmap when the image is volatile 2020-07-16 01:19:57 +09:00
Hajime Hoshi
04b26adf3d mipmap: Refactoring 2020-07-16 00:52:41 +09:00
Hajime Hoshi
38d3811f13 Revert "mipmap: Bug fix: Wrong maximum size of the negative-level mipmap image"
This reverts commit 48b192dbe9.
2020-07-16 00:51:38 +09:00
Hajime Hoshi
48b192dbe9 mipmap: Bug fix: Wrong maximum size of the negative-level mipmap image 2020-07-15 22:59:27 +09:00
Hajime Hoshi
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
f8956941b7 mipmap: Do not allocate independent mipmaps for each sub-image
Fixes #1247
2020-07-15 02:23:45 +09:00
Hajime Hoshi
2a9fd5ef13 mipmap: Avoid using the vertex backend when GopherJS is not used
The backend logic is especially for GopherJS. As the backend logic
tends to consume a lot of memory, let's avoid this when possible.

Updates #797
2020-07-14 12:16:37 +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
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
2f843c49a6 shader: Fix the case when the source image is nil for shaders 2020-06-04 01:35:35 +09:00
Hajime Hoshi
f92253487f buffered: Add Shader 2020-05-30 03:36:28 +09:00
Hajime Hoshi
218b6fc172 mipmap: Add Shader 2020-05-29 04:12:41 +09:00
Hajime Hoshi
9c637c65be shareable: Add Shader 2020-05-29 00:15:42 +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
c36d4678a3 mipmap: Bug fix: DrawTriangles with a scale-only color matrix should be optimized
Fixes #1101
2020-03-17 02:48:29 +09:00
corfe83
b3c567de89
Fix another ~300 allocations per frame in my test project (#1089)
This simple change brings my simple test project from 752 allocations per frame to 474 allocations per frame. It seems a shame that go's escape analysis is not smart enough to leave this variable on the stack.

GeoM is a 24-byte struct and there is a slight perf difference that we are storing it in stack, but also copying it around with this change (instead of an 8-byte pointer). This could make things faster (due to stack / CPU cache) or slower (due to copying more memory) - when I try a stress test (drawing 100K images per frame), I can't see any actual performance difference (but I do see 100K fewer allocations, and GC is no longer running almost all the time).
2020-02-22 13:40:17 +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
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
2cbd5aa16e mipmap: Remove unused members 2020-01-08 02:32:28 +09:00
Hajime Hoshi
4c8137ccf5 mipmap: Bug fix: Use more negative mipmaps when float precision is low
Fixes #1044
2020-01-08 02:06:36 +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