Updated Performance Tips (markdown)

Hajime Hoshi 2017-09-19 23:25:29 +09:00
parent d219c68a45
commit 0a33bebbba

@ -2,17 +2,16 @@
The less draw commands, the better the performance is.
One drawing function like `DrawImage` or `Fill` is usually treated as one (internal) draw command, but there is an exception. Drawing commands for one image are treated as one draw command when all the below conditions are satisfied:
One drawing function like `DrawImage` or `Fill` is usually treated as one (internal) draw command, but there is an exception. Successive drawing commands are treated as one draw command when all the below conditions are satisfied:
* All the functions are `DrawImage`
* All the render sources are same (`B` in `A.DrawImage(B, op)`) and not changed (no drawing commands for B).
* All the render targets are same (`A` in `A.DrawImage(B, op)`)
* All the render sources are same (`B` in `A.DrawImage(B, op)`)
* All the color matrices are same
* All the composite modes are same
examples/sprites is a good example to draw > 10000 sprites with one draw command.
All drawing commands for one image are needed to be successive for merging so far.
# Avoid changing render sources' pixels
Ebiten records almost all draw functions in order to restore when context lost happens. When a render source's pixel is changed after it is used as a render source, Ebiten tries a complicated calculation for restoring.