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: Cody Northrop <cnorthrop@google.com>
This commit is contained in:
Jamie Madill
2020-09-12 20:47:01 -04:00
committed by Commit Bot
parent e4e2a016a7
commit eba501c8a4
4 changed files with 17 additions and 14 deletions

View File

@@ -30,7 +30,13 @@ class CaptureReplaySample : public SampleApplication
{
public:
CaptureReplaySample(int argc, char **argv)
: SampleApplication("CaptureReplaySample", argc, argv, 3, 0)
: SampleApplication("CaptureReplaySample",
argc,
argv,
3,
0,
kReplayDrawSurfaceWidth,
kReplayDrawSurfaceHeight)
{}
bool initialize() override

View File

@@ -85,6 +85,7 @@ SampleApplication::SampleApplication(std::string name,
mWidth(width),
mHeight(height),
mRunning(false),
mFrameCount(0),
mGLWindow(nullptr),
mEGLWindow(nullptr),
mOSWindow(nullptr),
@@ -270,6 +271,14 @@ int SampleApplication::run()
mOSWindow->messageLoop();
prevTime = elapsedTime;
mFrameCount++;
if (mFrameCount % 100 == 0)
{
printf("Rate: %0.2lf frames / second\n",
static_cast<double>(mFrameCount) / mTimer.getElapsedTime());
}
}
destroy();

View File

@@ -67,6 +67,7 @@ class SampleApplication
bool mRunning;
Timer mTimer;
uint32_t mFrameCount;
GLWindowBase *mGLWindow;
EGLWindow *mEGLWindow;
OSWindow *mOSWindow;

View File

@@ -61,8 +61,6 @@ void main()
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
mTimer.start();
return true;
}
@@ -112,14 +110,6 @@ 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:
@@ -135,9 +125,6 @@ void main()
// Texture handle
GLuint mTexture;
Timer mTimer;
uint32_t mDrawCount = 0;
};
int main(int argc, char **argv)