aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandros Frantzis <alexandros.frantzis@linaro.org>2012-08-16 20:03:09 +0300
committerAlexandros Frantzis <alexandros.frantzis@linaro.org>2012-08-16 20:03:09 +0300
commitf42261bda87cde177995a819e177a7a4696e070f (patch)
tree941bae031eab298cad4c948c7599b07fb3850892
parente56e75718d1108490e11d1ba68e1a5e785ae9e4c (diff)
downloadglmark2-f42261bda87cde177995a819e177a7a4696e070f.tar.gz
MainLoop: Exclude from score calculation benchmarks whose setup failed.
-rw-r--r--src/main-loop.cpp16
-rw-r--r--src/main-loop.h7
2 files changed, 21 insertions, 2 deletions
diff --git a/src/main-loop.cpp b/src/main-loop.cpp
index 6e97a54..169c936 100644
--- a/src/main-loop.cpp
+++ b/src/main-loop.cpp
@@ -42,6 +42,7 @@ void
MainLoop::reset()
{
scene_ = 0;
+ scene_setup_status_ = SceneSetupStatusUnknown;
score_ = 0;
benchmarks_run_ = 0;
bench_iter_ = benchmarks_.begin();
@@ -83,6 +84,15 @@ MainLoop::step()
canvas_.reset();
before_scene_setup();
scene_ = &(*bench_iter_)->setup_scene();
+ if (!scene_->running()) {
+ if (!scene_->supported(false))
+ scene_setup_status_ = SceneSetupStatusUnsupported;
+ else
+ scene_setup_status_ = SceneSetupStatusFailure;
+ }
+ else {
+ scene_setup_status_ = SceneSetupStatusSuccess;
+ }
after_scene_setup();
log_scene_info();
}
@@ -102,12 +112,14 @@ MainLoop::step()
* in draw() may have changed the state.
*/
if (!scene_->running() || should_quit) {
- score_ += scene_->average_fps();
+ if (scene_setup_status_ == SceneSetupStatusSuccess) {
+ score_ += scene_->average_fps();
+ benchmarks_run_++;
+ }
log_scene_result();
(*bench_iter_)->teardown_scene();
scene_ = 0;
next_benchmark();
- benchmarks_run_++;
}
return !should_quit;
diff --git a/src/main-loop.h b/src/main-loop.h
index fbdfa57..918681e 100644
--- a/src/main-loop.h
+++ b/src/main-loop.h
@@ -84,12 +84,19 @@ public:
virtual void log_scene_result();
protected:
+ enum SceneSetupStatus {
+ SceneSetupStatusUnknown,
+ SceneSetupStatusSuccess,
+ SceneSetupStatusFailure,
+ SceneSetupStatusUnsupported
+ };
void next_benchmark();
Canvas &canvas_;
Scene *scene_;
const std::vector<Benchmark *> &benchmarks_;
unsigned int score_;
unsigned int benchmarks_run_;
+ SceneSetupStatus scene_setup_status_;
std::vector<Benchmark *>::const_iterator bench_iter_;
};