From patchwork Fri Dec 9 13:37:22 2011 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: 5559 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 9DF6523E18 for ; Fri, 9 Dec 2011 13:37:25 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 873CBA18079 for ; Fri, 9 Dec 2011 13:37:25 +0000 (UTC) Received: by mail-bw0-f52.google.com with SMTP id 17so4007389bke.11 for ; Fri, 09 Dec 2011 05:37:25 -0800 (PST) Received: by 10.204.152.138 with SMTP id g10mr1814693bkw.36.1323437845338; Fri, 09 Dec 2011 05:37:25 -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.129.2 with SMTP id hg2cs114093bkc; Fri, 9 Dec 2011 05:37:25 -0800 (PST) Received: by 10.152.104.47 with SMTP id gb15mr5032114lab.9.1323437843357; Fri, 09 Dec 2011 05:37:23 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id nt5si4931729lab.6.2011.12.09.05.37.23 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Dec 2011 05:37:23 -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 1RZ0de-0008I9-Md for ; Fri, 09 Dec 2011 13:37:22 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id A28CBE03C8 for ; Fri, 9 Dec 2011 13:37:22 +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: 174 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 174: Scene*: Eliminate duplication of scene update code. Message-Id: <20111209133722.17810.98091.launchpad@ackee.canonical.com> Date: Fri, 09 Dec 2011 13:37:22 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14450"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: bdc707377c9a1a3e038f0be7a7832bc809bbf298 Merge authors: Alexandros Frantzis (afrantzis) Related merge proposals: https://code.launchpad.net/~glmark2-dev/glmark2/scene-update-refactor/+merge/84925 proposed by: Alexandros Frantzis (afrantzis) review: Approve - Jesse Barker (jesse-barker) ------------------------------------------------------------ revno: 174 [merge] committer: Alexandros Frantzis branch nick: trunk timestamp: Thu 2011-12-08 15:17:19 +0200 message: Scene*: Eliminate duplication of scene update code. modified: src/scene-buffer.cpp src/scene-build.cpp src/scene-bump.cpp src/scene-desktop.cpp src/scene-effect-2d.cpp src/scene-grid.cpp src/scene-pulsar.cpp src/scene-shading.cpp src/scene-texture.cpp src/scene.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/scene-buffer.cpp' --- src/scene-buffer.cpp 2011-12-08 13:15:50 +0000 +++ src/scene-buffer.cpp 2011-12-08 13:17:19 +0000 @@ -412,19 +412,11 @@ void SceneBuffer::update() { - double current_time = Util::get_timestamp_us() / 1000000.0; - double elapsed_time = current_time - startTime_; - - lastUpdateTime_ = current_time; - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } + Scene::update(); + + double elapsed_time = lastUpdateTime_ - startTime_; priv_->wave->update(elapsed_time); - - currentFrame_++; } void === modified file 'src/scene-build.cpp' --- src/scene-build.cpp 2011-11-11 11:07:15 +0000 +++ src/scene-build.cpp 2011-12-08 11:09:09 +0000 @@ -196,20 +196,11 @@ void SceneBuild::update() { - double current_time = Util::get_timestamp_us() / 1000000.0; - double dt = current_time - lastUpdateTime_; - double elapsed_time = current_time - startTime_; - - lastUpdateTime_ = current_time; - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } - - rotation_ += rotationSpeed_ * dt; - - currentFrame_++; + Scene::update(); + + double elapsed_time = lastUpdateTime_ - startTime_; + + rotation_ = rotationSpeed_ * elapsed_time; } void === modified file 'src/scene-bump.cpp' --- src/scene-bump.cpp 2011-11-15 10:15:41 +0000 +++ src/scene-bump.cpp 2011-12-08 11:09:09 +0000 @@ -314,20 +314,11 @@ void SceneBump::update() { - double current_time = Util::get_timestamp_us() / 1000000.0; - double dt = current_time - lastUpdateTime_; - double elapsed_time = current_time - startTime_; - - lastUpdateTime_ = current_time; - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } - - rotation_ += rotationSpeed_ * dt; - - currentFrame_++; + Scene::update(); + + double elapsed_time = lastUpdateTime_ - startTime_; + + rotation_ = rotationSpeed_ * elapsed_time; } void === modified file 'src/scene-desktop.cpp' --- src/scene-desktop.cpp 2011-11-11 11:07:15 +0000 +++ src/scene-desktop.cpp 2011-12-08 11:09:09 +0000 @@ -866,9 +866,8 @@ { double current_time = Util::get_timestamp_us() / 1000000.0; double dt = current_time - lastUpdateTime_; - double elapsed_time = current_time - startTime_; - lastUpdateTime_ = current_time; + Scene::update(); std::vector& windows(priv_->windows); @@ -903,13 +902,6 @@ if (should_update) win->position(new_pos); } - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } - - currentFrame_++; } void === modified file 'src/scene-effect-2d.cpp' --- src/scene-effect-2d.cpp 2011-11-11 11:07:15 +0000 +++ src/scene-effect-2d.cpp 2011-12-08 11:09:09 +0000 @@ -368,17 +368,7 @@ void SceneEffect2D::update() { - double current_time = Util::get_timestamp_us() / 1000000.0; - double elapsed_time = current_time - startTime_; - - lastUpdateTime_ = current_time; - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } - - currentFrame_++; + Scene::update(); } void === modified file 'src/scene-grid.cpp' --- src/scene-grid.cpp 2011-11-08 21:40:36 +0000 +++ src/scene-grid.cpp 2011-12-08 11:09:09 +0000 @@ -93,20 +93,11 @@ void SceneGrid::update() { - double current_time = Util::get_timestamp_us() / 1000000.0; - double dt = current_time - lastUpdateTime_; - double elapsed_time = current_time - startTime_; - - lastUpdateTime_ = current_time; - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } - - rotation_ += rotationSpeed_ * dt; - - currentFrame_++; + Scene::update(); + + double elapsed_time = lastUpdateTime_ - startTime_; + + rotation_ = rotationSpeed_ * elapsed_time; } void === modified file 'src/scene-pulsar.cpp' --- src/scene-pulsar.cpp 2011-11-11 11:07:15 +0000 +++ src/scene-pulsar.cpp 2011-12-08 11:09:09 +0000 @@ -169,24 +169,15 @@ void ScenePulsar::update() { - double current_time = Util::get_timestamp_us() / 1000000.0; - double dt = current_time - lastUpdateTime_; - double elapsed_time = current_time - startTime_; - - lastUpdateTime_ = current_time; - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } + Scene::update(); + + double elapsed_time = lastUpdateTime_ - startTime_; for (int i = 0; i < numQuads_; i++) { - rotations_[i] += rotationSpeeds_[i] * (dt * 60); + rotations_[i] = rotationSpeeds_[i] * (elapsed_time * 60); } scale_ = vec3(cos(elapsed_time / 3.60) * 10.0, sin(elapsed_time / 3.60) * 10.0, 1.0); - - currentFrame_++; } void === modified file 'src/scene-shading.cpp' --- src/scene-shading.cpp 2011-11-11 11:07:15 +0000 +++ src/scene-shading.cpp 2011-12-08 11:09:09 +0000 @@ -265,20 +265,11 @@ void SceneShading::update() { - double current_time = Util::get_timestamp_us() / 1000000.0; - double dt = current_time - lastUpdateTime_; - double elapsed_time = current_time - startTime_; - - lastUpdateTime_ = current_time; - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } - - rotation_ += rotationSpeed_ * dt; - - currentFrame_++; + Scene::update(); + + double elapsed_time = lastUpdateTime_ - startTime_; + + rotation_ = rotationSpeed_ * elapsed_time; } void === modified file 'src/scene-texture.cpp' --- src/scene-texture.cpp 2011-11-29 14:47:05 +0000 +++ src/scene-texture.cpp 2011-12-08 11:09:09 +0000 @@ -158,20 +158,11 @@ void SceneTexture::update() { - double current_time = Util::get_timestamp_us() / 1000000.0; - double dt = current_time - lastUpdateTime_; - double elapsed_time = current_time - startTime_; - - lastUpdateTime_ = current_time; - - if (elapsed_time >= duration_) { - averageFPS_ = currentFrame_ / elapsed_time; - running_ = false; - } - - rotation_ += rotationSpeed_ * dt; - - currentFrame_++; + Scene::update(); + + double elapsed_time = lastUpdateTime_ - startTime_; + + rotation_ = rotationSpeed_ * elapsed_time; } void === modified file 'src/scene.cpp' --- src/scene.cpp 2011-11-11 11:07:15 +0000 +++ src/scene.cpp 2011-12-08 11:09:09 +0000 @@ -88,6 +88,17 @@ void Scene::update() { + double current_time = Util::get_timestamp_us() / 1000000.0; + double elapsed_time = current_time - startTime_; + + currentFrame_++; + + lastUpdateTime_ = current_time; + + if (elapsed_time >= duration_) { + averageFPS_ = currentFrame_ / elapsed_time; + running_ = false; + } } void