]> git.sesse.net Git - nageru/blobdiff - prewarp.frag
Allow symlinked frame files. Useful for testing.
[nageru] / prewarp.frag
index b9645bf2c805de1a77593c977928164d409b03cb..baf24d1b41e0aefb8c0d1249c1d9ec5b4d7d8fd1 100644 (file)
@@ -2,22 +2,21 @@
 
 // Warps I_1 according to the flow, then computes the mean and difference to I_0.
 
-in vec2 tc;
+in vec3 tc;
 out float I, I_t;
 out vec2 normalized_flow;
 
-uniform sampler2D image0_tex, image1_tex, flow_tex;
-uniform vec2 image_size;
+uniform sampler2DArray image_tex, flow_tex;
 
 void main()
 {
        vec3 flow = texture(flow_tex, tc).xyz;
        flow.xy /= flow.z;  // Normalize the sum coming out of the densification.
 
-       float I_0 = texture(image0_tex, tc).x;
-       float I_w = texture(image1_tex, tc + flow.xy).x;  // NOTE: This is effectively a reverse warp since texture() is a gather operation and flow is conceptually scatter.
+       float I_0 = texture(image_tex, tc).x;
+       float I_w = texture(image_tex, vec3(tc.xy + flow.xy, 1.0f - tc.z)).x;  // NOTE: This is effectively a reverse warp since texture() is a gather operation and flow is conceptually scatter.
 
        I = 0.5f * (I_0 + I_w);
        I_t = I_w - I_0;
-       normalized_flow = flow.xy * image_size;
+       normalized_flow = flow.xy * textureSize(image_tex, 0).xy;
 }