Commit Graph

215 Commits

Author SHA1 Message Date
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