mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-06 02:09:55 +03:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user