mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/ui: skip rendering onto the final framebuffer only for OpenGL
This was reverted at a049acd94e
but now
I've confirmed this is not problematic only with OpenGL.
Updates #2341
Updates #2342
This commit is contained in:
parent
6b4c696b31
commit
bbc82ef2db
@ -198,20 +198,21 @@ func (c *context) drawGame(graphicsDriver graphicsdriver.Graphics, forceDraw boo
|
|||||||
c.skipCount = 0
|
c.skipCount = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: If the offscreen is not updated and the framebuffers don't have to be updated, skip rendering to save GPU power
|
// TODO: Metal (and maybe DirectX) cannot vsync without swapping the buffer by rendering the screen framebuffer (#2520).
|
||||||
// (#2341, #2342). The condition would be `c.skipCount < maxSkipCount`.
|
// Implement this skipping appropriately for Metal and DirectX.
|
||||||
// However, Metal (and maybe DirectX) cannot vsync without swapping the buffer by rendering the screen framebuffer (#2520).
|
if c.skipCount < maxSkipCount && graphicsDriver.IsGL() {
|
||||||
if graphicsDriver.NeedsClearingScreen() {
|
if graphicsDriver.NeedsClearingScreen() {
|
||||||
// This clear is needed for fullscreen mode or some mobile platforms (#622).
|
// This clear is needed for fullscreen mode or some mobile platforms (#622).
|
||||||
c.screen.clear()
|
c.screen.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
c.game.DrawFinalScreen(c.screenScaleAndOffsets())
|
||||||
|
|
||||||
|
// The final screen is never used as the rendering source.
|
||||||
|
// Flush its buffer here just in case.
|
||||||
|
c.screen.flushBufferIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
c.game.DrawFinalScreen(c.screenScaleAndOffsets())
|
|
||||||
|
|
||||||
// The final screen is never used as the rendering source.
|
|
||||||
// Flush its buffer here just in case.
|
|
||||||
c.screen.flushBufferIfNeeded()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user