mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
internal/restorable: Remove needsDisposingWhenRestoring
Now restoring from context lost doesn't work on browsers. Then, the constant needsDisposingWhenRestoring is actually always true.
This commit is contained in:
parent
dddfe73604
commit
96dc80fd08
@ -17,6 +17,4 @@
|
|||||||
|
|
||||||
package restorable
|
package restorable
|
||||||
|
|
||||||
const needsDisposingWhenRestoring = true
|
|
||||||
|
|
||||||
const canDetectContextLostExplicitly = true
|
const canDetectContextLostExplicitly = true
|
||||||
|
@ -14,11 +14,5 @@
|
|||||||
|
|
||||||
package restorable
|
package restorable
|
||||||
|
|
||||||
// needsDisposingWhenRestoring reports whether disposing resources is necessary or not when restoring.
|
|
||||||
//
|
|
||||||
// On browsers, disposing resources is not required since the objects are already managed by JavaScript GC and they
|
|
||||||
// are already invalidated. Rather, disposing them when restoring causes warnings on the console.
|
|
||||||
const needsDisposingWhenRestoring = false
|
|
||||||
|
|
||||||
// canDetectContextLostExplicitly reports whether the context lost can be detected by handlers in an explicit way.
|
// canDetectContextLostExplicitly reports whether the context lost can be detected by handlers in an explicit way.
|
||||||
const canDetectContextLostExplicitly = true
|
const canDetectContextLostExplicitly = true
|
||||||
|
@ -19,6 +19,4 @@
|
|||||||
|
|
||||||
package restorable
|
package restorable
|
||||||
|
|
||||||
const needsDisposingWhenRestoring = true
|
|
||||||
|
|
||||||
const canDetectContextLostExplicitly = false
|
const canDetectContextLostExplicitly = false
|
||||||
|
@ -201,9 +201,7 @@ func (i *images) restore() error {
|
|||||||
|
|
||||||
// Dispose all the shaders ahead of restoring. A current shader ID and a new shader ID can be duplicated.
|
// Dispose all the shaders ahead of restoring. A current shader ID and a new shader ID can be duplicated.
|
||||||
for s := range i.shaders {
|
for s := range i.shaders {
|
||||||
if needsDisposingWhenRestoring {
|
s.shader.Dispose()
|
||||||
s.shader.Dispose()
|
|
||||||
}
|
|
||||||
s.shader = nil
|
s.shader = nil
|
||||||
}
|
}
|
||||||
for s := range i.shaders {
|
for s := range i.shaders {
|
||||||
@ -213,9 +211,7 @@ func (i *images) restore() error {
|
|||||||
// Dispose all the images ahead of restoring. A current texture ID and a new texture ID can be duplicated.
|
// Dispose all the images ahead of restoring. A current texture ID and a new texture ID can be duplicated.
|
||||||
// TODO: Write a test to confirm that ID duplication never happens.
|
// TODO: Write a test to confirm that ID duplication never happens.
|
||||||
for i := range i.images {
|
for i := range i.images {
|
||||||
if needsDisposingWhenRestoring {
|
i.image.Dispose()
|
||||||
i.image.Dispose()
|
|
||||||
}
|
|
||||||
i.image = nil
|
i.image = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user