regl-project / regl

👑 Functional WebGL
https://regl-project.github.io/
MIT License
5.22k stars 322 forks source link

Retrieving shader errors? #642

Closed jeffawang closed 2 years ago

jeffawang commented 2 years ago

Is it possible to retrieve the shader errors for use outside of the developer console?

I want to display shader errors in my web interface for live collaborative editing. I will need the line/col position to highlight issues for user-provided code. I didn't notice an obvious way to do it in the API.

rreusser commented 2 years ago

I believe the answer is that there is not, though this issue suggests a way to monkey-patch the error reporting method to intercept them:

https://github.com/regl-project/regl/issues/533

That's not a complete answer; I can't recall whether you can monkey patch that in regl itself or whether you have to mock console.error, but maybe that's enough to point in the right direction?

jeffawang commented 2 years ago

I see, thanks!

For now I’m going to settle on my own webgl-based implementation, which just gives me line numbers.

Open to other ideas, but I’ll close the issue for now.

rreusser commented 2 years ago

FWIW if you're going to the trouble of rolling your own, you might consider using WebGL 2 now that, with the release of Safari 15, support has improved significantly. As much as think regl is great to use, it gets pretty frustrating to be stuck on GL ES 1.0. @mourner wrote some nice boilerplate here which might be a good starting point. (Edit: I see technically it uses the observable license which only permits forking within observable, but if he weren't focused on much, much, much more important things at the moment, maybe the license could be changed. 🇺🇦 Or if nothing else, it's good inspiration. )