From patchwork Fri May 11 19:02:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barker X-Patchwork-Id: 8534 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 10A3D23F00 for ; Fri, 11 May 2012 19:02:13 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id AD494A185D3 for ; Fri, 11 May 2012 19:02:12 +0000 (UTC) Received: by ggnf1 with SMTP id f1so1952106ggn.11 for ; Fri, 11 May 2012 12:02:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=WbTYwtgpYnlTZPUlzabKI3/MN3juJfn2Ex2uziDMb+4=; b=HMVj6q7gdNzwTZ301J7N77bjKkJNwa8hSGnS7E4tkFvfgxPqPTKmv1tjm5NzQq4YJc 1orAsMg4bqT8FdAZxWpXHyEG2k6UvAE/pSsqF7X17nCh0sR5VImEV9imHQEXOZHJbWJh kN1OwWgKMkgKIdRTS9Ui+OTb+nH92rOcm6r4nRfUweIpX4dAu/PW6qQAp7msd8B8m3ma oifnvlvSK4MVMAuQxSvJEFfGiSiynh5rShkF8qqui0DMGEVy9D9iSpsUC33XN1o6bojN 4n4OwKCSLUJaKxoNeypelzxCXHAtx7kGjRnsE2SGwUv8Dq7aQ98kjhzcKMKys8vkjABm 4fSA== Received: by 10.50.160.225 with SMTP id xn1mr2323029igb.3.1336762932032; Fri, 11 May 2012 12:02:12 -0700 (PDT) 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.231.73.147 with SMTP id q19csp195898ibj; Fri, 11 May 2012 12:02:11 -0700 (PDT) Received: by 10.180.80.104 with SMTP id q8mr10420734wix.14.1336762930747; Fri, 11 May 2012 12:02:10 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id cf6si9078030wib.47.2012.05.11.12.02.09 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 May 2012 12:02:10 -0700 (PDT) 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 1SSv6P-0006WD-J9 for ; Fri, 11 May 2012 19:02:09 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 7F04BE0402 for ; Fri, 11 May 2012 19:02:09 +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: 207 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 207: SceneIdeas: Updates to the fly around speed options. Create a special option Message-Id: <20120511190209.1529.87303.launchpad@ackee.canonical.com> Date: Fri, 11 May 2012 19:02:09 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15225"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: cf1e8c7ff8dc8fb8894ace2d9c987240e4596c63 X-Gm-Message-State: ALoCoQk1bep+cN7BQl2VCZheEMeX/2lN5cYvVh2rd4PVQUnyB+FXy20P83A7ZWNoLzDfLQrn2hwL ------------------------------------------------------------ revno: 207 committer: Jesse Barker branch nick: trunk timestamp: Fri 2012-05-11 11:58:09 -0700 message: SceneIdeas: Updates to the fly around speed options. Create a special option value ("speed=duration") that computes the time factor as a function of the "duration" option. Make other speeds raw number values (help text explains that 1.0 is "real" or "wall clock" time, <1.0 is slower and >1.0 is faster). Update default benchmark list to reflect the use of the duration option. modified: src/default-benchmarks.h src/scene-ideas.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/default-benchmarks.h' --- src/default-benchmarks.h 2012-05-09 16:06:33 +0000 +++ src/default-benchmarks.h 2012-05-11 18:58:09 +0000 @@ -60,7 +60,7 @@ benchmarks.push_back("buffer:update-fraction=0.5:update-dispersion=0.9:columns=200:update-method=map:interleave=false"); benchmarks.push_back("buffer:update-fraction=0.5:update-dispersion=0.9:columns=200:update-method=subdata:interleave=false"); benchmarks.push_back("buffer:update-fraction=0.5:update-dispersion=0.9:columns=200:update-method=map:interleave=true"); - benchmarks.push_back("ideas:speed=max:duration=12"); + benchmarks.push_back("ideas:speed=duration"); benchmarks.push_back("conditionals:vertex-steps=0:fragment-steps=0"); benchmarks.push_back("conditionals:vertex-steps=0:fragment-steps=5"); benchmarks.push_back("conditionals:vertex-steps=5:fragment-steps=0"); === modified file 'src/scene-ideas.cpp' --- src/scene-ideas.cpp 2012-05-09 20:38:24 +0000 +++ src/scene-ideas.cpp 2012-05-11 18:58:09 +0000 @@ -36,13 +36,14 @@ using LibMatrix::vec4; using LibMatrix::uvec3; using std::string; +using std::map; class SceneIdeasPrivate { public: SceneIdeasPrivate() : valid_(false), - currentSpeed_(SPEED_MAXIMUM), + currentSpeed_(1.0), // Real time. currentTime_(START_TIME_), timeOffset_(START_TIME_) { @@ -52,14 +53,13 @@ ~SceneIdeasPrivate() { } - void initialize(const string& speed); + void initialize(map& options); void reset_time(); void update_time(); void update_projection(const mat4& proj); void draw(); private: - float speed_from_optval(const string& optval); void postIdle(); void initLights(); bool valid_; @@ -72,10 +72,6 @@ static const float CYCLE_TIME_; static const float TIME_; static const float START_TIME_; - static const float SPEED_SLOW; - static const float SPEED_MEDIUM; - static const float SPEED_FAST; - static const float SPEED_MAXIMUM; // Table Table table_; // Logo @@ -100,10 +96,6 @@ vec4 lightPositions_[3]; }; -const float SceneIdeasPrivate::SPEED_SLOW(0.2); -const float SceneIdeasPrivate::SPEED_MEDIUM(0.4); -const float SceneIdeasPrivate::SPEED_FAST(0.7); -const float SceneIdeasPrivate::SPEED_MAXIMUM(1.0); const float SceneIdeasPrivate::TIME_(15.0); const float SceneIdeasPrivate::CYCLE_TIME_(TIME_ * 1.0 - 3.0); const float SceneIdeasPrivate::START_TIME_(0.6); @@ -121,7 +113,7 @@ } void -SceneIdeasPrivate::initialize(const string& speed) +SceneIdeasPrivate::initialize(map& options) { // Initialize the positions for the lights we'll use. initLights(); @@ -148,7 +140,19 @@ reset_time(); - currentSpeed_ = speed_from_optval(speed); + // If the option string tells us the user wants the speed to be a function + // of the scene duration, do it. Otherwise, take the value explicitly. + static const string durationLabel("duration"); + static const string speedLabel("speed"); + if (options[speedLabel].value == durationLabel) + { + float duration = Util::fromString(options[durationLabel].value); + currentSpeed_ = (CYCLE_TIME_ - START_TIME_) / duration; + } + else + { + currentSpeed_ = Util::fromString(options[speedLabel].value); + } // If we're here, we're okay to run. valid_ = true; @@ -195,35 +199,11 @@ projection_ *= proj; } -float -SceneIdeasPrivate::speed_from_optval(const string& optval) -{ - float retVal(SPEED_MAXIMUM); - if (optval == "slow") - { - retVal = SPEED_SLOW; - } - else if (optval == "medium") - { - retVal = SPEED_MEDIUM; - } - else if (optval == "fast") - { - retVal = SPEED_FAST; - } - else if (optval != "max") - { - Log::error("Unknown speed option '%s', using default.\n", optval.c_str()); - } - - return retVal; -} - SceneIdeas::SceneIdeas(Canvas& canvas) : Scene(canvas, "ideas") { - options_["speed"] = Scene::Option("speed", "max", - "Rendering speed [slow, medium, fast, max]"); + options_["speed"] = Scene::Option("speed", "duration", + "Time coefficient (1.0 is \"wall clock\" speed, <1.0 is slower, >1.0 is faster). A special value of \"duration\" computes this as a function of the \"duration\" option"); } SceneIdeas::~SceneIdeas() @@ -248,7 +228,7 @@ { Scene::setup(); priv_ = new SceneIdeasPrivate(); - priv_->initialize(options_["speed"].value); + priv_->initialize(options_); priv_->update_projection(canvas_.projection()); // Core Scene state