diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 246: Scene*: Add ::supported() and change ::setup() to return bool.

Message ID 20120816172514.18745.18680.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org Aug. 16, 2012, 5:25 p.m. UTC
Merge authors:
  Alexandros Frantzis (afrantzis)
------------------------------------------------------------
revno: 246 [merge]
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: trunk
timestamp: Thu 2012-08-16 19:01:59 +0300
message:
  Scene*: Add ::supported() and change ::setup() to return bool.
modified:
  src/scene-buffer.cpp
  src/scene-build.cpp
  src/scene-bump.cpp
  src/scene-conditionals.cpp
  src/scene-default-options.cpp
  src/scene-desktop.cpp
  src/scene-effect-2d.cpp
  src/scene-function.cpp
  src/scene-grid.cpp
  src/scene-ideas.cpp
  src/scene-jellyfish.cpp
  src/scene-jellyfish.h
  src/scene-loop.cpp
  src/scene-pulsar.cpp
  src/scene-shading.cpp
  src/scene-terrain.cpp
  src/scene-texture.cpp
  src/scene.cpp
  src/scene.h


--
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
diff mbox

Patch

=== modified file 'src/scene-buffer.cpp'
--- src/scene-buffer.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-buffer.cpp	2012-08-15 09:45:06 +0000
@@ -327,6 +327,22 @@ 
 }
 
 bool
