Hajime Hoshi
c59bcbdb5b
Revert "internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount"
...
This reverts commit 54e2790a06
.
Reason: test failures on browsers:
`GOOS=js GOARCH=wasm go test . -shuffle=1679547510163000000` failed
https://github.com/hajimehoshi/ebiten/actions/runs/4497182906/jobs/7912544699
2023-03-23 14:15:04 +09:00
Hajime Hoshi
54e2790a06
internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount
...
Updates #2460
2023-03-23 13:49:05 +09:00
Hajime Hoshi
3f2ac129d2
internal/graphicscommand: refactoring: remove unnecessary restrictions for indices
...
Updates #2460
2023-03-23 13:28:11 +09:00
Hajime Hoshi
61ee811579
internal/graphicsdriver: define Resetter
2023-03-22 18:35:46 +09:00
Hajime Hoshi
39aaf7fe37
ebiten: update comments
...
Updates #2601
2023-03-14 13:07:40 +09:00
Pierre Curto
4de807cc44
all: fix typos ( #2558 )
...
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Hajime Hoshi
e1992347b7
internal/graphicscommand: rename SetRenderingThread -> SetRenderThread
2022-12-30 13:51:32 +09:00
Hajime Hoshi
c321d069a8
internal/graphicscommand: remove unnecessary type parameters
2022-12-10 00:43:41 +09:00
Hajime Hoshi
0d173834a6
all: speed optimization
2022-12-03 23:09:41 +09:00
Hajime Hoshi
0a6813c17f
internal/graphics: use flatten []float32 slice instead of [][]float32
...
Closes #2479
2022-12-03 20:23:58 +09:00
Hajime Hoshi
4ff9a12930
internal/graphicscommand: refactoring
2022-11-12 22:26:28 +09:00
Hajime Hoshi
419bb4c1e9
all: use uint32 instead of float32 for uniform values
...
This is a preparation for other types of uniform values.
Updates #2305
2022-11-12 20:28:07 +09:00
Hajime Hoshi
50021ef3e4
internal/graphicscommand: use buffers for []float32 to reduce allocations
2022-11-04 21:55:44 +09:00
Hajime Hoshi
d73e8f785d
internal/graphicsdriver: render various destination regions as one command
...
Closes #2232
2022-11-04 20:49:44 +09:00
Hajime Hoshi
1839dd0b9b
internal/graphicscommand: bug fix: test failures on Linux
2022-11-04 03:55:05 +09:00
Hajime Hoshi
80e3baae9f
internal/graphicscommand: reduce allocations of float32 slices
2022-11-04 02:34:44 +09:00
Hajime Hoshi
c4e4e55d75
internal/shaderir: cache reachable uniform variables
...
Updates #2232
2022-11-04 01:28:24 +09:00
Hajime Hoshi
384dee7160
internal/graphicscommand: remove unused uniform variables
...
This improves possibility of merging graphics commands by reducing
uniform variables.
Updates #2232
2022-11-03 22:45:17 +09:00
Hajime Hoshi
a5993f09a2
internal/graphicscommand: refactoring: add preserved uniform variables at the graphicscommand package
...
This is a preparation to skip setting unnecessary uniform variables
like dstRegion.
Updates #2232
2022-10-30 22:30:52 +09:00
Hajime Hoshi
ac61126473
internal/graphicscommand: always flush buffers
...
After #2423 is fixed, buffers should be able to be flushed safely
anytime.
Updates #2391
Updates #2423
2022-10-30 10:51:41 +09:00
Hajime Hoshi
5eceabd172
Revert "internal/graphicscommand: bug fix: flush image buffers"
...
This reverts commit d6910eb9ab
.
Reason: The wasm flakiness occured again
Updates #2391
Updates #2423
2022-10-30 02:32:28 +09:00
Hajime Hoshi
d6910eb9ab
internal/graphicscommand: bug fix: flush image buffers
...
This is basically a revert for 4d5b608d0c
.
This caused a crash on Windows.
Even after this fix, the browser tests seem no longer flaky, but
I am not 100% sure.
Updates #2391
Closes #2423
2022-10-30 02:21:56 +09:00
Hajime Hoshi
b019a3723a
internal/ui: optimize GPU usages when the screen doesn't have to be updated
...
This change skips rendering when 1) the screen is not cleared every frame
(`SetScreenClearedEveryFrame(false)`) and 2) Draw doesn't draw anything
onto the screen. The GPU usages decreased on some machines (e.g. GPU usage
was 10% with an empty Ebitengine project and became 2-3 % on a Windows
machine).
Updates #2341
2022-10-28 18:51:06 +09:00
Hajime Hoshi
180e456a8e
ebiten: rename members of Blend
...
Updates #2382
2022-10-17 00:51:55 +09:00
Hajime Hoshi
2855095ac9
all: unify terms for buffers and flushing
2022-10-16 19:47:00 +09:00
Hajime Hoshi
4d5b608d0c
internal/graphicscommand: bug fix: suppress test flakiness on browsers
...
Closes #2391
2022-10-16 17:55:23 +09:00
Hajime Hoshi
27cb149475
internal/graphicscommand: bug fix: resolve unsent WritePixels commands
...
(*Image).WritePixels doens't send a command to the queue immediately
but caches commands internally. However, the package atlas assumed
that pixel data was sent to the cache every end of a frame. Then, byte
slices for pixels were corrupted.
This change fixes the issue by resolving all the images when flushing
commands.
Closes #2390
2022-10-16 15:19:25 +09:00
Hajime Hoshi
09a7d39874
internal/graphicsdriver: add Blend struct
...
This is a preparation to specify blend factors and blend operators.
Updates #2382
2022-10-16 01:08:26 +09:00
Hajime Hoshi
e42ee8c506
internal/graphicscommand: bug fix: call End even if an error causes
...
Without calling End, the graphics driver (especially Metal) state
might be stale and might cause another error.
Closes #2388
2022-10-15 15:23:04 +09:00
Hajime Hoshi
35e9f26681
internal/graphicsdriver/directx: refactoring
2022-10-15 12:16:41 +09:00
Hajime Hoshi
e796646abd
internal/graphicscommand: rename arguments
2022-10-15 03:36:25 +09:00
Hajime Hoshi
bf6a5415cf
internal/graphicscommand: bug fix: test failures on Windows
2022-10-15 02:56:40 +09:00
Hajime Hoshi
daf349ab72
internal/graphicscommand: bug fix: present at the end of the frame explicitly
...
Before this change, presenting happened when the rendering destination
was the final screen. Now this assumption is wrong as the final screen
might be used in the middle of the commands due to DrawFinalScreen.
Instead, this change adds a new argument `present` to FlushCommands to
present the screen explicitly at the end of the frame.
Closes #2386
2022-10-15 01:54:46 +09:00
Hajime Hoshi
72983d966b
all: remove unused conditions
...
Now Kage shaders are always used.
The situtation is different from when we fixed for #1355 , so we removed
the fast path for #1335 . We have to re-check the current performance.
Updates #1355
2022-10-02 23:50:48 +09:00
Hajime Hoshi
0ae2b1bc24
all: remove unnecessary conditions
...
Now a Kage shader is always used.
2022-10-02 22:30:59 +09:00
Hajime Hoshi
6fca8edc1b
internal/graphicscommand: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 22:21:11 +09:00
Hajime Hoshi
080d936d42
internal/graphics: remove unused arguments from DrawTriangles
...
Updates #2369
2022-10-02 22:13:31 +09:00
Hajime Hoshi
6fc9d9316d
internal/graphicscommand: remove unnecessary conditions
...
Now a Kage shader is always used.
2022-10-02 22:11:20 +09:00
Hajime Hoshi
95bfa95a91
internal/graphicscommand: refactoring
2022-09-14 23:13:08 +09:00
Hajime Hoshi
4824cbc755
internal/graphicscommand: bug fix: IsInvalidated was not concurrent-safe
...
This function was not called actually, so this is not a real problem.
However, this could be a potential problem for a future GLES driver (#292 ).
Updates #292
Closes #2321
2022-09-13 12:23:19 +09:00
Hajime Hoshi
35f597e682
internal/graphicsdriver: refactoring: remove FilterScreen
...
Closes #2282
2022-09-06 19:04:15 +09:00
Hajime Hoshi
63e3c4adea
Revert "internal/graphics: remove FilterScreen and use an original Kage program instead"
...
This reverts these commits
* 3259ef3daf
* 7c55065490
* 5bb70f485e
Reason: iOS crash. Probably we have to prepare a special rendering
pipeline for the final screen.
Closes #2278
2022-08-30 01:56:06 +09:00
Hajime Hoshi
b2f874a244
image/rectangle: read pixels only for necessary parts
...
Closes #2274
2022-08-27 23:23:33 +09:00
Hajime Hoshi
5bb70f485e
internal/graphics: remove FilterScreen and use an original Kage program instead
...
Updates #2046
2022-08-26 17:41:29 +09:00
Hajime Hoshi
70f5e84098
internal/graphicsdriver: rename ReplacePixels to WritePixels
...
Updates #2236
2022-08-08 03:05:04 +09:00
Hajime Hoshi
869147eda0
internal/graphicscommand: rename pixelCommand -> readPixelCommand
...
Updates #1995
2022-08-08 01:47:07 +09:00
mattn
2bacecca24
fix typos ( #2227 )
2022-08-03 22:40:39 +09:00
Hajime Hoshi
afed6a83c6
internal/graphics: change the naming convention: Num -> Count
...
This change also renames ebiten.MaxIndicesNum -> ebiten.MaxIndicesCount.
2022-07-13 02:02:44 +09:00
Hajime Hoshi
a866fe7391
internal/graphicscommand: improve debug command messages for shaders
2022-07-06 19:29:19 +09:00
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
afe1a93648
internal/graphicscommand, internal/graphicsdriver/metal: remove unused code
2022-07-03 15:23:52 +09:00
Hajime Hoshi
a9c9e18ff4
internal/graphicscommand: better strings for ColorM
2022-06-30 11:13:02 +09:00
Hajime Hoshi
6398230f84
internal/graphicscommand: add 'screen' info to (*newImageCommand).String()
2022-06-06 11:13:04 +09:00
Hajime Hoshi
31fd736ca5
internal/graphicscommand: refactoring: unify NewScreenFrameBufferImage and NewImage
2022-06-06 09:21:11 +09:00
Hajime Hoshi
6710808cd1
ebiten: compile shaders at NewShader
...
Closes #2035
2022-04-04 02:52:57 +09:00
Hajime Hoshi
02db3bad53
internal/graphicscommand: remove the dependency on a graphics driver from compileShader
...
Updates #2035
2022-04-04 02:09:08 +09:00
Hajime Hoshi
65094c61b1
internal/graphicscommand: reland: merge adjacent commands if the same shader and uniform variables are used
...
Closes #1846
2022-04-03 03:57:49 +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
651c5693c6
Revert "internal/graphicscommand: merge adjacent commands if the same shader and uniform variables are used"
...
This reverts commit 425ce27976
.
Reason: test failures
2022-04-03 00:11:15 +09:00
Hajime Hoshi
425ce27976
internal/graphicscommand: merge adjacent commands if the same shader and uniform variables are used
...
Closes #1846
2022-04-02 23:55:14 +09:00
Hajime Hoshi
351ef9fbb7
internal/atlas, internal/graphicsdriver: move the adjusting-pixel logic to atlas
...
Now pixels are adjusted even when the graphics driver doesn't have
high-precision floats, but this should not be problematic. This was
introduced at 9bff33472a
, but the
adjusting way is much different from the current way.
Updates #879
Closes #1820
2022-04-02 05:15:29 +09:00
Hajime Hoshi
34e23f5256
internal/restorable: treat texels instead of pixels
...
Updates #1820
2022-04-02 04:25:27 +09:00
Hajime Hoshi
cd57bccbfc
internal/graphicsdriver: let some functions return an error
...
This is a preparation for the DirectX driver.
Updates #1007
2022-03-21 22:23:12 +09:00
Hajime Hoshi
5e973ab419
Revert "internal/graphicscommand: clear the queue regardless of an error"
...
This reverts commit e21636fbb9
.
Reason: Simply this is no longer needed. We gave up testing when an error
occurs in a graphics command queue.
2022-03-21 21:57:59 +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
e21636fbb9
internal/graphicscommand: clear the queue regardless of an error
...
There was a potential issue that commands in the queue are never
reset when an error happens and the queue continues to send errors.
This is problematic especially for testings.
This change fixes the issue by Go's defer.
2022-03-21 20:10:03 +09:00
Hajime Hoshi
ad0e0e3e66
internal/graphicscommand: remove an unused member
2022-03-21 19:50:05 +09:00
Hajime Hoshi
5fe6791b5d
internal/graphicscommand: add a new paramter 'mask' to ReplacePixels
2022-03-21 01:11:01 +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
3e44a20b22
internal/graphicscommand: swap arguments
2022-03-20 00:09:17 +09:00
Hajime Hoshi
7c2300b352
internal/graphicscommand: reduce the usages of the graphicsDriver function
2022-03-19 23:03:34 +09:00
Hajime Hoshi
7d0f95e9be
internal/graphicsdriver: refactoring: replace Uniform with []float32
...
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
dd8900ea48
internal/graphicsdriver: refactoring: choose the graphics driver at this package
2022-02-27 23:51:19 +09:00
Hajime Hoshi
77f765d483
internal/testing: bug fix: considering the case when Y is inverted
...
Closes #2003
2022-02-27 22:14:32 +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
8b7273b74a
internal/graphicsdriver/metal: call PresentDrawable only when necessary
2022-02-22 01:37:13 +09:00
Hajime Hoshi
fcd4453e4f
ebiten: remove RunOnMainThread
...
Unfortunately, there are several issues in RunOnMainThread:
* RunOnMainThread cannot be portable: It is impossible to implement this
correctly on mobiles.
* RunOnMainThread doesn't make sense on mobiles: the rendering works on
a different thread (goroutine) on mobiles.
* RunOnMainThread can cause deadlocks very easily.
Until we find a better solution, let's remove this.
Closes #1945
2022-02-14 01:49:42 +09:00
Hajime Hoshi
ce3f83958e
internal/graphicscommand: rename RunOnMainThread -> RunOnRenderingThread
2022-02-14 00:20:49 +09:00
Hajime Hoshi
df60c4c92d
internal/driver: rename to internal/graphicsdriver
2022-02-06 20:41:32 +09:00
Changkun Ou
626c91e360
ebiten: add RunOnMainThread(func()) ( #1927 )
...
Closes #1926
2022-01-03 03:30:29 +09:00
Hajime Hoshi
f182b185d9
internal/graphicscommand: bug fix: overflow when len(vertices) > len(indices)
...
Closes #1913
2021-12-26 06:15:12 +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
b1a442f86a
internal/graphicscommand: Optimization: Pool drawTrianglesCommand objects
2021-10-29 23:41:47 +09:00
Hajime Hoshi
8063f2050c
internal/graphicscommand: Optimize flush
2021-09-23 00:03:41 +09:00
Hajime Hoshi
7675e2735b
internal/graphicscommand: Refactoring: Do not you 'int' as a variable name
2021-09-22 23:39:56 +09:00
Hajime Hoshi
5ac357959c
internal/graphicscommand: Bug fix: memory leak at q.commands
...
Apparently, the part of a slice between len and cap-1 still holds
references. Release them explicitly.
Closes #1803
2021-09-09 04:28:31 +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
60b8f82bfd
graphicscommand: Dump internal image info on the debug mode
...
Closes #1714
2021-08-05 01:16:42 +09:00
Hajime Hoshi
21aa96f9f5
internal/affine: Refactoring: Make ColorM interface
2021-07-27 12:10:22 +09:00
Hajime Hoshi
b0106e95b9
internal/restorable: Bug fix: Test failed on macOS (Metal)
2021-07-09 20:21:04 +09:00
Hajime Hoshi
6213c17abc
internal/driver: Add Graphics.Initialize
2021-07-07 13:58:42 +09:00
Hajime Hoshi
5e83f409e6
internal/graphicscommand: Add a missing colon to a command string
2021-07-07 01:54:22 +09:00
Hajime Hoshi
59fa689f22
internal/graphicscommand: Misspelling
2021-07-05 23:32:19 +09:00
Hajime Hoshi
5e1d6c06f1
internal/graphicscommand: Merge even-odd draw-triangles commands when possible
...
Closes #1685
2021-07-05 23:28:33 +09:00
Hajime Hoshi
92b3dab33c
internal/graphicscommand: Refactoring: Use type assesion instead of interface
...
This was an optimization in GopherJS era. This change removes this
to simplify the implementation.
2021-07-05 21:16:04 +09:00
Hajime Hoshi
b2d4521e22
internal/graphicscommand: Log 'even-odd' property
2021-07-05 19:35:34 +09:00
Hajime Hoshi
674802d2f5
ebiten: Bug fix: Draw commands with EvenOdd should not be merged
...
Updates #1684
2021-07-05 18:08:55 +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
e9b6237f61
internal/driver: Refactoring: Merge two Draw* functions
2021-07-01 15:55:48 +09:00
Hajime Hoshi
73bf1f36e5
internal/driver: Define InvalidImageID / InvalidShaderID
2021-07-01 13:56:42 +09:00