X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=test_util.cpp;h=99ab731f6d7c1c3af31b93035b27618a770c4f27;hb=4179bef190d88739038233ac5d7e5ffa2ff4282f;hp=648e64793a5031a9013f01c202577bd86b212bd4;hpb=535d80fa1107590440b70229c97fd63bd72d0389;p=movit diff --git a/test_util.cpp b/test_util.cpp index 648e647..99ab731 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -42,6 +42,11 @@ void vertical_flip(T *data, unsigned width, unsigned height) } } +void init_movit_for_test() +{ + CHECK(init_movit(".", MOVIT_DEBUG_OFF)); +} + } // namespace EffectChainTester::EffectChainTester(const float *data, unsigned width, unsigned height, @@ -385,7 +390,7 @@ void expect_equal(const float *ref, const float *result, unsigned width, unsigne float rms = sqrt(squared_difference) / (width * height); EXPECT_LT(rms, rms_limit); - if (largest_difference >= largest_difference_limit || rms >= rms_limit) { + if (largest_difference >= largest_difference_limit || isnan(rms) || rms >= rms_limit) { fprintf(stderr, "Dumping matrices for easier debugging, since at least one test failed.\n"); fprintf(stderr, "Reference:\n"); @@ -512,4 +517,32 @@ double linear_to_srgb(double x) } } +DisableComputeShadersTemporarily::DisableComputeShadersTemporarily(bool disable_compute_shaders) + : disable_compute_shaders(disable_compute_shaders) +{ + init_movit_for_test(); + saved_compute_shaders_supported = movit_compute_shaders_supported; + if (disable_compute_shaders) { + movit_compute_shaders_supported = false; + } +} + +DisableComputeShadersTemporarily::~DisableComputeShadersTemporarily() +{ + movit_compute_shaders_supported = saved_compute_shaders_supported; +} + +bool DisableComputeShadersTemporarily::should_skip() +{ + if (disable_compute_shaders) { + return false; + } + + if (!movit_compute_shaders_supported) { + fprintf(stderr, "Compute shaders not supported; skipping.\n"); + return true; + } + return false; +} + } // namespace movit