-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for using shadergarden through standard input and piping #12
base: master
Are you sure you want to change the base?
Conversation
This branch adds functionality to shadergarden which allows it to be used through piping in scripts:
One final change would be preferred: These changes would allow the use of shadergarden as a subprocess, where one can feed the lispy configuration file with (optionally) inlined shaders to interact with it. This allows it to be used in command line scripts, or other programs, without the use of intermediary files. |
One other minor change, the omission of a directory to search for shaders should be allowed, since inline shaders are now part of the configuration language. A hefty warning should probably be issued to the user in this case, however. |
I am very new to Rust, so be sure to demand refactoring where necessary. A lot of my code is very imperative and probably not idiomatic. It is also not heavily tested. |
The use of the SIGUSR1 interrupt and its dependency on the |
Hi @jar2333, thanks for your contribution! I haven't yet reviewed the code, but this looks like a useful addition. Let's first see if @slightknack (the founder of this crate) is online these days. |
Ok, thank you! I'll be working on that last piece of functionality in the meantime, to make stdin hot reloading work like other files, and the other minor features. |
The final feature has been added, where the program can automatically detect new configs fed through stdin. A minor issue, is that it does not play nice with SIGUSR1 interrupts as currently implemented. It would take a bit more effort to make the two work together well, which is not imperative since SIGUSR1 interrupts are platform-specific anyhow. They still work well when stdin is not involved, for causing a reload in spite of file changes, which is still useful. |
READ NEXT COMMENT FOR INFORMATION ABOUT THIS PR
One last consideration: have a separate thread reading from stdin in a blocking manner. Whenever a full config is read from stdin, set a string variable, set the reload bool, and have a subprocedure in the reload procedure read said string variable to pass to the graph creation function. This is different from the current implementation which reads from stdin in the reload procedure directly. There is no way to set the reload bool when stdin is filled automatically. The current code works when manually reloading with SIGUSR1 though! This should be the last edit before this can be merged to (my fork's) master.