Last modified: 2025-03-12 09:09:33
< 2025-03-10 2025-03-12 >Trying it out on the laptop. It isn't working, just saying "WebGL context was lost" in the console.
Stuff on http://webglsamples.org/ is mostly not working properly either, although not saying "WebGL context was lost", and working a little bit instead of just drawing a white square.
This is Firefox 130. What if I update? Update to 136, still no good. glxgears
works fine.
Maybe the shader is just too big for this GPU? Yes, that seems to be it. If I make the document smaller so it only draws a sphere, then it works.
So at minimum I would want to detect this problem and tell the user?
And it gets noticeably laggy on this laptop, so this is a good opportunity to work on performance.
only redraw the frame when interacted with, except keep redrawing at higher quality levels if not interacting
I'm not sure we actually have a way to measure GPU time. You are meant to use "disjoint timer query" but that is apparently not available on my laptop.
Maybe we just use fps and target 50 fps? If it is more than 55 fps we can bump up the quality, if it is less than 45 we can bump it down.
In a way, MSAA and resolution scaling are the same thing. Let's just make those into one thing?
OK, it took a while but I have it adjusting the render resolution to control frame rate at 45 fps. It sometimes flickers white when changing the resolution, what do I do about that? Also it doesn't draw any frames while you are looking at a different tab, which makes it think it is rendering super slowly.
I made it copy the canvas contents to a new canvas object, and that seems to fix it, but I don't understand why because I don't see where it ever draws it to the screen? Seems fine for now though, onwards.
So instead of redrawing every time we get the chance, we want to only redraw if any of:
Actually I think we can keep calling requestAnimationFrame()
, but just do nothing if nothing has changed.
This breaks the adaptive quality thing. Annoying. Meh, forget it for now, let's work on actual features instead.
< 2025-03-10 2025-03-12 >