@Test public void testDeadStatementsPickedUp() throws Exception { final String program = "float GLF_dead8h_r;\n" + "\n" + "float GLF_dead8s_g;\n" + "\n" + "float GLF_dead8b_b;\n" + "\n" + "void GLF_dead8doConvert()\n" + "{\n" + " vec3 GLF_dead8temp;\n" + " GLF_dead8temp = GLF_dead8b_b * (1.0 - GLF_dead8s_g) + (GLF_dead8b_b - GLF_dead8b_b * " + "(1.0 - GLF_dead8s_g)) * clamp(abs(abs(6.0 * (GLF_dead8h_r - vec3(0, 1, 2) / " + "3.0)) - 3.0) - 1.0, 0.0, 1.0);\n" + " GLF_dead8h_r = GLF_dead8temp.x;\n" + " GLF_dead8s_g = GLF_dead8temp.y;\n" + " GLF_dead8b_b = GLF_dead8temp.z;\n" + "}\n" + "\n" + "void main() {\n" + "}\n"; final TranslationUnit tu = ParseHelper.parse(program); final List<StmtReductionOpportunity> ops = StmtReductionOpportunities.findOpportunities( MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(false, ShadingLanguageVersion.ESSL_300, new RandomWrapper(0), new IdGenerator())); assertEquals(4, ops.size()); }
static List<StmtReductionOpportunity> findOpportunities(ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); }
StmtReductionOpportunities extends ReductionOpportunitiesBase<StmtReductionOpportunity> { static List<StmtReductionOpportunity> findOpportunities(ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } }
StmtReductionOpportunities extends ReductionOpportunitiesBase<StmtReductionOpportunity> { static List<StmtReductionOpportunity> findOpportunities(ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  StmtReductionOpportunities(TranslationUnit tu,
        ReducerContext context); }
StmtReductionOpportunities extends ReductionOpportunitiesBase<StmtReductionOpportunity> { static List<StmtReductionOpportunity> findOpportunities(ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  StmtReductionOpportunities(TranslationUnit tu,
        ReducerContext context);  }
StmtReductionOpportunities extends ReductionOpportunitiesBase<StmtReductionOpportunity> { static List<StmtReductionOpportunity> findOpportunities(ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  StmtReductionOpportunities(TranslationUnit tu,
        ReducerContext context);   }