Commit eba501c8 by Jamie Madill Committed by Commit Bot

Samples: Move frame counter to common location.

Bug: angleproject:5040 Change-Id: I64f762b4eb5734f0768054a330a36e20ff9ba93e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2408713 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent e4e2a016
...@@ -30,7 +30,13 @@ class CaptureReplaySample : public SampleApplication ...@@ -30,7 +30,13 @@ class CaptureReplaySample : public SampleApplication
{ {
public: public:
CaptureReplaySample(int argc, char **argv) CaptureReplaySample(int argc, char **argv)
: SampleApplication("CaptureReplaySample", argc, argv, 3, 0) : SampleApplication("CaptureReplaySample",
argc,
argv,
3,
0,
kReplayDrawSurfaceWidth,
kReplayDrawSurfaceHeight)
{} {}
bool initialize() override bool initialize() override
......
...@@ -85,6 +85,7 @@ SampleApplication::SampleApplication(std::string name, ...@@ -85,6 +85,7 @@ SampleApplication::SampleApplication(std::string name,
mWidth(width), mWidth(width),
mHeight(height), mHeight(height),
mRunning(false), mRunning(false),
mFrameCount(0),
mGLWindow(nullptr), mGLWindow(nullptr),
mEGLWindow(nullptr), mEGLWindow(nullptr),
mOSWindow(nullptr), mOSWindow(nullptr),
...@@ -270,6 +271,14 @@ int SampleApplication::run() ...@@ -270,6 +271,14 @@ int SampleApplication::run()
mOSWindow->messageLoop(); mOSWindow->messageLoop();
prevTime = elapsedTime; prevTime = elapsedTime;
mFrameCount++;
if (mFrameCount % 100 == 0)
{
printf("Rate: %0.2lf frames / second\n",
static_cast<double>(mFrameCount) / mTimer.getElapsedTime());
}
} }
destroy(); destroy();
......
...@@ -67,6 +67,7 @@ class SampleApplication ...@@ -67,6 +67,7 @@ class SampleApplication
bool mRunning; bool mRunning;
Timer mTimer; Timer mTimer;
uint32_t mFrameCount;
GLWindowBase *mGLWindow; GLWindowBase *mGLWindow;
EGLWindow *mEGLWindow; EGLWindow *mEGLWindow;
OSWindow *mOSWindow; OSWindow *mOSWindow;
......
...@@ -61,8 +61,6 @@ void main() ...@@ -61,8 +61,6 @@ void main()
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
mTimer.start();
return true; return true;
} }
...@@ -112,14 +110,6 @@ void main() ...@@ -112,14 +110,6 @@ void main()
glUniform1i(mSamplerLoc, 0); glUniform1i(mSamplerLoc, 0);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices); 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: private:
...@@ -135,9 +125,6 @@ void main() ...@@ -135,9 +125,6 @@ void main()
// Texture handle // Texture handle
GLuint mTexture; GLuint mTexture;
Timer mTimer;
uint32_t mDrawCount = 0;
}; };
int main(int argc, char **argv) int main(int argc, char **argv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment