From patchwork Wed Jun 22 09:27:19 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: 2156 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 22E1623F6C for ; Wed, 22 Jun 2011 09:32:23 +0000 (UTC) Received: from mail-vw0-f52.google.com (mail-vw0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id CEA01A1890A for ; Wed, 22 Jun 2011 09:32:22 +0000 (UTC) Received: by vws16 with SMTP id 16so688956vws.11 for ; Wed, 22 Jun 2011 02:32:22 -0700 (PDT) Received: by 10.52.168.65 with SMTP id zu1mr609838vdb.207.1308735142317; Wed, 22 Jun 2011 02:32:22 -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.52.183.130 with SMTP id em2cs124946vdc; Wed, 22 Jun 2011 02:32:22 -0700 (PDT) Received: by 10.216.220.194 with SMTP id o44mr1805667wep.105.1308735140683; Wed, 22 Jun 2011 02:32:20 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id m45si952797wed.23.2011.06.22.02.32.19; Wed, 22 Jun 2011 02:32:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QZJnF-00034z-0o for ; Wed, 22 Jun 2011 09:32:17 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id B4B3A2E89EC for ; Wed, 22 Jun 2011 09:27:19 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glcompbench X-Launchpad-Branch: ~glcompbench-dev/glcompbench/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 24 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glcompbench-dev/glcompbench/trunk] Rev 24: Add support for test options. Message-Id: <20110622092719.30588.2993.launchpad@loganberry.canonical.com> Date: Wed, 22 Jun 2011 09:27:19 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13265"; Instance="initZopeless config overlay" X-Launchpad-Hash: b395e7372f1d3758da95fe31b50177a528cf6b74 ------------------------------------------------------------ revno: 24 committer: Alexandros Frantzis branch nick: trunk timestamp: Wed 2011-06-22 12:12:20 +0300 message: Add support for test options. modified: src/composite-test.cc src/composite-test.h --- lp:glcompbench https://code.launchpad.net/~glcompbench-dev/glcompbench/trunk You are subscribed to branch lp:glcompbench. To unsubscribe from this branch go to https://code.launchpad.net/~glcompbench-dev/glcompbench/trunk/+edit-subscription === modified file 'src/composite-test.cc' --- src/composite-test.cc 2011-05-03 16:41:28 +0000 +++ src/composite-test.cc 2011-06-22 09:12:20 +0000 @@ -26,6 +26,7 @@ #include "log.h" using std::string; +using std::map; const string CompositeTest::model_view_matrix_name_("modelview"); const string CompositeTest::projection_matrix_name_("projection"); @@ -219,3 +220,30 @@ { program_.stop(); } + +bool +CompositeTest::set_option(const string &opt, const string &val) +{ + map::iterator iter = options_.find(opt); + + if (iter == options_.end()) + return false; + + iter->second.value = val; + + return true; +} + +void +CompositeTest::reset_options() +{ + for (map::iterator iter = options_.begin(); + iter != options_.end(); + iter++) + { + Option &opt = iter->second; + + opt.value = opt.default_value; + } +} + === modified file 'src/composite-test.h' --- src/composite-test.h 2011-05-03 16:41:28 +0000 +++ src/composite-test.h 2011-06-22 09:12:20 +0000 @@ -26,6 +26,7 @@ #include #include +#include #include "stack.h" #include "program.h" #include "composite-window.h" @@ -44,6 +45,21 @@ virtual void cleanup(); virtual void reshape(int width, int height); const std::string& name() const { return name_; } + + struct Option { + Option(const std::string &name, const std::string &val, const std::string &desc) : + name(name), value(val), default_value(val), description(desc) {} + Option() {} + std::string name; + std::string value; + std::string default_value; + std::string description; + }; + + bool set_option(const std::string &opt, const std::string &val); + void reset_options(); + const std::map &options() { return options_; } + protected: CompositeTest(); // @@ -55,6 +71,7 @@ // int num_visible_windows(std::list &window_list); std::string name_; + std::map options_; Program program_; std::string vertex_shader_; std::string fragment_shader_;