Better error messages when skipping compute shader benchmarks.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 19 Nov 2017 14:25:30 +0000 (15:25 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 19 Nov 2017 14:25:39 +0000 (15:25 +0100)
deinterlace_effect_test.cpp
test_util.cpp
test_util.h

index 0ac1953..dec1322 100644 (file)
@@ -230,7 +230,7 @@ TestFormat bgra_format = { FORMAT_BGRA_PREMULTIPLIED_ALPHA, GL_BGRA, 4 };
 void BM_DeinterlaceEffect(benchmark::State &state, TestFormat format, bool spatial_interlacing_check, const std::string &shader_type)
 {
        DisableComputeShadersTemporarily disabler(shader_type == "fragment");
-       if (disabler.should_skip()) return;
+       if (disabler.should_skip(&state)) return;
 
        unsigned width = state.range(0), height = state.range(1);
        unsigned field_height = height / 2;
index 99ab731..6214dbc 100644 (file)
@@ -545,4 +545,19 @@ bool DisableComputeShadersTemporarily::should_skip()
        return false;
 }
 
+#ifdef HAVE_BENCHMARK
+bool DisableComputeShadersTemporarily::should_skip(benchmark::State *benchmark_state)
+{
+       if (disable_compute_shaders) {
+               return false;
+       }
+
+       if (!movit_compute_shaders_supported) {
+               benchmark_state->SkipWithError("Compute shaders not supported");
+               return true;
+       }
+       return false;
+}
+#endif
+
 }  // namespace movit
index a0767ad..6ee3228 100644 (file)
@@ -101,6 +101,11 @@ public:
        // compute shaders). Will also output a message to stderr if so.
        bool should_skip();
 
+#ifdef HAVE_BENCHMARK
+       // Same, but outputs a message to the benchmark instead of to stderr.   
+       bool should_skip(benchmark::State *benchmark_state);
+#endif
+
        bool active() const { return disable_compute_shaders; }
 
 private: