libobs: Fix default.effect not working with OpenGL

Due to my jank transpiler, default.effect worked with Direct3D 11 but
not with OpengGL. Fixing this particular bug with the transpiler is a
bit non-trivial so instead just modify the shader to work with both.
This commit is contained in:
Lain 2023-08-15 17:05:48 -07:00
parent e0f7bcaf3f
commit 2edb9f3151

View file

@ -31,14 +31,14 @@ float4 PSDrawBare(VertInOut vert_in) : TARGET
float4 PSDrawAlphaDivide(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
rgba.rgb = (rgba.a > 0.) ? (rgba.rgb / rgba.a) : 0.;
rgba.rgb = (rgba.a > 0.) ? (rgba.rgb / rgba.a) : float3(0.);
return rgba;
}
float4 PSDrawAlphaDivideTonemap(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
rgba.rgb = (rgba.a > 0.) ? (rgba.rgb / rgba.a) : 0.;
rgba.rgb = (rgba.a > 0.) ? (rgba.rgb / rgba.a) : float3(0.);
rgba.rgb = rec709_to_rec2020(rgba.rgb);
rgba.rgb = reinhard(rgba.rgb);
rgba.rgb = rec2020_to_rec709(rgba.rgb);
@ -48,7 +48,7 @@ float4 PSDrawAlphaDivideTonemap(VertInOut vert_in) : TARGET
float4 PSDrawAlphaDivideR10L(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
rgba.rgb = (rgba.a > 0.) ? (rgba.rgb / rgba.a) : 0.;
rgba.rgb = (rgba.a > 0.) ? (rgba.rgb / rgba.a) : float3(0.);
rgba.rgb *= multiplier;
rgba.rgb = rec709_to_rec2020(rgba.rgb);
rgba.rgb = linear_to_st2084(rgba.rgb);