The next milestone for the shader reloader has been reached – today I was able to change simple shader code such as fragment color output while still keeping the application running.
The file notifier now publishes messages that any subscribers can pick up. Once a shader file is updated, the shader manager unpacks the message containing the information of the modified shader. If it is already present in the shader manager, it recompiles the shader and relink the active program. I have also taken inspiration from nlguillemot‘s implementation where the shader is identified using its file extension. Instead of naming it .glsl, it can be named .vert or .frag and then we automatically interpret its type when reading from disk.
Next up is more error handling, I would love to squeeze in more detailed output in the terminal. I still have SPIR-V compiled shader code as the final destination for this prototype, but first I’m going to tackle the next big problem which is managing uniforms between shader changes. Essentially, all I’m interested in is the main shader code and not the preamble. I could generate it on the fly given what OpenGL version the user wants to use (once again inspired by nlguillemot) and add it to the shader string when reading from disk. That way, I won’t have to rely on the targeted shader version…although it should be a detail to keep in mind, some shaders are probably targeted for a specific version with good reasons. I should do more research on this topic but for now, this is going pretty alright.
Until next time, have a good one π