I tinkered with some WebGL & WASM, and for the first time, used glUniform4fv(). In my WebGL bindings, if the GL context is a WebGL2 context, then there is the option to not just pass a new javascript Float32Array every time that contains only the range I want to pass (basically a fresh array view object that gets GC'd after use), but to pass such an array plus a start index and length. The intent of the extended signature in WebGL2 is to avoid constantly creating temporary slice view objects that then have to get GC'd. Well guess what: having a Float32Array view that spans the entire WASM application's memory, and passing that to glUniform4fv() with the extended WebGL2 signature easily takes a second to execute the GL call. My application only has a few megabytes of memory. I have zero clue how something could take that long. Maybe if it had quadratic complexity on the number of bytes or something, haha. Using glUniform4f() or the WebGL1 signature where I just pass a fresh 4-length array view into the function executes instantly. Using the new convention on a short array view also is fast. But somehow, using it on a large view is super slow, even though it is supposed to just look a small slice in the array and not touch all the other entries.
Also, Brave seems to occasionally drop 1–2 successive frames, but that doesn't show up in the recorded performance statistics. Or maybe it's my Ubuntu 25 that is dropping the frames, idk. Really infuriating when you just want to deliver 60FPS. But a 1s+ stall when simply calling a GL API function topped all my expectations. Somehow, when doing this during profiler recording, it takes even longer. I managed to have one frame render in 36 seconds, whereas without recording, it takes 4 seconds. And with the old signature of the function or when using glUniform4f(), it is basically instant. I could not identify the issue further.
Running in the browser is just ridiculous, but I brought this upon myself…
