From: Steinar H. Gunderson Date: Sun, 19 Nov 2017 14:25:30 +0000 (+0100) Subject: Better error messages when skipping compute shader benchmarks. X-Git-Tag: 1.6.0~53 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=9823bfb683591e2b0fd844fa206ac888a9fef01a Better error messages when skipping compute shader benchmarks. --- diff --git a/deinterlace_effect_test.cpp b/deinterlace_effect_test.cpp index 0ac1953..dec1322 100644 --- a/deinterlace_effect_test.cpp +++ b/deinterlace_effect_test.cpp @@ -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; diff --git a/test_util.cpp b/test_util.cpp index 99ab731..6214dbc 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -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 diff --git a/test_util.h b/test_util.h index a0767ad..6ee3228 100644 --- a/test_util.h +++ b/test_util.h @@ -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: