summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-03-14 23:25:39 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-03-14 23:25:39 +0100
commit5be333052f97c9980a328af2b256ffbff6c6af9b (patch)
treef2f2cbbbd7ce136367aaa46e2d0c76eee33892cd
parent5bcbaab8ea90655c2496c8df029a9cb991dba0ce (diff)
downloadcv-5be333052f97c9980a328af2b256ffbff6c6af9b.tar.gz
cv-5be333052f97c9980a328af2b256ffbff6c6af9b.tar.bz2
cv-5be333052f97c9980a328af2b256ffbff6c6af9b.zip
Revert "wimmel.frag: Discard fragment early if difference is to significant"
This reverts commit 5bcbaab8ea90655c2496c8df029a9cb991dba0ce. This was 0.2seconds faster on r600g but 4 seconds slower on sandybridge.
-rw-r--r--wimmel.frag9
1 files changed, 3 insertions, 6 deletions
diff --git a/wimmel.frag b/wimmel.frag
index b9271d7..d3cf745 100644
--- a/wimmel.frag
+++ b/wimmel.frag
@@ -12,19 +12,16 @@ main()
float height = search_rect[3];
int diff = 0;
- for (i = 0.0; i < width; i += pixelsize.x) {
- for (j = 0.0; j < height; j += pixelsize.y) {
+ for (i = 0.0; i < width && diff < barrier; i += pixelsize.x) {
+ for (j = 0.0; j < height && diff < barrier; j += pixelsize.y) {
vec4 match = texture2D(tex, search_rect.xy + vec2(i,j));
vec4 orig = texture2D(tex, v_texcoord + vec2(i,j));
diff += int(any(greaterThan(abs(orig - match), vec4(0.2))));
- if (diff >= barrier)
- discard;
}
}
- /* Only written if fragment is NOT discarded in loop */
- gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = vec4(float(diff < barrier), 0.0, 0.0, 1.0);
}
// vim:ft=c: