void ShaderCompiler::update() { PROFILE_FUNCTION(); for (int i = 0; i < m_processes.size(); ++i) { if (PlatformInterface::isProcessFinished(*m_processes[i].process)) { bool failed = PlatformInterface::getProcessExitCode(*m_processes[i].process) != 0; if (failed) { if (strstr(m_processes[i].path, "imgui") != nullptr) { Lumix::messageBox("Could not compile imgui shader"); } char buf[1024]; int read; Lumix::g_log_error.log("Editor") << m_processes[i].path; while ((read = PlatformInterface::getProcessOutput( *m_processes[i].process, buf, sizeof(buf) - 1)) > 0) { buf[read] = 0; Lumix::g_log_error.log("Editor") << buf; } } PlatformInterface::destroyProcess(*m_processes[i].process); m_processes.eraseFast(i); updateNotifications(); if (m_processes.empty() && m_changed_files.empty()) { reloadShaders(); parseDependencies(); } } } m_is_compiling = !m_processes.empty() || !m_to_compile.empty(); m_app.getAssetBrowser()->enableUpdate(!m_is_compiling); processChangedFiles(); if (m_processes.size() < 4 && !m_to_compile.empty()) { compile(m_to_compile.back().c_str()); m_to_compile.pop(); } }
ShaderCompiler::ShaderCompiler(Lumix::WorldEditor& editor, LogUI& log_ui) : m_editor(editor) , m_log_ui(log_ui) , m_dependencies(editor.getAllocator()) , m_to_reload(editor.getAllocator()) , m_processes(editor.getAllocator()) , m_changed_files(editor.getAllocator()) , m_mutex(false) { m_notifications_id = -1; m_is_compiling = false; m_watcher = FileSystemWatcher::create("shaders", m_editor.getAllocator()); m_watcher->getCallback() .bind<ShaderCompiler, &ShaderCompiler::onFileChanged>(this); parseDependencies(); makeUpToDate(); }
void SPDImplementation::parseElement(TiXmlElement *elem) { parseID (elem); parsePRFRef (elem); parseCode (elem); parseCompiler (elem); parsePrgLanguage (elem); parseHumanLanguage (elem); parseRuntime (elem); parseOperatingSystems (elem); parseProcessors (elem); parseDependencies (elem); #if 0 parsePropertyDependencies (elem); #endif parseUsesDevices (elem); }
void ShaderCompiler::update(float) { PROFILE_FUNCTION(); for (int i = 0; i < m_processes.size(); ++i) { if (Lumix::isProcessFinished(*m_processes[i].process)) { bool failed = Lumix::getProcessExitCode(*m_processes[i].process) != 0; if (failed) { if (strstr(m_processes[i].path, "imgui") != nullptr) { Lumix::messageBox("Could not compile imgui shader"); } char buf[1024]; int read; while ((read = Lumix::getProcessOutput(*m_processes[i].process, buf, sizeof(buf) - 1)) > 0) { buf[read] = 0; Lumix::g_log_error.log("shader compiler") << buf; } } Lumix::destroyProcess(*m_processes[i].process); m_processes.eraseFast(i); updateNotifications(); if (m_processes.empty() && m_changed_files.empty()) { reloadShaders(); parseDependencies(); } } } m_is_compiling = !m_processes.empty(); processChangedFiles(); }