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

FlxHotReloadShader? #402

Open
Geokureli opened this issue Aug 17, 2023 · 3 comments
Open

FlxHotReloadShader? #402

Geokureli opened this issue Aug 17, 2023 · 3 comments

Comments

@Geokureli
Copy link
Member

Now that #399 was added, how hard would it be tie a shader to its original .frag asset, and check for changes to create a new shader instance and update utilizing sprites?

This would only exist on debug

@Sword352
Copy link
Contributor

Sword352 commented Aug 21, 2023

That would be a kinda hard task to do. I am not a pro at how shaders works in OpenFL, but that would require to reload and recompile the shader program frequently.
I'd recommend just letting the developers doing their own way on reloading shaders, by having 2 variables that should be set to both fragment/vertex source file path, and a reload function that reloads and recompile the shader program.

@Geokureli
Copy link
Member Author

Geokureli commented Aug 21, 2023

That would be a kinda hard task to do. I am not a pro at how shaders works in OpenFL, but that would require to reload and recompile the shader program frequently.

the bulk of that work is done due to FlxRuntimeShader, also:

  1. the frequency to me is not an issue, it's whenever you save the .frag file, not everytime you type into whatever editor you're using
  2. My intended purpose for this is debugging, where any performance issues of switching shaders constantly is traded off for the convenience of rapid prototyping.

I do think there's plenty of ways to approach this, I plan on making my own, and if it seems generic and useful enough than its worth considering adding it to flixel-addons. otherwise it can be listed in External Tools

@UncertainProd
Copy link
Contributor

Lime has a FileWatcher class (https://github.com/openfl/lime/blob/develop/src/lime/system/FileWatcher.hx), which could be of use for this

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

No branches or pull requests

3 participants