MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ hot_reload_shader()

bool MayaFlux::Buffers::ShaderProcessor::hot_reload_shader ( )

Hot-reload shader from ShaderFoundry.

Returns
True if reload succeeded

Invalidates cached shader and rebuilds pipeline. Existing descriptor sets are preserved if compatible.

Definition at line 168 of file ShaderProcessor.cpp.

169{
171 "Hot-reloading shader: {}", m_config.shader_path);
172
173 auto& foundry = Portal::Graphics::get_shader_foundry();
174 auto new_shader_id = foundry.reload_shader(m_config.shader_path);
175
176 if (new_shader_id == Portal::Graphics::INVALID_SHADER) {
178 "Hot-reload failed for shader: {}", m_config.shader_path);
179 return false;
180 }
181
183 foundry.destroy_shader(m_shader_id);
184 }
185
186 m_shader_id = new_shader_id;
189
191 "Shader hot-reloaded successfully (ID: {})", m_shader_id);
192 return true;
193}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
Portal::Graphics::ShaderID m_shader_id
virtual void on_shader_loaded(Portal::Graphics::ShaderID shader_id)
Called after shader is loaded.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
constexpr ShaderID INVALID_SHADER
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
std::string shader_path
Path to shader file.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, m_config, MF_INFO, and MayaFlux::Buffers::ShaderProcessorConfig::shader_path.