Browse Source

Revert "obs-transitions: Avoid branching in slide_transition.effect"

This reverts commit 0edaebe192839083528c856bd0d9e1bcab7a8006.

The commit was actually less optimal than it was before.  Shaders are
always fully unfolded and both sides of a branch are always executed.
Despite that fact, the "avoid branching" commit actually *added* two
extra unnecessary instructions with the same number of actual sample
instructions, making it arguably less optimal than before.

This was tested via the D3DDissamble function.
jp9000 9 years ago
parent
commit
e87031f4d6
1 changed files with 5 additions and 6 deletions
  1. 5 6
      plugins/obs-transitions/data/slide_transition.effect

+ 5 - 6
plugins/obs-transitions/data/slide_transition.effect

@@ -28,12 +28,11 @@ float4 PSSlide(VertData v_in) : TARGET
 {
 	float2 tex_a_uv = v_in.uv + tex_a_dir;
 	float2 tex_b_uv = v_in.uv - tex_b_dir;
-	
-	float4 tex_a_sample = tex_a.Sample(textureSampler, tex_a_uv);
-	float4 tex_b_sample = tex_b.Sample(textureSampler, tex_b_uv);
-	
-	float val = saturate(abs((tex_a_uv.x - saturate(tex_a_uv.x)) + (tex_a_uv.y - saturate(tex_a_uv.y))) * 65535);
-	return lerp(tex_a_sample, tex_b_sample, val);
+
+	return (tex_a_uv.x - saturate(tex_a_uv.x) != 0.0) ||
+	       (tex_a_uv.y - saturate(tex_a_uv.y) != 0.0)
+		   ? tex_b.Sample(textureSampler, tex_b_uv)
+		   : tex_a.Sample(textureSampler, tex_a_uv);
 }
 
 technique Slide