bool PersistantConfig::Save() { if(m_Filename.isEmpty()) return true; // update serialize list RemoteHostList.clear(); for(RemoteHost *host : RemoteHosts) RemoteHostList.push_back(*host); RENDERDOC_SetConfigSetting("Disassembly_FriendlyNaming", ShaderViewer_FriendlyNaming ? "1" : "0"); return Serialize(m_Filename); }
void PersistantConfig::SetConfigSetting(const rdcstr &name, const rdcstr &value) { if(name.isEmpty()) return; bool found = false; for(rdcstrpair &kv : ConfigSettings) { if(kv.first == name) { kv.second = value; found = true; break; } } if(!found) ConfigSettings.push_back(make_rdcpair(name, value)); RENDERDOC_SetConfigSetting(name.data(), value.data()); }
void PersistantConfig::SetConfigSetting(QString name, QString value) { ConfigSettings[name] = value; RENDERDOC_SetConfigSetting(name.toUtf8().data(), value.toUtf8().data()); }
bool PersistantConfig::Load(const rdcstr &filename) { bool ret = Deserialize(filename); // perform some sanitisation to make sure config is always in sensible state for(const rdcstrpair &key : ConfigSettings) { // redundantly set each setting so it is flushed to the core dll SetConfigSetting(key.first, key.second); } RENDERDOC_SetConfigSetting("Disassembly_FriendlyNaming", ShaderViewer_FriendlyNaming ? "1" : "0"); // localhost should always be available as a remote host bool foundLocalhost = false; for(RemoteHost host : RemoteHostList) { if(host.hostname.isEmpty()) continue; RemoteHosts.push_back(new RemoteHost(host)); if(host.IsLocalhost()) foundLocalhost = true; } if(!foundLocalhost) { RemoteHost *host = new RemoteHost(); host->hostname = "localhost"; RemoteHosts.insert(0, host); } bool tools[arraydim<KnownSPIRVTool>()] = {}; // see which known tools are registered for(const SPIRVDisassembler &dis : SPIRVDisassemblers) { // if it's declared if(dis.tool != KnownSPIRVTool::Unknown) tools[(size_t)dis.tool] = true; for(KnownSPIRVTool tool : values<KnownSPIRVTool>()) { if(QString(dis.executable).contains(ToolExecutable(tool))) tools[(size_t)tool] = true; } } for(KnownSPIRVTool tool : values<KnownSPIRVTool>()) { if(tool == KnownSPIRVTool::Unknown || tools[(size_t)tool]) continue; QString exe = ToolExecutable(tool); if(exe.isEmpty()) continue; // try to find the tool in PATH QString path = QStandardPaths::findExecutable(exe); if(!path.isEmpty()) { SPIRVDisassembler dis; dis.name = ToQStr(tool); // we store just the base name, so when we launch the process it will always find it in PATH, // rather than baking in the current PATH result. dis.executable = exe; dis.tool = tool; SPIRVDisassemblers.push_back(dis); continue; } // try to find it in our plugins folder QDir appDir(QApplication::applicationDirPath()); QStringList searchPaths = {appDir.absoluteFilePath(lit("plugins/spirv/"))}; #if defined(Q_OS_WIN64) searchPaths << appDir.absoluteFilePath(lit("../../plugins-win64/spirv/")); #elif defined(Q_OS_WIN64) searchPaths << appDir.absoluteFilePath(lit("../../plugins-win32/spirv/")); #elif defined(Q_OS_LINUX) searchPaths << appDir.absoluteFilePath(lit("../../plugins-linux64/spirv/")); #endif searchPaths << appDir.absoluteFilePath(lit("../../plugins/")); path = QStandardPaths::findExecutable(exe, searchPaths); if(!path.isEmpty()) { SPIRVDisassembler dis; dis.name = ToQStr(tool); dis.executable = path; dis.tool = tool; SPIRVDisassemblers.push_back(dis); continue; } } return ret; }