internal/atlas: potential bug fix: restore images before other image manipulations

From the reported stack trace, there could be a potential issue in
atlas.BeginFrame: images were manipulated before the images are restored.
Restoring images assumes that all images are not stale, but manipulating
images like putOnAtlas might cause other images stale in ReplacePixels.

Though we failed to reproduce the case, this fix should make sense.

Updates #2075
This commit is contained in:
Hajime Hoshi 2022-04-18 02:19:44 +09:00
parent f128f2e146
commit 928d82c685

View File

@ -835,12 +835,17 @@ func BeginFrame(graphicsDriver graphicsdriver.Graphics) error {
return err
}
// Restore images first before other image manipulations (#2075).
if err := restorable.RestoreIfNeeded(graphicsDriver); err != nil {
return err
}
resolveDeferred()
if err := putImagesOnAtlas(graphicsDriver); err != nil {
return err
}
return restorable.RestoreIfNeeded(graphicsDriver)
return nil
}
func DumpImages(graphicsDriver graphicsdriver.Graphics, dir string) error {