Add timer and frame counter to SimpleTexture2D.

Can be useful for perf testing.

Bug: angleproject:4729
Change-Id: I26c5fd53a34f4ed21d565e020b7c2058ff7ee6db
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2241621
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill
2020-06-11 13:35:27 -04:00
committed by Commit Bot
parent 46594c9636
commit e95e2c3c48

View File

@@ -61,6 +61,8 @@ void main()
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
mTimer.start();
return true;
}
@@ -110,6 +112,14 @@ void main()
glUniform1i(mSamplerLoc, 0);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
mDrawCount++;
if (mDrawCount % 100 == 0)
{
printf("Rate: %0.2lf iterations / second\n",
static_cast<double>(mDrawCount) / mTimer.getElapsedTime());
}
}
private:
@@ -125,6 +135,9 @@ void main()
// Texture handle
GLuint mTexture;
Timer mTimer;
uint32_t mDrawCount = 0;
};
int main(int argc, char **argv)