regl
regl copied to clipboard
Treat programs as resources
Right now, programs are wrapped inside draw commands. Could they be exposed as resources to enable management (.deleteProgram etc) like buffers & textures? They could be passed to commands as a program: property and the current behavior could stay as is for convenience. Sorry if I've missed something obvious, the issue in my case is that I need to recompile shaders very often and if I don't manually delete the previous shaders the app crashes at some point. Thank you
Maybe a better solution would be to implement some sort of reference counting or garbage collection. I think there is a way we could make live reloading work without having to expose this machinery. Will circle back to this later once I've finally got housing sorted out.
See also: #481, though garbage collecting + reference counting is a slightly different goal.
Is it valid to instantiate a single command and treat the shader source as a dynamic prop?