+ // We also need GL_R several places, for single-channel input.
+ { 30, "GL_ARB_texture_rg" },
+};
+
+bool check_extensions()
+{
+ // GLES generally doesn't use extensions as actively as desktop OpenGL.
+ // For now, we say that for GLES, we require GLES 3, which has everything
+ // we need.
+ if (!epoxy_is_desktop_gl()) {
+ if (epoxy_gl_version() >= 30) {
+ movit_srgb_textures_supported = true;
+ movit_shader_rounding_supported = true;
+ return true;
+ } else {
+ fprintf(stderr, "Movit system requirements: GLES version %.1f is too old (GLES 3.0 needed).\n",
+ 0.1f * epoxy_gl_version());
+ fprintf(stderr, "Movit initialization failed.\n");
+ return false;
+ }
+ }
+
+ // Check all extensions, and output errors for the ones that we are missing.
+ bool all_ok = true;
+ int gl_version = epoxy_gl_version();
+
+ for (unsigned i = 0; i < sizeof(required_extensions) / sizeof(required_extensions[0]); ++i) {
+ if (gl_version < required_extensions[i].min_equivalent_gl_version &&
+ !epoxy_has_gl_extension(required_extensions[i].extension_name)) {
+ fprintf(stderr, "Movit system requirements: Needs extension '%s' or at least OpenGL version %.1f (has version %.1f)\n",
+ required_extensions[i].extension_name,
+ 0.1f * required_extensions[i].min_equivalent_gl_version,
+ 0.1f * gl_version);
+ all_ok = false;
+ }
+ }
+
+ if (!all_ok) {
+ fprintf(stderr, "Movit initialization failed.\n");
+ return false;
+ }