+SceneBuffer::supported(bool show_errors)
+{
+    if (options_["update-method"].value != "subdata" &&
+        (GLExtensions::MapBuffer == 0 || GLExtensions::UnmapBuffer == 0))
+    {
+        if (show_errors) {
+            Log::error("Requested MapBuffer VBO update method but GL_OES_mapbuffer"
+                       " is not supported!\n");
+        }
+        return false;
+    }
+
+    return true;
+}
+
+bool
 SceneBuffer::load()
 {
     running_ = false;
@@ -339,14 +355,14 @@ 
 {
 }
 
-void
+bool
 SceneBuffer::setup()
 {
     using LibMatrix::vec3;
 
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
-    bool should_run = true;
     bool interleave = (options_["interleave"].value == "true");
     Mesh::VBOUpdateMethod update_method;
     Mesh::VBOUsage usage;
@@ -374,13 +390,6 @@ 
     nlength = Util::fromString<size_t>(options_["columns"].value);
     nwidth = Util::fromString<size_t>(options_["rows"].value);
 
-    if (update_method == Mesh::VBOUpdateMethodMap &&
-        (GLExtensions::MapBuffer == 0 || GLExtensions::UnmapBuffer == 0))
-    {
-        Log::error("Requested MapBuffer VBO update method but GL_OES_mapbuffer"
-                   " is not supported!\n");
-        should_run = false;
-    }
 
     priv_->wave = new WaveMesh(5.0, 2.0, nlength, nwidth,
                                update_fraction * (1.0 - update_dispersion + 0.0001),
@@ -397,9 +406,11 @@ 
     glDisable(GL_CULL_FACE);
 
     currentFrame_ = 0;
-    running_ = should_run;
+    running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-build.cpp'
--- src/scene-build.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-build.cpp	2012-08-15 09:45:06 +0000
@@ -80,12 +80,13 @@ 
     mesh_.reset();
 }
 
-void
+bool
 SceneBuild::setup()
 {
     using LibMatrix::vec3;
 
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     /* Set up shaders */
     static const std::string vtx_shader_filename(GLMARK_DATA_PATH"/shaders/light-basic.vert");
@@ -102,7 +103,7 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     Model model;
@@ -110,7 +111,7 @@ 
     bool modelLoaded = model.load(whichModel);
 
     if(!modelLoaded)
-        return;
+        return false;
 
     // Now that we're successfully loaded, there are a few quirks about
     // some of the known models that we need to account for.  The draw
@@ -187,6 +188,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-bump.cpp'
--- src/scene-bump.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-bump.cpp	2012-08-15 09:45:06 +0000
@@ -58,7 +58,7 @@ 
 {
 }
 
-void
+bool
 SceneBump::setup_model_plain(const std::string &type)
 {
     static const std::string vtx_shader_filename(GLMARK_DATA_PATH"/shaders/bump-poly.vert");
@@ -78,7 +78,7 @@ 
                                 high_poly_filename : low_poly_filename;
 
     if(!model.load(poly_filename))
-        return;
+        return false;
 
     model.calculate_normals();
 
@@ -100,16 +100,18 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     std::vector<GLint> attrib_locations;
     attrib_locations.push_back(program_["position"].location());
     attrib_locations.push_back(program_["normal"].location());
     mesh_.set_attrib_locations(attrib_locations);
+
+    return true;
 }
 
-void
+bool
 SceneBump::setup_model_normals()
 {
     static const std::string vtx_shader_filename(GLMARK_DATA_PATH"/shaders/bump-normals.vert");
@@ -118,7 +120,7 @@ 
     Model model;
 
     if(!model.load("asteroid-low"))
-        return;
+        return false;
 
     /* Calculate the half vector */
     LibMatrix::vec3 halfVector(lightPosition.x(), lightPosition.y(), lightPosition.z());
@@ -147,7 +149,7 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     std::vector<GLint> attrib_locations;
@@ -155,11 +157,16 @@ 
     attrib_locations.push_back(program_["texcoord"].location());
     mesh_.set_attrib_locations(attrib_locations);
 
-    Texture::load("asteroid-normal-map", &texture_,
-                  GL_NEAREST, GL_NEAREST, 0);
+    if (!Texture::load("asteroid-normal-map", &texture_,
+                       GL_NEAREST, GL_NEAREST, 0))
+    {
+        return false;
+    }
+
+    return true;
 }
 
-void
+bool
 SceneBump::setup_model_normals_tangent()
 {
     static const std::string vtx_shader_filename(GLMARK_DATA_PATH"/shaders/bump-normals-tangent.vert");
@@ -168,7 +175,7 @@ 
     Model model;
 
     if(!model.load("asteroid-low"))
-        return;
+        return false;
 
     model.calculate_normals();
 
@@ -197,7 +204,7 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     std::vector<GLint> attrib_locations;
@@ -207,11 +214,16 @@ 
     attrib_locations.push_back(program_["tangent"].location());
     mesh_.set_attrib_locations(attrib_locations);
 
-    Texture::load("asteroid-normal-map-tangent", &texture_,
-                  GL_NEAREST, GL_NEAREST, 0);
+    if (!Texture::load("asteroid-normal-map-tangent", &texture_,
+                       GL_NEAREST, GL_NEAREST, 0))
+    {
+        return false;
+    }
+
+    return true;
 }
 
-void
+bool
 SceneBump::setup_model_height()
 {
     static const std::string vtx_shader_filename(GLMARK_DATA_PATH"/shaders/bump-height.vert");
@@ -220,7 +232,7 @@ 
     Model model;
 
     if(!model.load("asteroid-low"))
-        return;
+        return false;
 
     model.calculate_normals();
 
@@ -251,7 +263,7 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     std::vector<GLint> attrib_locations;
@@ -261,27 +273,38 @@ 
     attrib_locations.push_back(program_["tangent"].location());
     mesh_.set_attrib_locations(attrib_locations);
 
-    Texture::load("asteroid-height-map", &texture_,
-                  GL_NEAREST, GL_NEAREST, 0);
+    if (!Texture::load("asteroid-height-map", &texture_,
+                       GL_NEAREST, GL_NEAREST, 0))
+    {
+        return false;
+    }
+
+    return true;
 }
 
-void
+bool
 SceneBump::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     const std::string &bump_render = options_["bump-render"].value;
     Texture::find_textures();
     Model::find_models();
+
+    bool setup_succeeded = false;
+
     if (bump_render == "normals")
-        setup_model_normals();
+        setup_succeeded = setup_model_normals();
     else if (bump_render == "normals-tangent")
-        setup_model_normals_tangent();
+        setup_succeeded = setup_model_normals_tangent();
     else if (bump_render == "height")
-        setup_model_height();
+        setup_succeeded = setup_model_height();
     else if (bump_render == "off" || bump_render == "high-poly")
-        setup_model_plain(bump_render);
+        setup_succeeded = setup_model_plain(bump_render);
 
+    if (!setup_succeeded)
+        return false;
 
     mesh_.build_vbo();
 
@@ -296,6 +319,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-conditionals.cpp'
--- src/scene-conditionals.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-conditionals.cpp	2012-08-15 09:45:06 +0000
@@ -89,10 +89,11 @@ 
     return source.str();
 }
 
-void
+bool
 SceneConditionals::setup()
 {
-    SceneGrid::setup();
+    if (!SceneGrid::setup())
+        return false;
 
     /* Parse options */
     bool vtx_conditionals = options_["vertex-conditionals"].value == "true";
@@ -104,7 +105,7 @@ 
     std::string frg_shader(get_fragment_shader_source(frg_steps, frg_conditionals));
 
     if (!Scene::load_shaders_from_strings(program_, vtx_shader, frg_shader))
-        return;
+        return false;
 
     program_.start();
 
@@ -115,6 +116,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 Scene::ValidationResult

=== modified file 'src/scene-default-options.cpp'
--- src/scene-default-options.cpp	2012-07-17 09:29:41 +0000
+++ src/scene-default-options.cpp	2012-08-15 09:45:06 +0000
@@ -23,7 +23,7 @@ 
 #include "benchmark.h"
 #include "log.h"
 
-void
+bool
 SceneDefaultOptions::setup()
 {
     const std::map<std::string, Scene *> &scenes = Benchmark::scenes();
@@ -50,6 +50,8 @@ 
             }
         }
     }
+
+    return true;
 }
 
 bool

=== modified file 'src/scene-desktop.cpp'
--- src/scene-desktop.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-desktop.cpp	2012-08-15 09:45:06 +0000
@@ -792,10 +792,11 @@ 
 {
 }
 
-void
+bool
 SceneDesktop::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     /* Parse the options */
     unsigned int windows(0);
@@ -868,6 +869,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-effect-2d.cpp'
--- src/scene-effect-2d.cpp	2012-08-13 10:09:08 +0000
+++ src/scene-effect-2d.cpp	2012-08-15 09:45:06 +0000
@@ -295,10 +295,11 @@ 
     glDeleteTextures(1, &texture_);
 }
 
-void
+bool
 SceneEffect2D::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     Texture::find_textures();
 
@@ -312,7 +313,7 @@ 
     if (!parse_matrix(options_["kernel"].value, kernel,
                       kernel_width, kernel_height))
     {
-        return;
+        return false;
     }
 
     /* Normalize the kernel matrix if needed */
@@ -330,12 +331,12 @@ 
                                                          kernel_height));
 
     if (frg_source.str().empty())
-        return;
+        return false;
 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     std::vector<int> vertex_format;
@@ -358,6 +359,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-function.cpp'
--- src/scene-function.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-function.cpp	2012-08-15 09:45:06 +0000
@@ -116,10 +116,11 @@ 
     return source.str();
 }
 
-void
+bool
 SceneFunction::setup()
 {
-    SceneGrid::setup();
+    if (!SceneGrid::setup())
+        return false;
 
     /* Parse options */
     bool vtx_function = options_["vertex-function"].value == "true";
@@ -136,7 +137,7 @@ 
                                                       frg_complexity));
 
     if (!Scene::load_shaders_from_strings(program_, vtx_shader, frg_shader))
-        return;
+        return false;
 
     program_.start();
 
@@ -147,6 +148,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 Scene::ValidationResult

=== modified file 'src/scene-grid.cpp'
--- src/scene-grid.cpp	2011-12-08 11:09:09 +0000
+++ src/scene-grid.cpp	2012-08-15 09:45:06 +0000
@@ -53,10 +53,11 @@ 
 {
 }
 
