Răsfoiți Sursa

libobs: Fix RGBA format output not working

Due to a bug in shader parsing, it thinks that because the token
"multiplier" is used here, that the "multiplier" uniform is being used.

This is a workaround for the issue because fixing the parser is probably
going to be much more annoying than just working around the issue for
now.
Jim 3 ani în urmă
părinte
comite
4a2a06b22f

+ 2 - 3
libobs/data/bicubic_scale.effect

@@ -166,9 +166,8 @@ float4 PSDrawBicubicRGBAMultiplyTonemap(FragData f_in, bool undistort) : TARGET
 float4 PSDrawBicubicRGBADivide(FragData f_in) : TARGET
 {
 	float4 rgba = DrawBicubic(f_in, false);
-	float alpha = rgba.a;
-	float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0;
-	return float4(rgba.rgb * multiplier, alpha);
+	rgba.rgb *= max(1. / rgba.a, 0.);
+	return rgba;
 }
 
 technique Draw

+ 2 - 3
libobs/data/default.effect

@@ -31,9 +31,8 @@ float4 PSDrawBare(VertInOut vert_in) : TARGET
 float4 PSDrawAlphaDivide(VertInOut vert_in) : TARGET
 {
 	float4 rgba = image.Sample(def_sampler, vert_in.uv);
-	float alpha = rgba.a;
-	float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0;
-	return float4(rgba.rgb * multiplier, alpha);
+	rgba.rgb *= max(1. / rgba.a, 0.);
+	return rgba;
 }
 
 float4 PSDrawNonlinearAlpha(VertInOut vert_in) : TARGET

+ 2 - 3
libobs/data/lanczos_scale.effect

@@ -222,9 +222,8 @@ float4 PSDrawLanczosRGBAMultiplyTonemap(FragData f_in, bool undistort) : TARGET
 float4 PSDrawLanczosRGBADivide(FragData f_in) : TARGET
 {
 	float4 rgba = DrawLanczos(f_in, false);
-	float alpha = rgba.a;
-	float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0;
-	return float4(rgba.rgb * multiplier, alpha);
+	rgba.rgb *= max(1. / rgba.a, 0.);
+	return rgba;
 }
 
 technique Draw