/////////////////////////////////////////////////////////////////////////// Display callback ///////////////////////////////////////////////////////////////////////////
| 329 | //! Display callback |
| 330 | //////////////////////////////////////////////////////////////////////////////// |
| 331 | void display() |
| 332 | { |
| 333 | sdkStartTimer(&timer); |
| 334 | |
| 335 | if (enable_cuda) { |
| 336 | generateCUDAImage(); |
| 337 | displayImage(tex_cudaResult); |
| 338 | } |
| 339 | |
| 340 | // NOTE: I needed to add this call so the timing is consistent. |
| 341 | // Need to investigate why |
| 342 | cudaDeviceSynchronize(); |
| 343 | sdkStopTimer(&timer); |
| 344 | |
| 345 | // flip backbuffer |
| 346 | glutSwapBuffers(); |
| 347 | |
| 348 | // If specified, Check rendering against reference, |
| 349 | if (ref_file && g_CheckRender && g_CheckRender->IsQAReadback()) { |
| 350 | static int pass = 0; |
| 351 | |
| 352 | if (pass > 0) { |
| 353 | g_CheckRender->readback(window_width, window_height); |
| 354 | char currentOutputPPM[256]; |
| 355 | sprintf(currentOutputPPM, "kilt.ppm"); |
| 356 | g_CheckRender->savePPM(currentOutputPPM, true, NULL); |
| 357 | |
| 358 | if (!g_CheckRender->PPMvsPPM(currentOutputPPM, sdkFindFilePath(ref_file, pArgv[0]), MAX_EPSILON, 0.30f)) { |
| 359 | g_TotalErrors++; |
| 360 | } |
| 361 | |
| 362 | Cleanup((g_TotalErrors == 0) ? EXIT_SUCCESS : EXIT_FAILURE); |
| 363 | } |
| 364 | |
| 365 | pass++; |
| 366 | } |
| 367 | |
| 368 | // Update fps counter, fps/title display and log |
| 369 | if (++fpsCount == fpsLimit) { |
| 370 | char cTitle[256]; |
| 371 | float fps = 1000.0f / sdkGetAverageTimerValue(&timer); |
| 372 | sprintf(cTitle, "CUDA GL Post Processing (%d x %d): %.1f fps", window_width, window_height, fps); |
| 373 | glutSetWindowTitle(cTitle); |
| 374 | // printf("%s\n", cTitle); |
| 375 | fpsCount = 0; |
| 376 | fpsLimit = (int)((fps > 1.0f) ? fps : 1.0f); |
| 377 | sdkResetTimer(&timer); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | void timerEvent(int value) |
| 382 | { |
nothing calls this directly
no test coverage detected