mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-09-27 04:16:23 +08:00
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
This commit is contained in:
@@ -147,7 +147,7 @@ func (g *gameForUI) DrawOffscreen() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *gameForUI) DrawScreen() {
|
||||
func (g *gameForUI) DrawFinalScreen() {
|
||||
scale, offsetX, offsetY := g.ScreenScaleAndOffsets()
|
||||
var geoM GeoM
|
||||
geoM.Scale(scale, scale)
|
||||
|
Reference in New Issue
Block a user