/////////////////////////////////////////////////////////////////////////// Display callback ///////////////////////////////////////////////////////////////////////////
| 441 | //! Display callback |
| 442 | //////////////////////////////////////////////////////////////////////////////// |
| 443 | void display() |
| 444 | { |
| 445 | sdkStartTimer(&timer); |
| 446 | |
| 447 | if (enable_cuda) { |
| 448 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer); |
| 449 | #ifndef USE_TEXTURE_RGBA8UI |
| 450 | renderScene(false); |
| 451 | #else |
| 452 | renderScene(true); // output of fragment * by 255 (for RGBA8UI texture) |
| 453 | #endif |
| 454 | processImage(); |
| 455 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
| 456 | displayImage(tex_cudaResult); |
| 457 | } |
| 458 | else { |
| 459 | renderScene(false); |
| 460 | } |
| 461 | |
| 462 | // NOTE: I needed to add this call so the timing is consistent. |
| 463 | // Need to investigate why |
| 464 | cudaDeviceSynchronize(); |
| 465 | sdkStopTimer(&timer); |
| 466 | |
| 467 | // flip backbuffer |
| 468 | glutSwapBuffers(); |
| 469 | |
| 470 | // If specified, Check rendering against reference, |
| 471 | if (ref_file && g_CheckRender && g_CheckRender->IsQAReadback()) { |
| 472 | static int pass = 0; |
| 473 | |
| 474 | if (pass > 0) { |
| 475 | g_CheckRender->readback(window_width, window_height); |
| 476 | char currentOutputPPM[256]; |
| 477 | sprintf(currentOutputPPM, "teapot_%d.ppm", blur_radius); |
| 478 | g_CheckRender->savePPM(currentOutputPPM, true, NULL); |
| 479 | |
| 480 | if (!g_CheckRender->PPMvsPPM(currentOutputPPM, sdkFindFilePath(ref_file, pArgv[0]), MAX_EPSILON, 0.30f)) { |
| 481 | g_TotalErrors++; |
| 482 | } |
| 483 | |
| 484 | Cleanup((g_TotalErrors == 0) ? EXIT_SUCCESS : EXIT_FAILURE); |
| 485 | } |
| 486 | |
| 487 | pass++; |
| 488 | } |
| 489 | |
| 490 | // Update fps counter, fps/title display and log |
| 491 | if (++fpsCount == fpsLimit) { |
| 492 | char cTitle[256]; |
| 493 | float fps = 1000.0f / sdkGetAverageTimerValue(&timer); |
| 494 | sprintf(cTitle, "CUDA GL Post Processing (%d x %d): %.1f fps", window_width, window_height, fps); |
| 495 | glutSetWindowTitle(cTitle); |
| 496 | // printf("%s\n", cTitle); |
| 497 | fpsCount = 0; |
| 498 | fpsLimit = (int)((fps > 1.0f) ? fps : 1.0f); |
| 499 | sdkResetTimer(&timer); |
| 500 | } |
nothing calls this directly
no test coverage detected