基本的に、2 つの三角形で構成される画面サイズの長方形と、処理全体を行うフラグメント シェーダーを使用して、ある種の画像処理を行っています。実際の効果は、 と呼ばれる一様変数に依存するため、アニメーションのようなものですcurrent_frame
。
「MPix/s」の観点からパフォーマンスを測定することに非常に興味があります。私がしていることはそのようなものです:
/* Setup all necessary stuff, including: */
/* - getting the location of the `current_frame` uniform */
/* - creating an FBO, adding a color attachment */
/* and setting it as the current one */
double current_frame = 0;
double step = 1.0f / NUMBER_OF_ITERATIONS;
tic(); /* Start counting the time */
for (i = 0; i < NUMBER_OF_ITERATIONS; i++)
{
glUniform1f(current_frame_handle, current_frame);
current_frame += step;
glDrawArrays(GL_TRIANGLES, 0, NUMBER_OF_INDICES);
glFinish();
}
double elapsed_time = tac(); /* Get elapsed time in seconds */
/* Calculate achieved pixels per second */
double pps = (OUT_WIDTH * OUT_HEIGHT * NUMBER_OF_ITERATIONS) / elapsed_time;
/* Sanity check by using reading the output into a buffer */
/* using glReadPixels and saving this buffer into a file */
理論に関する限り、私のコンセプトに何か問題がありますか?
glFinish()
また、モバイル ハードウェアでは、以前のレンダリング呼び出しを必ずしも待機する必要はなく、いくつかの最適化を行う可能性があるという印象を受けました。
もちろん、各ドローの後に強制的に実行することもできますglReadPixels()
が、それは非常に遅くなるため、あまり役に立ちません。
私のテスト シナリオが適切かどうか、さらに何かできることがあるかどうかについてアドバイスをいただけないでしょうか。