KDOC 635: NewImageOptions.Unmanaged で配置を固定する
この文書のステータス
- 作成
- 2026-09-27 貴島
- レビュー
- 2026-09-27 貴島
概要
Ebiten ゲームの VRT を並行実行すると、画像がフレーキーに数ピクセル変わってしまう問題があった。
これは共有グローバルなアトラスに複数テストが同時に画像を確保するため起こってしまうようで、自動管理させないようにすると VRT が安定した。
https://github.com/hajimehoshi/ebiten/blob/0465a0cd771a3ee1de5ea452dd40e14dc9d67d23/image.go#L1559-L1568
// NewImageOptions represents options for NewImageWithOptions.
type NewImageOptions struct {
// Unmanaged represents whether the image is unmanaged or not.
// The default (zero) value is false, which means that the image is managed.
//
// An unmanaged image is never on an internal automatic texture atlas.
// A regular image is a part of an internal texture atlas, and locating them is done automatically in Ebitengine.
// Unmanaged is useful when you want finer control over the image for performance and memory reasons.
Unmanaged bool
}
関連
抽象。
- 共有の自動管理に任せると並行実行で結果が揺れ、自動管理から外すと安定する
関連。
- 追加調査: アトラスがあまりわかってない
- 類推: KDOC 619: jestワーカーごとにDatabaseを分けるとテストを並列実行できる。共有している資源を並列の担当ごとに分けて、競合をなくす例
- 補足: KDOC 485: asepriteのコマンドラインで画像を1枚に結合し対応JSONを作れる。多数の小さな画像を1枚にまとめ、対応表で引けるようにする仕組み