@Test public void nestedStruct() throws Exception { final String program = "struct _GLF_struct_15 {\n" + " int _f0;\n" + " float x1;\n" + " int _f1;\n" + "};\n" + "struct _GLF_struct_16 {\n" + " _GLF_struct_15 _f0;\n" + "};\n" + "void f(float x)\n" + "{\n" + " _GLF_struct_16 _GLF_struct_replacement_17 = _GLF_struct_16(_GLF_struct_15(1, " + "x + 1.0, mat3(1.0)));\n" + "}\n"; TranslationUnit tu = ParseHelper.parse(program); assertEquals(2, RemoveStructFieldReductionOpportunities .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(false, ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator())).size()); }
static List<RemoveStructFieldReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item)) .reduce(Arrays.asList(), ListConcat::concatenate); }
RemoveStructFieldReductionOpportunities extends ScopeTrackingVisitor { static List<RemoveStructFieldReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item)) .reduce(Arrays.asList(), ListConcat::concatenate); } }
RemoveStructFieldReductionOpportunities extends ScopeTrackingVisitor { static List<RemoveStructFieldReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  RemoveStructFieldReductionOpportunities(TranslationUnit translationUnit); }
RemoveStructFieldReductionOpportunities extends ScopeTrackingVisitor { static List<RemoveStructFieldReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  RemoveStructFieldReductionOpportunities(TranslationUnit translationUnit); @Override void visitDeclarationStmt(DeclarationStmt declarationStmt); }
RemoveStructFieldReductionOpportunities extends ScopeTrackingVisitor { static List<RemoveStructFieldReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  RemoveStructFieldReductionOpportunities(TranslationUnit translationUnit); @Override void visitDeclarationStmt(DeclarationStmt declarationStmt);  }