]> git.sesse.net Git - movit/commitdiff
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 0ac19532f7351d1c463cdb5731455e2c8bd43539..dec132246e09a6aef4e40e41faf66fcce38542f2 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 99ab731f6d7c1c3af31b93035b27618a770c4f27..6214dbc1b16ef11ffd160fd1265230e9f13b77db 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 a0767ad81b097920f60483188fdbb78e60a7728a..6ee32284a827777a81435027a8b7cad73e70dbe5 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: