ebiten icon indicating copy to clipboard operation
ebiten copied to clipboard

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

Open hajimehoshi opened this issue 2 years ago • 8 comments

Ebitengine Version

9aedafbb1af36e3a664d83417a79b15b39ec5fe6

Operating System

  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] FreeBSD
  • [ ] OpenBSD
  • [ ] Android
  • [ ] iOS
  • [ ] Nintendo Switch
  • [ ] Xbox
  • [X] Web Browsers

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?

  • The original issue was for DirectX (#2232), but this was resolved.
  • WebGPU might improve the situation (#719)
  • Desktop OpenGL doesn't have this issue.

hajimehoshi avatar Nov 27 '22 05:11 hajimehoshi

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.

memmaker avatar Jan 07 '23 16:01 memmaker

@memmaker Which Ebitengine version did you use?

hajimehoshi avatar Feb 15 '23 05:02 hajimehoshi

Calling DrawElements many times in one frame seems the cause.

hajimehoshi avatar Feb 16 '23 12:02 hajimehoshi

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

hajimehoshi avatar Feb 16 '23 16:02 hajimehoshi

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

memmaker avatar Feb 16 '23 18:02 memmaker

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

hajimehoshi avatar Mar 14 '23 17:03 hajimehoshi

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

hajimehoshi avatar Aug 01 '23 15:08 hajimehoshi

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

hajimehoshi avatar May 24 '24 16:05 hajimehoshi