Add support for video benchmark.
Screen repaint is not included (as it would force vsync), so it stops at the texture update. Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
a121981e5a
commit
e883e1b38c
1 changed files with 141 additions and 116 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "linux/windows/misc.h"
|
||||
#include "linux/data.h"
|
||||
#include "linux/paddle.h"
|
||||
#include "linux/benchmark.h"
|
||||
|
||||
#include "frontends/common2/configuration.h"
|
||||
#include "frontends/common2/utils.h"
|
||||
|
@ -175,7 +176,10 @@ namespace
|
|||
|
||||
int MessageBox(HWND, const char * text, const char * caption, UINT type)
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, caption, text, nullptr);
|
||||
// tabs do not render properly
|
||||
std::string s(text);
|
||||
std::replace(s.begin(), s.end(), '\t', ' ');
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, caption, s.c_str(), nullptr);
|
||||
return IDOK;
|
||||
}
|
||||
|
||||
|
@ -253,8 +257,28 @@ void run_sdl(int argc, const char * argv [])
|
|||
|
||||
const int fps = getRefreshRate();
|
||||
std::cerr << "Video refresh rate: " << fps << " Hz, " << 1000.0 / fps << " ms" << std::endl;
|
||||
|
||||
Emulator emulator(win, ren, tex, options.fixedSpeed);
|
||||
|
||||
|
||||
if (options.benchmark)
|
||||
{
|
||||
// benchmark and vsync do not work together...
|
||||
// so we only count the time to update the texture, not the video repaint
|
||||
const auto redraw = [&emulator]{
|
||||
emulator.updateTexture();
|
||||
};
|
||||
|
||||
const auto refresh = [&emulator]{
|
||||
NTSC_SetVideoMode( g_uVideoMode );
|
||||
NTSC_VideoRedrawWholeScreen();
|
||||
emulator.updateTexture();
|
||||
};
|
||||
|
||||
VideoBenchmark(redraw, refresh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Timer global;
|
||||
Timer updateTextureTimer;
|
||||
Timer refreshScreenTimer;
|
||||
|
@ -382,8 +406,9 @@ void run_sdl(int argc, const char * argv [])
|
|||
const double actualClock = g_nCumulativeCycles / timeInSeconds;
|
||||
std::cerr << "Expected clock: " << g_fCurrentCLK6502 << " Hz, " << g_nCumulativeCycles / g_fCurrentCLK6502 << " s" << std::endl;
|
||||
std::cerr << "Actual clock: " << actualClock << " Hz, " << timeInSeconds << " s" << std::endl;
|
||||
|
||||
SDirectSound::stop();
|
||||
}
|
||||
|
||||
stopEmulator();
|
||||
uninitialiseEmulator();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue