enum piglit_result piglit_display(void) { static const char *fp_source = "!!ARBfp1.0\n" "TEX result.color, fragment.texcoord[0], texture[1], 2D;\n" "END\n"; bool pass = true; GLuint tex; GLuint prog; texrect_w = piglit_width / 4 / 2; texrect_h = piglit_height / 2; glGenProgramsARB(1, &prog); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog); glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(fp_source), (const GLubyte *) fp_source); glEnable(GL_FRAGMENT_PROGRAM_ARB); glActiveTexture(GL_TEXTURE1); tex = piglit_rgbw_texture(GL_RGBA, 2, 2, false, false, GL_UNSIGNED_NORMALIZED); /* Given that the failure mode we had that led to this test * being written was that the sampler state read was * pseudo-random, go through several statechanges on the * sampler to make sure we're reliably getting our sampler * state. */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); piglit_draw_rect_tex(-1, -1, 0.5, 2, 0, 0, 1, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); piglit_draw_rect_tex(-0.5, -1, 0.5, 2, 0, 0, 1, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); piglit_draw_rect_tex(0, -1, 0.5, 2, 0, 0, 1, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); piglit_draw_rect_tex(0.5, -1, 0.5, 2, 0, 0, 1, 1); pass = pass && test_nearest(piglit_width * 0 / 4); pass = pass && test_linear(piglit_width * 1 / 4); pass = pass && test_nearest(piglit_width * 2 / 4); pass = pass && test_linear(piglit_width * 3 / 4); piglit_present_results(); glDeleteTextures(1, &tex); glDisable(GL_FRAGMENT_PROGRAM_ARB); glDeleteProgramsARB(1, &prog); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
int main(int argc, char** argv) { if (!parse_args(argc,argv)) { return 0; } plan_tests(16); Waypoints waypoints; ok(setup_waypoints(waypoints),"waypoint setup",0); unsigned size = waypoints.size(); ok(test_lookup(waypoints,3),"waypoint lookup",0); ok(!test_lookup(waypoints,5000),"waypoint bad lookup",0); ok(test_nearest(waypoints),"waypoint nearest",0); ok(test_nearest_landable(waypoints),"waypoint nearest landable",0); ok(test_location(waypoints,true),"waypoint location good",0); ok(test_location(waypoints,false),"waypoint location bad",0); ok(test_range(waypoints,100)==1,"waypoint visit range 100m",0); ok(test_radius(waypoints,100)==1,"waypoint radius 100m",0); ok(test_range(waypoints,500000)== waypoints.size(),"waypoint range 500000m",0); ok(test_radius(waypoints,25000)<= test_range(waypoints,25000),"waypoint radius<range",0); // test clear waypoints.clear(); ok(waypoints.size()==0,"waypoint clear",0); setup_waypoints(waypoints); ok(size == waypoints.size(),"waypoint setup after clear",0); ok(test_copy(waypoints),"waypoint copy",0); ok(test_erase(waypoints,3),"waypoint erase",0); ok(test_replace(waypoints,4),"waypoint replace",0); return exit_status(); }