X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=util.cpp;h=c2ac59301778906894410cb27971ea4956289e56;hp=da6057e52f13b4ad4af9ca82a4c83acab6d23388;hb=83032a75853c0fadda1157e12d119b94991961a8;hpb=1bd97eb70a6fcb913bf954e369bc1a90ba17f74e diff --git a/util.cpp b/util.cpp index da6057e..c2ac593 100644 --- a/util.cpp +++ b/util.cpp @@ -126,9 +126,7 @@ 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_ESSL_300) { return read_file(base + ".300es." + extension); @@ -253,11 +251,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((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; } }