Closed mymmrac closed 1 year ago
Thanks!
I couldn't reproduce the issue on my Linux (Parallels). I'll try other machines.
Oh I think I could reproduce the issue by not pressing F3
$ go run ./examples/test/main.go
Starting...
panic: graphics: x must be positive
goroutine 11 [running]:
github.com/hajimehoshi/ebiten/v2/internal/graphics.InternalImageSize(...)
/media/psf/Home/ebiten/internal/graphics/math.go:26
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl.(*Graphics).NewImage(0xc000474b00, 0x0, 0x0)
/media/psf/Home/ebiten/internal/graphicsdriver/opengl/graphics.go:109 +0x17d
github.com/hajimehoshi/ebiten/v2/internal/graphicscommand.(*newImageCommand).Exec(0xc000561a60, {0x8558e0?, 0xc000474b00?}, 0x7f795f1c05b8?)
/media/psf/Home/ebiten/internal/graphicscommand/command.go:500 +0x84
github.com/hajimehoshi/ebiten/v2/internal/graphicscommand.(*commandQueue).flush(0xb0c520, {0x8558e0?, 0xc000474b00?}, 0x1)
/media/psf/Home/ebiten/internal/graphicscommand/command.go:240 +0x603
github.com/hajimehoshi/ebiten/v2/internal/graphicscommand.(*commandQueue).Flush.func1()
/media/psf/Home/ebiten/internal/graphicscommand/command.go:168 +0x32
github.com/hajimehoshi/ebiten/v2/internal/thread.(*OSThread).Loop.func1(0xc0000bbef8?, 0xc0000bbed0?)
/media/psf/Home/ebiten/internal/thread/thread.go:51 +0x53
github.com/hajimehoshi/ebiten/v2/internal/thread.(*OSThread).Loop(0xc000025580, {0x853250, 0xc000079900})
/media/psf/Home/ebiten/internal/thread/thread.go:52 +0x85
github.com/hajimehoshi/ebiten/v2/internal/ui.(*userInterfaceImpl).Run.func1()
/media/psf/Home/ebiten/internal/ui/run_glfw_notsinglethread.go:50 +0x5d
golang.org/x/sync/errgroup.(*Group).Go.func1()
/home/parallels/go/pkg/mod/golang.org/x/sync@v0.1.0/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
/home/parallels/go/pkg/mod/golang.org/x/sync@v0.1.0/errgroup/errgroup.go:72 +0xa5
Yep, by default debug lines are on => issue present, if you disable it with F3 => no issues
Sorry for misliading explanations
Minimized case:
package main
import (
"image/color"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/vector"
)
type Game struct {
}
func (g *Game) Update() error {
return nil
}
func (g *Game) Draw(screen *ebiten.Image) {
vector.StrokeLine(screen, 0, 0, 0, 0, 2, color.White)
}
func (g *Game) Layout(_, _ int) (int, int) {
panic("unreachable")
}
func (g *Game) LayoutF(logicalWindowWidth, logicalWindowHeight float64) (float64, float64) {
return logicalWindowWidth, logicalWindowHeight
}
func main() {
ebiten.SetWindowTitle("Ebiten Test")
if err := ebiten.RunGame(&Game{}); err != nil {
panic(err)
}
}
Hmm, this panics not because of resize, but because in vector.StrokeLine
all coords are 0, change at least one of them to non-zero value, and it will not panic
Not panics:
vector.StrokeLine(screen, 1, 0, 0, 0, 2, color.White)
Yep, did some testing, seems resizing of window is not related to this issue
Ebitengine Version
v2.5.0-alpha.13
Operating System
Go Version (
go version
)go version go1.20.1 linux/amd64
What steps will reproduce the problem?
Code: https://go.dev/play/p/iCreoo1rtqJ
If you do the same without debug (in debug I am calling
screen.Bounds()
it will not crash, at least I didn't experience that once), but with enabled debug it crashes really frequentlyStack trace
What is the expected result?
Window resizes & games does not crash
What happens instead?
Game crashes
Anything else you feel useful to add?
Similar issues in past were: #807, #832 and #1198