graphics: Bug fix: Resolve pixels before the screen is cleared

Fixes #792

Clearing the screen is so special on some environments (like macOS
Metal) that other operations on other images can be invalidated.

This fixes the issue by resolving the pixels of the offscreen that
is used as a render source for the screen before the screen is
cleared. We are not sure this is a correct way, but this actually
fixes the problem on macOS.
This commit is contained in:
Hajime Hoshi 2019-01-22 01:44:47 +09:00
parent 15b13c8b62
commit 4ce850df70

View File

@ -112,6 +112,11 @@ func (c *graphicsContext) Update(afterFrameUpdate func()) error {
afterFrameUpdate()
}
// Before clearing the screen, the offscreen's pixels must be solved.
// After clearing the screen, resolving doesn't work. This is very hacky
// but we could not find other way so far (#792).
c.offscreen.resolvePixelsToSet(true)
// This clear is needed for fullscreen mode or some mobile platforms (#622).
c.screen.Clear()