mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/restorable: refactoring: remove lastTarget
This didn't improve performance very much. Rather, this made the code a little hard to read and could have a potential issue.
This commit is contained in:
parent
167c3435f7
commit
20f8df7fc1
@ -62,7 +62,6 @@ func AlwaysReadPixelsFromGPU() bool {
|
||||
type images struct {
|
||||
images map[*Image]struct{}
|
||||
shaders map[*Shader]struct{}
|
||||
lastTarget *Image
|
||||
contextLost atomic.Bool
|
||||
}
|
||||
|
||||
@ -157,7 +156,6 @@ func (i *images) removeShader(shader *Shader) {
|
||||
|
||||
// resolveStaleImages resolves stale images.
|
||||
func (i *images) resolveStaleImages(graphicsDriver graphicsdriver.Graphics) error {
|
||||
i.lastTarget = nil
|
||||
for img := range i.images {
|
||||
if err := img.resolveStale(graphicsDriver); err != nil {
|
||||
return err
|
||||
@ -174,10 +172,6 @@ func (i *images) makeStaleIfDependingOn(target *Image) {
|
||||
if target == nil {
|
||||
panic("restorable: target must not be nil at makeStaleIfDependingOn")
|
||||
}
|
||||
if i.lastTarget == target {
|
||||
return
|
||||
}
|
||||
i.lastTarget = target
|
||||
for img := range i.images {
|
||||
img.makeStaleIfDependingOn(target)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user