shareable: Refactoring

This commit is contained in:
Hajime Hoshi 2020-11-06 00:48:32 +09:00
parent 61a8f2c69c
commit a3bccf5ff7

View File

@ -79,8 +79,8 @@ func makeImagesShared() error {
if err := i.makeShared(); err != nil { if err := i.makeShared(); err != nil {
return err return err
} }
delete(imagesToMakeShared, i)
} }
delete(imagesToMakeShared, i)
} }
return nil return nil
} }
@ -382,6 +382,7 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, vertices []f
continue continue
} }
if !src.isShared() && src.shareable() { if !src.isShared() && src.shareable() {
// src might already registered, but assiging it again is not harmful.
imagesToMakeShared[src] = struct{}{} imagesToMakeShared[src] = struct{}{}
} }
} }