mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
graphics: Avoid ReadPixels when the image is volatile
This commit is contained in:
parent
3724815f21
commit
b901d2acb1
@ -194,6 +194,9 @@ func (i *imageImpl) ensurePixels(context *opengl.Context) error {
|
||||
if i.disposed {
|
||||
return nil
|
||||
}
|
||||
if i.volatile {
|
||||
return nil
|
||||
}
|
||||
if err := i.pixels.ReadPixelsFromVRAMIfStale(context); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -217,7 +220,7 @@ func (i *imageImpl) resetPixelsIfDependingOn(target *imageImpl, context *opengl.
|
||||
if !i.pixels.DependsOn(target.image) {
|
||||
return nil
|
||||
}
|
||||
if context == nil {
|
||||
if context == nil || i.volatile {
|
||||
// context is nil when this is not initialized yet.
|
||||
i.pixels.MakeStale()
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user