MCPcopy Create free account
hub / github.com/baldurk/renderdoc / RunTool

Function RunTool

qrenderdoc/Code/Interface/ShaderProcessingTool.cpp:66–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66static ShaderToolOutput RunTool(const ShaderProcessingTool &tool, QWidget *window,
67 QString input_file, QString output_file, QStringList &argList)
68{
69 bool writesToFile = true;
70 bool readStdin = false;
71
72 int idx = argList.indexOf(lit("{stdin}"));
73 if(idx >= 0)
74 {
75 argList.removeAt(idx);
76 readStdin = true;
77 }
78
79 if(output_file.isEmpty())
80 {
81 output_file = tmpPath(lit("shader_output"));
82 writesToFile = false;
83 }
84
85 // ensure we don't have any leftover output files.
86 QFile::remove(output_file);
87
88 QString stdout_file = QDir(QDir::tempPath()).absoluteFilePath(lit("shader_stdout"));
89
90 ShaderToolOutput ret;
91
92 if(tool.executable.isEmpty())
93 {
94 ret.log = QApplication::translate("ShaderProcessingTool",
95 "ERROR: No Executable specified in tool '%1'")
96 .arg(tool.name);
97
98 return ret;
99 }
100
101 QString path = tool.executable;
102
103 if(!QDir::isAbsolutePath(path))
104 {
105 path = QStandardPaths::findExecutable(path);
106
107 if(path.isEmpty())
108 {
109 ret.log = QApplication::translate("ShaderProcessingTool",
110 "ERROR: Couldn't find executable '%1' in path")
111 .arg(tool.executable);
112
113 return ret;
114 }
115 }
116
117 QByteArray stdout_data;
118 QProcess process;
119
120 QThread *mainThread = QThread::currentThread();
121
122 LambdaThread *thread = new LambdaThread([&]() {
123 if(readStdin)

Callers 2

DisassembleShaderMethod · 0.85
CompileShaderMethod · 0.85

Calls 15

tmpPathFunction · 0.85
QDirClass · 0.85
isAbsolutePathFunction · 0.85
ShowProgressDialogFunction · 0.85
QLatin1CharClass · 0.85
moveObjectToThreadMethod · 0.80
joinMethod · 0.80
removeFunction · 0.50
translateFunction · 0.50
existsFunction · 0.50
fromUtf8Function · 0.50
indexOfMethod · 0.45

Tested by

no test coverage detected