Skip to content
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

Detect changes in dependent shader source files & trigger reload #281

Open
dgtized opened this issue Feb 15, 2021 · 1 comment
Open

Detect changes in dependent shader source files & trigger reload #281

dgtized opened this issue Feb 15, 2021 · 1 comment

Comments

@dgtized
Copy link

dgtized commented Feb 15, 2021

I've been using figwheel-main to wonderful effect for experimenting with Quil sketches. It's really a pleasant experience to save a file and immediately see the corresponding update in running animation, so thank you so much for this tool.

However, I've recently started experimenting using fragment shaders by way of http://quil.info/api/rendering/shaders#load-shader and sadly the workflow isn't so happy. Changes to a shader require a save of the GLSL shader file & then restarting or reloading the sketch. From my understanding, there are a couple major impediments to using this by way of Figwheel:

  1. Changes in GLSL shader source does not participate in file-watch, so it doesn't appear possible to relay changes in a dependent source file to a particular Clojurescript reload hook.
  2. Shader's are usually loaded at script initialization at page load, so some additional logic is necessary to force a state change on the page.

There is one partial workaround, which is to save the GLSL fragment as a string inside of the Clojurescript source, but that's not so nice for editing purposes.

This is likely a niche use case, so it's unlikely that a solution to it would be baked directly into Figwheel, however it does speak to a broader issue about file dependencies other than css or clojure triggering a reload event. As example, it would be nice if changes to a referenced image, svg or I8n file triggered a reload in dependent pages.

A few simple ideas that jump to mind are:

  1. Extend the watch dirs syntax to allow watching other directories & file types
  2. Adding a handler that maps between a filename and namespaces to trigger a reload on
  3. Extend the meta syntax around ^:figwheel-hooks so it either lists specific files it depends on, or has a namespace specific should-reload that is passed all watched file updates to determine if the namespace should reload.
  4. Passing the save event + all dependencies updated to before-load & after-load to allow custom state changes based on which dependency changed.

I don't have a definite solution here, but am interested in exploring the space & implementing some solution, and wondered if anyone else had any ideas about how to resolve this.

@olymk2
Copy link

olymk2 commented Jul 7, 2021

I just hit this similar but working with text files loaded via ajax I wanted a reload to be triggered when one of the file have been touched, any reason the watchers can not be made more generic even if its by supplying a list of valid extensions or something to extend them perhaps ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants