]> git.sesse.net Git - movit/blobdiff - util.cpp
Allow setting width/height on FlatInput and YCbCrInput after instantiation.
[movit] / util.cpp
index da6057e52f13b4ad4af9ca82a4c83acab6d23388..d50039993bafc08853fe1278803f053212521f71 100644 (file)
--- a/util.cpp
+++ b/util.cpp
@@ -19,6 +19,7 @@
 #include <epoxy/wgl.h>
 #else
 #include <epoxy/glx.h>
+#include <epoxy/egl.h>
 #endif
 
 using namespace std;
@@ -126,10 +127,10 @@ string read_file(const string &filename)
 
 string read_version_dependent_file(const string &base, const string &extension)
 {
-       if (movit_shader_model == MOVIT_GLSL_110) {
-               return read_file(base + "." + extension);
-       } else if (movit_shader_model == MOVIT_GLSL_130) {
+       if (movit_shader_model == MOVIT_GLSL_130) {
                return read_file(base + ".130." + extension);
+       } else if (movit_shader_model == MOVIT_GLSL_150) {
+               return read_file(base + ".150." + extension);
        } else if (movit_shader_model == MOVIT_ESSL_300) {
                return read_file(base + ".300es." + extension);
        } else {
@@ -253,11 +254,11 @@ void combine_two_samples(float w1, float w2, float pos1, float pos2, float num_s
        //   w = (a(1-z) + bz) / ((1-z)² + z²)
        //
        // If z had infinite precision, this would simply reduce to w = w1 + w2.
-       *total_weight = (w1 + z * (w2 - w1)) / (z * z + (1 - z) * (1 - z));
+       *total_weight = from_fp64<DestFloat>((w1 + z * (w2 - w1)) / (z * z + (1 - z) * (1 - z)));
 
        if (sum_sq_error != NULL) {
-               float err1 = *total_weight * (1 - z) - w1;
-               float err2 = *total_weight * z - w2;
+               float err1 = to_fp64(*total_weight) * (1 - z) - w1;
+               float err2 = to_fp64(*total_weight) * z - w2;
                *sum_sq_error = err1 * err1 + err2 * err2;
        }
 }
@@ -333,6 +334,10 @@ void *get_gl_context_identifier()
 #elif defined(WIN32)
        return (void *)wglGetCurrentContext();
 #else
+       void *ret = (void *)eglGetCurrentContext();
+       if (ret != NULL) {
+               return ret;
+       }
        return (void *)glXGetCurrentContext();
 #endif
 }