libobs: DrawSrgbDecompressPremultiplied technique

Necessary for an upcoming fix to browser source.
This commit is contained in:
jpark37
2021-07-11 08:11:12 -07:00
committed by Jim
parent 09865c2ad4
commit 05b507d900
2 changed files with 44 additions and 0 deletions
+17
View File
@@ -62,6 +62,14 @@ float4 PSDrawNonlinearAlpha(VertInOut vert_in) : TARGET
return rgba;
}
float4 PSDrawSrgbDecompressPremultiplied(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
rgba.rgb = max(float3(0.0, 0.0, 0.0), rgba.rgb / rgba.a);
rgba.rgb = srgb_nonlinear_to_linear(rgba.rgb);
return rgba;
}
technique Draw
{
pass
@@ -88,3 +96,12 @@ technique DrawNonlinearAlpha
pixel_shader = PSDrawNonlinearAlpha(vert_in);
}
}
technique DrawSrgbDecompressPremultiplied
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawSrgbDecompressPremultiplied(vert_in);
}
}