public static String getShadersDirectory() { File jarDir = getJarDirectory(); if (isRunningFromIde(jarDir)) { return Paths.get( getSourceRoot(jarDir), "shaders", "src", "main", "glsl").toString(); } return Paths.get(getInstallDirectory(), "shaders").toString(); }
public static String getImageEglSwiftshader() { return Paths.get(ToolPaths.getBinDir(), "swiftshader", "get_image_egl").toString(); }
public static String getPythonDriversDir() { return Paths.get(getPythonDir(), "drivers").toString(); }
public static String getInstallDirectory() { File jarDir = getJarDirectory(); if (isRunningFromIde(jarDir)) { return Paths.get( getSourceRoot(jarDir), "graphicsfuzz", "target", "graphicsfuzz").toString(); } return jarDir.getParentFile().toString(); }
public static String getStaticDir() { return Paths.get(ToolPaths.getInstallDirectory(), "server-static").toString(); }
final String staticDir = ToolPaths.getStaticDir(); context.addServlet( new ServletHolder(
public static ExecResult runValidatorOnShader(ExecHelper.RedirectType redirectType, File file) throws IOException, InterruptedException { return new ExecHelper().exec( redirectType, null, false, ToolPaths.glslangValidator(), file.toString()); }
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 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[]{})); }
@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); } }
public static String getPythonDir() { return Paths.get(ToolPaths.getInstallDirectory(), "python").toString(); }
final String staticDir = ToolPaths.getStaticDir(); context.addServlet( new ServletHolder(
public static String getBinDir() { String osName = System.getProperty("os.name").split(" ")[0]; File jarDir = getJarDirectory(); if (isRunningFromIde(jarDir)) { return Paths.get( getSourceRoot(jarDir), "assembly-binaries", "target", "assembly-binaries-1.0", "bin", osName).toString(); } return Paths.get(getInstallDirectory(), "bin", osName).toString(); }
final File hashFile = new File(new File(ToolPaths.getInstallDirectory()), "HASH"); final String hashContents = hashFile.isFile() ? FileUtils.readFileToString(hashFile, StandardCharsets.UTF_8) : "none";
public static String glslangValidator() { return Paths.get(getBinDir(), "glslangValidator").toString(); }
public static String shaderTranslator() { return Paths.get(getBinDir(), "shader_translator").toString(); }
public static String getImageGlfw() { return Paths.get(ToolPaths.getBinDir(), "get_image_glfw").toString(); }