public static ExecResult runGenerateImageOnShader(ExecHelper.RedirectType redirectType, File fragmentShader, File imageOutput, boolean skipRender) throws IOException, InterruptedException { List<String> command = new ArrayList<>(Arrays.asList( ToolPaths.getImageGlfw(), fragmentShader.toString(), "--output", imageOutput.toString())); if (skipRender) { command.add("--exit-linking"); } return new ExecHelper().exec( redirectType, null, false, command.toArray(new String[]{})); }
public static ExecResult runShaderTranslatorOnShader(ExecHelper.RedirectType redirectType, File file, String arg) throws IOException, InterruptedException { return new ExecHelper().exec( redirectType, null, false, ToolPaths.shaderTranslator(), arg, file.toString()); }
public static ExecResult runValidatorOnShader(ExecHelper.RedirectType redirectType, File file) throws IOException, InterruptedException { return new ExecHelper().exec( redirectType, null, false, ToolPaths.glslangValidator(), file.toString()); }
@Override public boolean isInteresting(File shaderJobFile, File shaderResultFileOutput) throws FileJudgeException { try { final ExecResult execResult = new ExecHelper().exec( ExecHelper.RedirectType.TO_BUFFER, directory, true, judgeScript.getAbsolutePath(), shaderJobFile.getAbsolutePath(), shaderResultFileOutput.getAbsolutePath()); LOGGER.info("Custom file judge stdout: " + execResult.stdout); LOGGER.info("Custom file judge stderr: " + execResult.stderr); LOGGER.info("Custom file judge result: " + execResult.res); return execResult.res == 0; } catch (IOException | InterruptedException exception) { throw new FileJudgeException(exception); } } }
public static ExecResult runSwiftshaderOnShader( ExecHelper.RedirectType redirectType, File fragmentShader, File imageOutput, boolean skipRender, int width, int height) throws IOException, InterruptedException { List<String> command = new ArrayList<>(Arrays.asList( ToolPaths.getImageEglSwiftshader(), fragmentShader.toString(), "--output", imageOutput.toString(), "--resolution", String.valueOf(width), String.valueOf(height))); if (skipRender) { command.add("--exit-linking"); } return new ExecHelper().exec( redirectType, null, false, command.toArray(new String[]{})); }
public static void main(String[] args) throws IOException, ParseTimeoutException, InterruptedException { final File shader = new File(args[0]); final String licenseFilename = args[1]; ExecResult execResult = new ExecHelper().exec( RedirectType.TO_BUFFER, null, false, "cpp", "-P", args[0]); ShaderJobFileOperations fileOps = new ShaderJobFileOperations(); ShaderJob shaderJob = fileOps.readShaderJobFile( new File(args[0]) ); // TODO: Reimplement obfuscator if needed. throw new RuntimeException("Obfuscator command-line tool no longer implemented."); }
@Override public CommandResult executeCommand(String name, List<String> command) throws TException { try { ExecResult res = new ExecHelper(ToolPaths.getPythonDriversDir()).exec( RedirectType.TO_BUFFER, null, true, command.toArray(new String[0]) ); return new CommandResult().setOutput(res.stdout.toString()) .setError(res.stderr.toString()) .setExitCode(res.res); } catch (Exception ex) { throw new TException(ex); } }