Commit Graph

322 Commits

Author SHA1 Message Date
Hajime Hoshi
ae9781cd53 internal/graphicscommand: add comments 2023-08-01 00:18:12 +09:00
Hajime Hoshi
ce25583438 internal/atlas: refactoring: move temporaryBytes to internal/graphicscommand 2023-08-01 00:11:40 +09:00
Hajime Hoshi
f81dbd9288 internal/graphicsdriver: flush commands asynchronously whenever possible
Closes #2664
2023-07-30 22:44:13 +09:00
Hajime Hoshi
a7e4665f71 internal/graphicscommand: use multiple command queues
This is a preparation for asynchronous rendering.

Updates #2664
2023-07-30 22:42:58 +09:00
Hajime Hoshi
5a64f8299e internal/thread: refactoring: add a common interface Thread 2023-07-30 22:42:24 +09:00
Hajime Hoshi
81b7fd7641 internal/graphicscommand: refactoring 2023-07-30 18:37:18 +09:00
Hajime Hoshi
3869e2e4f6 internal/ui: refactoring: integrate the render thread usages into internal/graphicscommand
Updates #2664
2023-07-30 03:50:49 +09:00
Hajime Hoshi
246bd41695 internal/graphicscommand: fix a wrong comment 2023-07-30 01:56:58 +09:00
guangwu
54e1263565
all: unnecessary use of fmt.Sprintf (#2691)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-07-05 16:36:29 +09:00
Hajime Hoshi
ecf07ad09e internal/graphicscommand: speed optimization: reduce boundary checks
Co-authored-by: Egon Elbre <egonelbre@gmail.com>
2023-05-04 12:55:53 +09:00
Hajime Hoshi
e98acd3dc7 internal/graphicsdriver: refactoring: use image.Rectangle 2023-04-29 01:12:05 +09:00
Hajime Hoshi
56b4cdc3c4 internal/graphics: use pixels for offsets 2023-04-26 00:38:23 +09:00
Hajime Hoshi
49582519c1 all: add a compiler directive kage:unit
This change adds a new compiler directive 'kage:unit' to Kage. This
takes one of these two values: 'pixel' and 'texel'. The default value
is 'texel'.

With the pixel-unit mode, all the built-in functions treats pixels
instead of texels, and the texCoord argument of Fragment is in pixels.
This simplifies shader programs as programs no longer have the notion
of texels.

With the texel-unit mode, the behavior is the same as the current
behavior.

Closes #1431
2023-04-23 22:11:57 +09:00
Hajime Hoshi
2f55bb1b3d internal/atlas, internal/graphicscommand: refactoring 2023-04-19 21:43:08 +09:00
Hajime Hoshi
eb6a773d3f internal/graphicscommand: remove unnecessary space chars 2023-04-18 01:19:28 +09:00
Hajime Hoshi
c7ca9cb321 ebiten: omit the exceeding part of vertices at Draw* 2023-03-23 21:23:33 +09:00
Hajime Hoshi
31273c875f internal/graphics: rename constants 2023-03-23 20:48:39 +09:00
Hajime Hoshi
81581df2b9 internal/graphicscommand: reland: add graphics.MaxVertexFloatCount and use it instead of IndicesCount
This change is reland of 54e2790a06
but with a fix for WebGL. Also, this changes the logic when len(vertices)
exceeds the maximum: just remove the last part.

Updates #2460
2023-03-23 18:01:09 +09:00
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
fa4916d063 internal/ui: refactoring 2022-12-30 13:28:00 +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
Artem Yadelskyi
10415d417a
all: replace interface{} with any (#2430)
Closes #2429
2022-11-03 15:33:09 +09:00
Artem Yadelskyi
5b53cef59e
all: remove old // +build comments (#2431)
Closes #2325
2022-11-03 12:55:14 +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
b096ba700a internal/graphicscommand: bug fix: clear buffers when disposing an image
Closes #2423
2022-10-30 03:38:53 +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