}
}
+void init_movit_for_test()
+{
+ CHECK(init_movit(".", MOVIT_DEBUG_OFF));
+}
+
} // namespace
EffectChainTester::EffectChainTester(const float *data, unsigned width, unsigned height,
void EffectChainTester::run(float *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<float>(out_data, nullptr, NULL, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
+ internal_run<float>(out_data, nullptr, nullptr, nullptr, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
}
void EffectChainTester::run(float *out_data, float *out_data2, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<float>(out_data, out_data2, nullptr, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
+ internal_run<float>(out_data, out_data2, nullptr, nullptr, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
}
void EffectChainTester::run(float *out_data, float *out_data2, float *out_data3, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
void EffectChainTester::run(unsigned char *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<unsigned char>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
+ internal_run<unsigned char>(out_data, nullptr, nullptr, nullptr, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
}
void EffectChainTester::run(unsigned char *out_data, unsigned char *out_data2, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<unsigned char>(out_data, out_data2, nullptr, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
+ internal_run<unsigned char>(out_data, out_data2, nullptr, nullptr, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
}
void EffectChainTester::run(unsigned char *out_data, unsigned char *out_data2, unsigned char *out_data3, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
void EffectChainTester::run(uint16_t *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<uint16_t>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_SHORT, format, color_space, gamma_curve, alpha_format);
+ internal_run<uint16_t>(out_data, nullptr, nullptr, nullptr, GL_UNSIGNED_SHORT, format, color_space, gamma_curve, alpha_format);
}
void EffectChainTester::run_10_10_10_2(uint32_t *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<uint32_t>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_INT_2_10_10_10_REV, format, color_space, gamma_curve, alpha_format);
+ internal_run<uint32_t>(out_data, nullptr, nullptr, nullptr, GL_UNSIGNED_INT_2_10_10_10_REV, format, color_space, gamma_curve, alpha_format);
}
#ifdef HAVE_BENCHMARK
void EffectChainTester::benchmark(benchmark::State &state, float *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<float>(out_data, nullptr, NULL, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
+ internal_run<float>(out_data, nullptr, nullptr, nullptr, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
}
void EffectChainTester::benchmark(benchmark::State &state, float *out_data, float *out_data2, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<float>(out_data, out_data2, nullptr, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
+ internal_run<float>(out_data, out_data2, nullptr, nullptr, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
}
void EffectChainTester::benchmark(benchmark::State &state, float *out_data, float *out_data2, float *out_data3, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
void EffectChainTester::benchmark(benchmark::State &state, unsigned char *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<unsigned char>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
+ internal_run<unsigned char>(out_data, nullptr, nullptr, nullptr, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
}
void EffectChainTester::benchmark(benchmark::State &state, unsigned char *out_data, unsigned char *out_data2, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<unsigned char>(out_data, out_data2, nullptr, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
+ internal_run<unsigned char>(out_data, out_data2, nullptr, nullptr, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
}
void EffectChainTester::benchmark(benchmark::State &state, unsigned char *out_data, unsigned char *out_data2, unsigned char *out_data3, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
void EffectChainTester::benchmark(benchmark::State &state, uint16_t *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<uint16_t>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_SHORT, format, color_space, gamma_curve, alpha_format, &state);
+ internal_run<uint16_t>(out_data, nullptr, nullptr, nullptr, GL_UNSIGNED_SHORT, format, color_space, gamma_curve, alpha_format, &state);
}
void EffectChainTester::benchmark_10_10_10_2(benchmark::State &state, uint32_t *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
{
- internal_run<uint32_t>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_INT_2_10_10_10_REV, format, color_space, gamma_curve, alpha_format, &state);
+ internal_run<uint32_t>(out_data, nullptr, nullptr, nullptr, GL_UNSIGNED_INT_2_10_10_10_REV, format, color_space, gamma_curve, alpha_format, &state);
}
#endif
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");
}
}
+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