瀏覽代碼

progs/demos: report pixel rate in million pixels / sec

tags/mesa_7_7
Brian Paul 15 年之前
父節點
當前提交
79e74cda73
共有 1 個檔案被更改,包括 5 行新增4 行删除
  1. 5
    4
      progs/demos/readpix.c

+ 5
- 4
progs/demos/readpix.c 查看文件

@@ -219,7 +219,7 @@ Display( void )
GLint reads = 0;
GLint endTime;
GLint startTime = glutGet(GLUT_ELAPSED_TIME);
GLdouble seconds, pixelsPerSecond;
GLdouble seconds, mpixels, mpixelsPerSecond;
printf("Benchmarking...\n");
do {
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
@@ -228,9 +228,10 @@ Display( void )
endTime = glutGet(GLUT_ELAPSED_TIME);
} while (endTime - startTime < 4000); /* 4 seconds */
seconds = (double) (endTime - startTime) / 1000.0;
pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds;
printf("Result: %d reads in %f seconds = %f pixels/sec\n",
reads, seconds, pixelsPerSecond);
mpixels = reads * (ImgWidth * ImgHeight / (1000.0 * 1000.0));
mpixelsPerSecond = mpixels / seconds;
printf("Result: %d reads in %f seconds = %f Mpixels/sec\n",
reads, seconds, mpixelsPerSecond);
Benchmark = GL_FALSE;
}
else {

Loading…
取消
儲存