-void
+bool
 SceneGrid::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     int grid_size(Util::fromString<int>(options_["grid-size"].value));
     double grid_length(Util::fromString<double>(options_["grid-length"].value));
@@ -78,6 +79,8 @@ 
 
     currentFrame_ = 0;
     rotation_ = 0.0f;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-ideas.cpp'
--- src/scene-ideas.cpp	2012-07-04 10:07:42 +0000
+++ src/scene-ideas.cpp	2012-08-15 09:45:06 +0000
@@ -58,6 +58,7 @@ 
     void update_time();
     void update_projection(const mat4& proj);
     void draw();
+    bool valid() { return valid_; }
 
 private:
     void postIdle();
@@ -223,12 +224,17 @@ 
 {
 }
 
-void
+bool
 SceneIdeas::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
+
     priv_ = new SceneIdeasPrivate();
     priv_->initialize(options_);
+    if (!priv_->valid())
+        return false;
+
     priv_->update_projection(canvas_.projection());
 
     // Core Scene state
@@ -236,6 +242,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-jellyfish.cpp'
--- src/scene-jellyfish.cpp	2012-07-26 16:07:43 +0000
+++ src/scene-jellyfish.cpp	2012-08-16 15:55:56 +0000
@@ -54,20 +54,24 @@ 
 {
 }
 
-void
+bool
 SceneJellyfish::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     // Set up our private object that does all of the lifting
     priv_ = new JellyfishPrivate();
-    priv_->initialize();
+    if (!priv_->initialize())
+        return false;
 
     // Set core scene timing after actual initialization so we don't measure
     // set up time.
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
     running_ = true;
+
+    return true;
 }
 
 void
@@ -107,7 +111,7 @@ 
 using std::string;
 using std::vector;
 
-void
+bool
 GradientRenderer::init()
 {
     // Program set up
@@ -118,7 +122,7 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
         frg_source.str()))
     {
-        return;
+        return false;
     }
     positionLocation_ = program_["position"].location();
     uvLocation_ = program_["uvIn"].location();
@@ -144,6 +148,8 @@ 
     glBufferSubData(GL_ARRAY_BUFFER, uvOffset_, uvs_.size() * sizeof(vec2),
                     &uvs_.front());
     glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+    return true;
 }
 
 void
@@ -355,10 +361,24 @@ 
     blendFuncSrc_(0),
     blendFuncDst_(0)
 {
+}
+
+JellyfishPrivate::~JellyfishPrivate()
+{
+    positions_.clear();
+    normals_.clear();
+    colors_.clear();
+    texcoords_.clear();
+    indices_.clear();
+}
+
+bool
+JellyfishPrivate::initialize()
+{
     static const string modelFilename(GLMARK_DATA_PATH"/models/jellyfish.jobj");
     if (!load_obj(modelFilename))
     {
-        return;
+        return false;
     }
 
     // Now that we've setup the vertex data, we can setup the map of how
@@ -376,26 +396,16 @@ 
     dataMap_.texcoordOffset = dataMap_.colorOffset + dataMap_.colorSize;
     dataMap_.texcoordSize = texcoords_.size() * sv3;
     dataMap_.totalSize += dataMap_.texcoordSize;
-}
-
-JellyfishPrivate::~JellyfishPrivate()
-{
-    positions_.clear();
-    normals_.clear();
-    colors_.clear();
-    texcoords_.clear();
-    indices_.clear();
-}
-
-void
-JellyfishPrivate::initialize()
-{
+
     lastUpdateTime_ = Util::get_timestamp_us() / 1000.0;
     currentTime_ = static_cast<uint64_t>(lastUpdateTime_) % 100000000 / 1000.0;
     whichCaustic_ = static_cast<uint64_t>(currentTime_ * 30) % 32 + 1;
     rotation_ = 0.0;
 
-    gradient_.init();
+    if (!gradient_.init())
+    {
+        return false;
+    }
 
     // Set up program first so we can store attribute and uniform locations
     // away for the 
@@ -409,7 +419,7 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
         frg_source.str()))
     {
-        return;
+        return false;
     }
 
     // Stash away attribute and uniform locations for handy use.
@@ -452,6 +462,7 @@ 
     if (!gotTex || textureObjects_[0] == 0)
     {
         Log::error("Jellyfish texture set up failed!!!\n");
+        return false;
     }
     glBindTexture(GL_TEXTURE_2D, 0);
     // Then, the caustics textures
@@ -467,6 +478,7 @@ 
         if (!gotTex || textureObjects_[i] == 0)
         {
             Log::error("Caustics texture[%u] set up failed!!!\n", i);
+            return false;
         }
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
@@ -484,6 +496,8 @@ 
     glEnable(GL_BLEND);
     glDisable(GL_CULL_FACE);
     glDisable(GL_DEPTH_TEST);
+
+    return true;
 }
 
 void

=== modified file 'src/scene-jellyfish.h'
--- src/scene-jellyfish.h	2012-07-26 16:07:43 +0000
+++ src/scene-jellyfish.h	2012-08-16 15:55:56 +0000
@@ -48,7 +48,7 @@ 
         vertices_.clear();
         uvs_.clear();
     }
-    void init();
+    bool init();
     void cleanup();
     void draw();
 };
@@ -114,7 +114,7 @@ 
 public:
     JellyfishPrivate();
     ~JellyfishPrivate();
-    void initialize();
+    bool initialize();
     void update_viewport(const LibMatrix::vec2& viewport);
     void update_time();
     void cleanup();

=== modified file 'src/scene-loop.cpp'
--- src/scene-loop.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-loop.cpp	2012-08-15 09:45:06 +0000
@@ -110,10 +110,11 @@ 
 }
 
 
-void
+bool
 SceneLoop::setup()
 {
-    SceneGrid::setup();
+    if (!SceneGrid::setup())
+        return false;
 
     /* Parse options */
     bool vtx_loop = options_["vertex-loop"].value == "true";
@@ -130,7 +131,7 @@ 
                                                       frg_uniform));
 
     if (!Scene::load_shaders_from_strings(program_, vtx_shader, frg_shader))
-        return;
+        return false;
 
     program_.start();
 
@@ -144,6 +145,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 Scene::ValidationResult

=== modified file 'src/scene-pulsar.cpp'
--- src/scene-pulsar.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-pulsar.cpp	2012-08-15 09:45:06 +0000
@@ -73,10 +73,11 @@ 
 {
 }
 
-void
+bool
 ScenePulsar::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     // Disable back-face culling
     glDisable(GL_CULL_FACE);
@@ -119,8 +120,8 @@ 
     if (options_["texture"].value == "true") {
         frg_shader_filename = GLMARK_DATA_PATH"/shaders/light-basic-tex.frag";
         Texture::find_textures();
-        Texture::load("crate-base", &texture_,
-                      GL_NEAREST, GL_NEAREST, 0);
+        if (!Texture::load("crate-base", &texture_, GL_NEAREST, GL_NEAREST, 0))
+            return false;
 
     } else {
         frg_shader_filename = GLMARK_DATA_PATH"/shaders/light-basic.frag";
@@ -136,7 +137,7 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     create_and_setup_mesh();
@@ -148,6 +149,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-shading.cpp'
--- src/scene-shading.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-shading.cpp	2012-08-15 09:45:06 +0000
@@ -132,10 +132,11 @@ 
     return source.str();
 }
 
-void
+bool
 SceneShading::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     static const LibMatrix::vec4 lightPosition(20.0f, 20.0f, 10.0f, 1.0f);
     static const LibMatrix::vec4 materialDiffuse(0.0f, 0.0f, 1.0f, 1.0f);
@@ -181,7 +182,7 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     Model model;
@@ -189,7 +190,7 @@ 
     bool modelLoaded = model.load(whichModel);
 
     if(!modelLoaded)
-        return;
+        return false;
 
     // Now that we're successfully loaded, there are a few quirks about
     // some of the known models that we need to account for.  The draw
@@ -257,6 +258,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-terrain.cpp'
--- src/scene-terrain.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-terrain.cpp	2012-08-15 09:45:06 +0000
@@ -231,6 +231,21 @@ 
 }
 
 bool
+SceneTerrain::supported(bool show_errors)
+{
+    GLint vertex_textures;
+    glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &vertex_textures);
+
+    if (show_errors && vertex_textures <= 0) {
+        Log::error("SceneTerrain requires Vertex Texture Fetch support, "
+                   "but GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS is %d\n",
+                   vertex_textures);
+    }
+    
+    return vertex_textures > 0;
+}
+
+bool
 SceneTerrain::load()
 {
     Scene::load();
@@ -246,23 +261,11 @@ 
     Scene::unload();
 }
 
-void
+bool
 SceneTerrain::setup()
 {
-    Scene::setup();
-
-    /* Ensure implementation supports vertex texture fetch */
-    GLint vertex_textures;
-    glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &vertex_textures);
-    if (vertex_textures <= 0) {
-        Log::error("SceneTerrain requires Vertex Texture Fetch support, "
-                   "but GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS is %d\n",
-                   vertex_textures);
-        currentFrame_ = 0;
-        startTime_ = Util::get_timestamp_us() / 1000000.0;
-        running_ = false;
-        return;
-    }
+    if (!Scene::setup())
+        return false;
 
     /* Parse options */
     float repeat = Util::fromString<double>(options_["repeat-overlay"].value);
@@ -313,6 +316,8 @@ 
     currentFrame_ = 0;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     running_ = true;
+
+    return true;
 }
 
 void

=== modified file 'src/scene-texture.cpp'
--- src/scene-texture.cpp	2012-07-16 14:25:30 +0000
+++ src/scene-texture.cpp	2012-08-15 09:45:06 +0000
@@ -103,10 +103,11 @@ 
     mesh_.reset();
 }
 
-void
+bool
 SceneTexture::setup()
 {
-    Scene::setup();
+    if (!Scene::setup())
+        return false;
 
     static const std::string vtx_shader_filename(GLMARK_DATA_PATH"/shaders/light-basic.vert");
     static const std::string vtx_shader_texgen_filename(GLMARK_DATA_PATH"/shaders/light-basic-texgen.vert");
@@ -138,8 +139,8 @@ 
     }
 
     const string& whichTexture(options_["texture"].value);
-    Texture::load(whichTexture, &texture_,
-                  min_filter, mag_filter, 0);
+    if (!Texture::load(whichTexture, &texture_, min_filter, mag_filter, 0))
+        return false;
 
     // Load shaders
     bool doTexGen(options_["texgen"].value == "true");
@@ -168,14 +169,14 @@ 
     if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
-        return;
+        return false;
     }
 
     Model model;
     const string& whichModel(options_["model"].value);
     bool modelLoaded = model.load(whichModel);
     if(!modelLoaded)
-        return;
+        return false;
 
     // Now that we're successfully loaded, there are a few quirks about
     // some of the known models that we need to account for.  The draw
@@ -251,6 +252,8 @@ 
     running_ = true;
     startTime_ = Util::get_timestamp_us() / 1000000.0;
     lastUpdateTime_ = startTime_;
+
+    return true;
 }
 
 void

=== modified file 'src/scene.cpp'
--- src/scene.cpp	2012-08-13 10:09:08 +0000
+++ src/scene.cpp	2012-08-15 09:45:06 +0000
@@ -76,6 +76,13 @@ 
 }
 
 bool
+Scene::supported(bool show_errors)
+{
+    static_cast<void>(show_errors);
+    return true;
+}
+
+bool
 Scene::load()
 {
     return true;
@@ -86,7 +93,7 @@ 
 {
 }
 
-void
+bool
 Scene::setup()
 {
     duration_ = Util::fromString<double>(options_["duration"].value);
@@ -101,6 +108,12 @@ 
             ShaderSource::ShaderTypeFragment
             );
 
+    currentFrame_ = 0;
+    running_ = false;
+    startTime_ = Util::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
+
+    return supported(true);
 }
 
 void

=== modified file 'src/scene.h'
--- src/scene.h	2012-07-16 14:00:56 +0000
+++ src/scene.h	2012-08-15 09:45:06 +0000
@@ -74,6 +74,15 @@ 
     };
 
     /**
+     * Checks whether this scene (in its current configuration) is supported.
+     *
+     * @param show_errors whether to log errors about unsupported features
+     *
+     * @return whether the scene is supported
+     */
+    virtual bool supported(bool show_errors);
+
+    /**
      * Performs option-independent resource loading and configuration.
      *
      * It should be safe to call ::load() (and the corresponding ::unload())
@@ -95,9 +104,12 @@ 
      * This method also prepares a scene for a benchmark run.
      * It should be called just before running a scene/benchmark.
      *
-     * @return the operation status
+     * The base Scene::setup() method also checks whether a scene
+     * configuration is supported by calling ::supported(true).
+     *
+     * @return whether setting the scene up succeeded
      */
-    virtual void setup();
+    virtual bool setup();
 
     /**
      * Performs option-dependent resource unloading.
@@ -232,7 +244,7 @@ 
 public:
     SceneDefaultOptions(Canvas &pCanvas) : Scene(pCanvas, "") {}
     bool set_option(const std::string &opt, const std::string &val);
-    void setup();
+    bool setup();
 
 private:
     std::list<std::pair<std::string, std::string> > defaultOptions_;
@@ -244,7 +256,7 @@ 
     SceneBuild(Canvas &pCanvas);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -272,7 +284,7 @@ 
     SceneTexture(Canvas &pCanvas);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -300,7 +312,7 @@ 
     SceneShading(Canvas &pCanvas);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -327,7 +339,7 @@ 
     SceneGrid(Canvas &pCanvas, const std::string &name);
     virtual bool load();
     virtual void unload();
-    virtual void setup();
+    virtual bool setup();
     virtual void teardown();
     virtual void update();
     virtual void draw();
@@ -346,7 +358,7 @@ 
 {
 public:
     SceneConditionals(Canvas &pCanvas);
-    void setup();
+    bool setup();
     ValidationResult validate();
 
     ~SceneConditionals();
@@ -356,7 +368,7 @@ 
 {
 public:
     SceneFunction(Canvas &pCanvas);
-    void setup();
+    bool setup();
     ValidationResult validate();
 
     ~SceneFunction();
@@ -366,7 +378,7 @@ 
 {
 public:
     SceneLoop(Canvas &pCanvas);
-    void setup();
+    bool setup();
     ValidationResult validate();
 
     ~SceneLoop();
@@ -378,7 +390,7 @@ 
     SceneBump(Canvas &pCanvas);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -393,10 +405,10 @@ 
     float rotation_;
     float rotationSpeed_;
 private:
-    void setup_model_plain(const std::string &type);
-    void setup_model_normals();
-    void setup_model_normals_tangent();
-    void setup_model_height();
+    bool setup_model_plain(const std::string &type);
+    bool setup_model_normals();
+    bool setup_model_normals_tangent();
+    bool setup_model_height();
 };
 
 class SceneEffect2D : public Scene
@@ -405,7 +417,7 @@ 
     SceneEffect2D(Canvas &pCanvas);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -426,7 +438,7 @@ 
     ScenePulsar(Canvas &pCanvas);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -455,7 +467,7 @@ 
     SceneDesktop(Canvas &canvas);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -473,9 +485,10 @@ 
 {
 public:
     SceneBuffer(Canvas &canvas);
+    bool supported(bool show_errors);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -495,7 +508,7 @@ 
     SceneIdeas(Canvas &pCanvas);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -513,9 +526,10 @@ 
 {
 public:
     SceneTerrain(Canvas &pCanvas);
+    bool supported(bool show_errors);
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();
@@ -536,7 +550,7 @@ 
     ~SceneJellyfish();
     bool load();
     void unload();
-    void setup();
+    bool setup();
     void teardown();
     void update();
     void draw();