@Test public void testTranslationToCompute() throws Exception { final File referencesDir = Paths.get(ToolPaths.getShadersDirectory(), "samples", "320es").toFile(); final ShaderJobFileOperations fileOps = new ShaderJobFileOperations(); String[] blacklist = {"trigonometric_strip", "mergesort_mosaic"}; for (File reference : referencesDir.listFiles((dir, name) -> name.endsWith(".json") && Arrays.stream(blacklist).noneMatch(s -> name.contains(s)))) { File outputShaderJob = temporaryFolder.newFile(reference.getName()); Fragment2Compute.mainHelper(reference.getAbsolutePath(), outputShaderJob.getAbsolutePath()); assertTrue(fileOps.getUnderlyingShaderFile(outputShaderJob, ShaderKind.COMPUTE) .isFile()); assertTrue(fileOps.areShadersValid(outputShaderJob, false)); } }
public static void mainHelper(String... args) throws ArgumentParserException, InterruptedException, GlslParserException, ParseTimeoutException, IOException { final Namespace ns = parse(args); final ShaderJobFileOperations fileOps = new ShaderJobFileOperations(); final IRandom generator = new RandomWrapper(ArgsUtil.getSeedArgument(ns)); final ShaderJob transformedShaderJob = transform( fileOps.readShaderJobFile(ns.get("fragment_json")), generator); if (ns.getBoolean("vulkan")) { transformedShaderJob.makeUniformBindings(Optional.empty()); } fileOps.writeShaderJobFile(transformedShaderJob, ns.get("compute_json")); }
Fragment2Compute { public static void mainHelper(String... args) throws ArgumentParserException, InterruptedException, GlslParserException, ParseTimeoutException, IOException { final Namespace ns = parse(args); final ShaderJobFileOperations fileOps = new ShaderJobFileOperations(); final IRandom generator = new RandomWrapper(ArgsUtil.getSeedArgument(ns)); final ShaderJob transformedShaderJob = transform( fileOps.readShaderJobFile(ns.get("fragment_json")), generator); if (ns.getBoolean("vulkan")) { transformedShaderJob.makeUniformBindings(Optional.empty()); } fileOps.writeShaderJobFile(transformedShaderJob, ns.get("compute_json")); } }
Fragment2Compute { public static void mainHelper(String... args) throws ArgumentParserException, InterruptedException, GlslParserException, ParseTimeoutException, IOException { final Namespace ns = parse(args); final ShaderJobFileOperations fileOps = new ShaderJobFileOperations(); final IRandom generator = new RandomWrapper(ArgsUtil.getSeedArgument(ns)); final ShaderJob transformedShaderJob = transform( fileOps.readShaderJobFile(ns.get("fragment_json")), generator); if (ns.getBoolean("vulkan")) { transformedShaderJob.makeUniformBindings(Optional.empty()); } fileOps.writeShaderJobFile(transformedShaderJob, ns.get("compute_json")); }  }
Fragment2Compute { public static void mainHelper(String... args) throws ArgumentParserException, InterruptedException, GlslParserException, ParseTimeoutException, IOException { final Namespace ns = parse(args); final ShaderJobFileOperations fileOps = new ShaderJobFileOperations(); final IRandom generator = new RandomWrapper(ArgsUtil.getSeedArgument(ns)); final ShaderJob transformedShaderJob = transform( fileOps.readShaderJobFile(ns.get("fragment_json")), generator); if (ns.getBoolean("vulkan")) { transformedShaderJob.makeUniformBindings(Optional.empty()); } fileOps.writeShaderJobFile(transformedShaderJob, ns.get("compute_json")); }  static TypeConstructorExpr getGlobalInvocationIdCastToFloat(String dimension); static MemberLookupExpr getGlobalInvocationId(String dimension); static BinaryExpr getWorkGroupSizeTimesNumWorkGroups(String dimension); static void mainHelper(String... args); static void main(String[] args); }
Fragment2Compute { public static void mainHelper(String... args) throws ArgumentParserException, InterruptedException, GlslParserException, ParseTimeoutException, IOException { final Namespace ns = parse(args); final ShaderJobFileOperations fileOps = new ShaderJobFileOperations(); final IRandom generator = new RandomWrapper(ArgsUtil.getSeedArgument(ns)); final ShaderJob transformedShaderJob = transform( fileOps.readShaderJobFile(ns.get("fragment_json")), generator); if (ns.getBoolean("vulkan")) { transformedShaderJob.makeUniformBindings(Optional.empty()); } fileOps.writeShaderJobFile(transformedShaderJob, ns.get("compute_json")); }  static TypeConstructorExpr getGlobalInvocationIdCastToFloat(String dimension); static MemberLookupExpr getGlobalInvocationId(String dimension); static BinaryExpr getWorkGroupSizeTimesNumWorkGroups(String dimension); static void mainHelper(String... args); static void main(String[] args);  }