From patchwork Thu Jan 19 11:08:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 6293 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5A9C323E07 for ; Thu, 19 Jan 2012 11:08:15 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 3E70CA18113 for ; Thu, 19 Jan 2012 11:08:15 +0000 (UTC) Received: by bkbzt4 with SMTP id zt4so4109243bkb.11 for ; Thu, 19 Jan 2012 03:08:15 -0800 (PST) Received: by 10.205.139.66 with SMTP id iv2mr10073693bkc.27.1326971294929; Thu, 19 Jan 2012 03:08:14 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs6237bkc; Thu, 19 Jan 2012 03:08:14 -0800 (PST) Received: by 10.216.131.106 with SMTP id l84mr10827744wei.29.1326971293141; Thu, 19 Jan 2012 03:08:13 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id x4si15480576weq.95.2012.01.19.03.08.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jan 2012 03:08:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Rnpqm-0000wC-Sn for ; Thu, 19 Jan 2012 11:08:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id C8B6AE01D0 for ; Thu, 19 Jan 2012 11:08:12 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 191 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 191: Main: Implement seamless transition of FPS display when changing scenes. Message-Id: <20120119110812.13346.51782.launchpad@ackee.canonical.com> Date: Thu, 19 Jan 2012 11:08:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14692"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: e52309f543955d96a78fd6db9cc94eeaf62aaca5 ------------------------------------------------------------ revno: 191 committer: Alexandros Frantzis branch nick: trunk timestamp: Thu 2012-01-19 12:58:18 +0200 message: Main: Implement seamless transition of FPS display when changing scenes. modified: src/main.cpp --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'src/main.cpp' --- src/main.cpp 2012-01-18 21:44:06 +0000 +++ src/main.cpp 2012-01-19 10:58:18 +0000 @@ -162,11 +162,20 @@ } } +static inline void +fps_renderer_update_text(TextRenderer &fps_renderer, unsigned int fps) +{ + std::stringstream ss; + ss << "FPS: " << fps; + fps_renderer.text(ss.str()); +} + void do_benchmark(Canvas &canvas, vector &benchmarks) { static const unsigned int fps_interval = 500000; unsigned score = 0; + unsigned int last_fps = 0; unsigned int benchmarks_run = 0; for (vector::iterator bench_iter = benchmarks.begin(); @@ -176,11 +185,14 @@ if (!Options::reuse_context) canvas.reset(); + TextRenderer fps_renderer(canvas); + if (Options::show_fps) + fps_renderer_update_text(fps_renderer, last_fps); + bool keep_running = true; Benchmark *bench = *bench_iter; uint64_t fps_timestamp = Util::get_timestamp_us(); Scene &scene = bench->setup_scene(); - TextRenderer fps_renderer(canvas); if (!scene.name().empty()) { Log::info("%s", scene.info_string().c_str()); @@ -197,9 +209,8 @@ if (Options::show_fps) { uint64_t now = Util::get_timestamp_us(); if (now - fps_timestamp >= fps_interval) { - std::stringstream ss; - ss << "FPS: " << scene.average_fps(); - fps_renderer.text(ss.str()); + last_fps = scene.average_fps(); + fps_renderer_update_text(fps_renderer, last_fps); fps_timestamp = now; } fps_renderer.render();