regl-project / regl

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

Stable codegen + caching the generated code. #638

Open yujin-wu opened 2 years ago

yujin-wu commented 2 years ago

Issue

While working on CSP compliance for plotly, we had the challenge of avoiding codegen in regl. We found that some changes in Regl were necessary to make this possible, in particular making generated code stable.

The changes we needed are in https://github.com/regl-project/regl/pull/637 and I believe they are beneficial to regl:

  1. Make generated code for the same shader identical
    • across runs in any app and construction order
    • across all devices
  2. Cache for the generated code, which is practical now that a lot of generated code will be identical. The PR text has more details.

PR

https://github.com/regl-project/regl/pull/637

yujin-wu commented 2 years ago

@rreusser (+@alexcjohnson)

Hey Ricky, would you be able to have a look please? 🙂