Browse Source

Merge pull request #673 from Xaymar/patch-1

obs-transitions: Fix inefficient branching in slide_transition.effect
Jim 9 years ago
parent
commit
1728a5d1b7
1 changed files with 6 additions and 5 deletions
  1. 6 5
      plugins/obs-transitions/data/slide_transition.effect

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

@@ -28,11 +28,12 @@ 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;
-
-	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);
+	
+	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);
 }
 
 technique Slide