| 568 | } |
| 569 | |
| 570 | void run(void) |
| 571 | { |
| 572 | int clr = myRank % NC, lastFrame = 0; |
| 573 | bool seenResize = false; |
| 574 | EGLint cfgAttribs[] = { EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, |
| 575 | EGL_BLUE_SIZE, 8, EGL_NONE }, nc = 0; |
| 576 | EGLConfig config = 0; |
| 577 | EGLContext ctx = 0; |
| 578 | EGLSurface surface = 0; |
| 579 | |
| 580 | try |
| 581 | { |
| 582 | if(!eglChooseConfig(edpy, cfgAttribs, &config, 1, &nc)) |
| 583 | THROW_EGL("eglChooseConfig()"); |
| 584 | if(!(ctx = eglCreateContext(edpy, config, NULL, NULL))) |
| 585 | THROW_EGL("eglCreateContext()"); |
| 586 | if((surface = eglCreateWindowSurface(edpy, config, win, NULL)) == 0) |
| 587 | THROW_EGL("eglCreateWindowSurface()"); |
| 588 | if(!(eglMakeCurrent(edpy, surface, surface, ctx))) |
| 589 | THROW_EGL("eglMakeCurrent()"); |
| 590 | ready.signal(); |
| 591 | |
| 592 | int iter = 0; |
| 593 | while(!deadYet || !seenResize || iter < 3) |
| 594 | { |
| 595 | if(doResize) |
| 596 | { |
| 597 | glViewport(0, 0, width, height); |
| 598 | doResize = false; |
| 599 | seenResize = true; |
| 600 | } |
| 601 | glClearColor(colors[clr].r, colors[clr].g, colors[clr].b, 0.); |
| 602 | glClear(GL_COLOR_BUFFER_BIT); |
| 603 | eglSwapBuffers(edpy, surface); |
| 604 | checkReadbackState(edpy, surface, surface, ctx); |
| 605 | checkFrame(dpy, win, 1, lastFrame); |
| 606 | checkWindowColor(dpy, win, colors[clr].bits); |
| 607 | clr = (clr + 1) % NC; |
| 608 | iter++; |
| 609 | } |
| 610 | } |
| 611 | catch(...) |
| 612 | { |
| 613 | if(ctx) |
| 614 | { |
| 615 | eglMakeCurrent(edpy, 0, 0, 0); |
| 616 | eglDestroyContext(edpy, ctx); |
| 617 | } |
| 618 | if(surface) eglDestroySurface(edpy, surface); |
| 619 | throw; |
| 620 | } |
| 621 | if(ctx) |
| 622 | { |
| 623 | eglMakeCurrent(edpy, 0, 0, 0); |
| 624 | eglDestroyContext(edpy, ctx); |
| 625 | } |
| 626 | if(surface) eglDestroySurface(edpy, surface); |
| 627 | } |
nothing calls this directly
no test coverage detected