hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
10.39k stars 633 forks source link

examples/subimage: SubImage as a destination should work more efficiently on browsers #2471

Open hajimehoshi opened 1 year ago

hajimehoshi commented 1 year ago

Ebitengine Version

9aedafbb1af36e3a664d83417a79b15b39ec5fe6

Operating System

Go Version (go version)

go version go1.19.2 darwin/amd64

What steps will reproduce the problem?

examples/subimage doesn't work efficiently on browsers. On MacBook Pro 2020 Chrome, the FPS was less than 10.

What is the expected result?

60 FPS.

What happens instead?

Less than 10 FPS.

Anything else you feel useful to add?

memmaker commented 1 year ago

I experienced similar behavior, namely major slow-downs on Mac OS when adding

screen.SubImage(image.Rect(xPos, yPos, x+tilewidth, y+tileheight)).(*ebiten.Image).Fill(c.buffer[x][y].Background)

To a tight update loop for drawing cells.

hajimehoshi commented 1 year ago

@memmaker Which Ebitengine version did you use?

hajimehoshi commented 1 year ago

Calling DrawElements many times in one frame seems the cause.

hajimehoshi commented 1 year ago

I failed to find an easy solution for this issue with WebGL.

memmaker commented 1 year ago

I think this was back on 2.4.16. I am not a 100% sure though.

hajimehoshi commented 1 year ago

Interestingly this works very well in Firefox, but not in Chrome. Safari is between Chrome and Firefox.

hajimehoshi commented 11 months ago

I don't think there is an action item on this. I'll remove the milestone.

hajimehoshi commented 1 month ago

Hmm, this might be a sign to introduce WebGPU (#719) 🤔