+in vec3 tc0, tc_left0, tc_down0;
+in vec3 tc1, tc_left1, tc_down1;
+in float line_offset;
+out uvec4 equation_red, equation_black;
+
+uniform sampler2DArray I_x_y_tex, I_t_tex;
+uniform sampler2DArray diff_flow_tex, base_flow_tex;
+uniform sampler2DArray beta_0_tex;
+uniform sampler2DArray diffusivity_tex;
+
+// Relative weighting of intensity term.
+uniform float delta;
+
+// Relative weighting of gradient term.
+uniform float gamma;
+
+uniform bool zero_diff_flow;
+
+// Similar to packHalf2x16, but the two values share exponent, and are stored
+// as 12-bit fixed point numbers multiplied by that exponent (the leading one
+// can't be implicit in this kind of format). This allows us to store a much
+// greater range of numbers (8-bit, ie., full fp32 range), and also gives us an
+// extra mantissa bit. (Well, ostensibly two, but because the numbers have to
+// be stored denormalized, we only really gain one.)
+//
+// The price we pay is that if the numbers are of very different magnitudes,
+// the smaller number gets less precision.
+uint pack_floats_shared(float a, float b)
+{
+ float greatest = max(abs(a), abs(b));
+
+ // Find the exponent, increase it by one, and negate it.
+ // E.g., if the nonbiased exponent is 3, the number is between
+ // 2^3 and 2^4, so our normalization factor to get within -1..1
+ // is going to be 2^-4.
+ //
+ // exponent -= 127;
+ // exponent = -(exponent + 1);
+ // exponent += 127;
+ //
+ // is the same as
+ //
+ // exponent = 252 - exponent;
+ uint e = floatBitsToUint(greatest) & 0x7f800000u;
+ float normalizer = uintBitsToFloat((252 << 23) - e);