shareable: Limit the texture size to 8192

Closes #1453
This commit is contained in:
Hajime Hoshi 2020-12-31 17:52:16 +09:00
parent b6bc683991
commit c92ccfff79

View File

@ -45,6 +45,13 @@ func max(a, b int) int {
return b return b
} }
func min(a, b int) int {
if a < b {
return a
}
return b
}
func init() { func init() {
hooks.AppendHookOnBeforeUpdate(func() error { hooks.AppendHookOnBeforeUpdate(func() error {
backendsM.Lock() backendsM.Lock()
@ -686,7 +693,9 @@ func BeginFrame() error {
panic("shareable: all the images must be not-shared before the game starts") panic("shareable: all the images must be not-shared before the game starts")
} }
minSize = 1024 minSize = 1024
maxSize = max(minSize, restorable.MaxImageSize())
// The maximum size is 8192 no matter what the available sizes are (#1453).
maxSize = min(max(minSize, restorable.MaxImageSize()), 8192)
}) })
if err != nil { if err != nil {
return err return err