Exemplo n.º 1
0
static bool
run_test(GLbitfield shaders)
{
        const struct grid_info grid = {
                shaders,
                get_image_format(GL_R32UI),
                { W, H, 1, 1 }
        };
        const struct image_info img = image_info_for_grid(grid);
        GLuint prog = generate_program(
                grid,
                GL_VERTEX_SHADER,
                generate_source(grid, img, GL_VERTEX_SHADER),
                GL_TESS_CONTROL_SHADER,
                generate_source(grid, img, GL_TESS_CONTROL_SHADER),
                GL_TESS_EVALUATION_SHADER,
                generate_source(grid, img, GL_TESS_EVALUATION_SHADER),
                GL_GEOMETRY_SHADER,
                generate_source(grid, img, GL_GEOMETRY_SHADER),
                GL_FRAGMENT_SHADER,
                generate_source(grid, img, GL_FRAGMENT_SHADER),
                GL_COMPUTE_SHADER,
                generate_source(grid, img, GL_COMPUTE_SHADER));
        bool ret = prog && init_fb(grid) &&
                init_images(img) &&
                bind_images(grid, prog) &&
                draw_grid(grid, prog) &&
                check(grid, img);

        glDeleteProgram(prog);
        return ret;
}
Exemplo n.º 2
0
bool ErlangGenerator::Generate(const FileDescriptor * file, const string & parameter, GeneratorContext* context, string * error) const
{
    typedef std::vector<std::pair<std::string,std::string> > config_vec;
    config_vec config;
    bool tests=false;
    ParseGeneratorParameter(parameter,&config);
    for(config_vec::iterator i=config.begin(); i != config.end(); ++i)
    {
        if("triq_tests" == i->first)
            tests=true;
        if("stict_naming" == i->first)
            is_strict_naming=true;
    }
    std::string name=module_name(file);
    std::stringstream out;
    out << "";
    {
        scoped_ptr<ZeroCopyOutputStream> header(context->Open("include/"+name+".hrl"));
        Printer printer(header.get(),'$');
        generate_header(printer,file);
    }

    {
        scoped_ptr<ZeroCopyOutputStream> source(context->Open("src/"+name+".erl"));
        Printer printer(source.get(),'$');
        generate_source(printer,file);
    }

    if(tests)
    {
        scoped_ptr<ZeroCopyOutputStream> source(context->Open("test/"+name+"_tests.erl"));
        Printer printer(source.get(),'$');
        generate_test(printer,file);
    }

    *error = out.str();
    return true;
}