libobs: Add more color handling to default/opaque

This commit is contained in:
jpark37
2022-04-13 06:23:11 -07:00
committed by Jim
parent 02aa833950
commit 08f50a7d22
2 changed files with 176 additions and 0 deletions
+52
View File
@@ -62,6 +62,14 @@ float4 PSDrawSrgbDecompress(VertInOut vert_in) : TARGET
return rgba;
}
float4 PSDrawSrgbDecompressMultiply(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
rgba.rgb = srgb_nonlinear_to_linear(rgba.rgb);
rgba.rgb *= multiplier;
return rgba;
}
float4 PSDrawMultiply(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
@@ -88,6 +96,23 @@ float4 PSDrawMultiplyTonemap(VertInOut vert_in) : TARGET
return rgba;
}
float4 PSDrawPQ(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
rgba.rgb = st2084_to_linear(rgba.rgb) * multiplier;
rgba.rgb = rec2020_to_rec709(rgba.rgb);
return rgba;
}
float4 PSDrawTonemapPQ(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
rgba.rgb = st2084_to_linear(rgba.rgb) * multiplier;
rgba.rgb = reinhard(rgba.rgb);
rgba.rgb = rec2020_to_rec709(rgba.rgb);
return rgba;
}
technique Draw
{
pass
@@ -133,6 +158,15 @@ technique DrawSrgbDecompress
}
}
technique DrawSrgbDecompressMultiply
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawSrgbDecompressMultiply(vert_in);
}
}
technique DrawMultiply
{
pass
@@ -159,3 +193,21 @@ technique DrawMultiplyTonemap
pixel_shader = PSDrawMultiplyTonemap(vert_in);
}
}
technique DrawPQ
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawPQ(vert_in);
}
}
technique DrawTonemapPQ
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawTonemapPQ(vert_in);
}
}