0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

libobs: Add P3 shaders for Mac

This commit is contained in:
jpark37 2022-09-29 17:54:25 -07:00 committed by Jim
parent 37cc894333
commit e709797d80
2 changed files with 25 additions and 0 deletions

View File

@ -26,6 +26,14 @@ float3 rec709_to_rec2020(float3 v)
return float3(r, g, b);
}
float3 d65p3_to_rec709(float3 v)
{
float r = dot(v, float3(1.2249401762805598, -0.22494017628055996, 0.));
float g = dot(v, float3(-0.042056954709688163, 1.0420569547096881, 0.));
float b = dot(v, float3(-0.019637554590334432, -0.078636045550631889, 1.0982736001409663));
return float3(r, g, b);
}
float3 rec2020_to_rec709(float3 v)
{
float r = dot(v, float3(1.6604910021084345, -0.58764113878854951, -0.072849863319884883));

View File

@ -27,6 +27,14 @@ float4 PSDrawBare(VertInOut vert_in) : TARGET
return image.Sample(def_sampler, vert_in.uv);
}
float4 PSDrawD65P3(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
rgba.rgb = srgb_nonlinear_to_linear(rgba.rgb);
rgba.rgb = d65p3_to_rec709(rgba.rgb);
return rgba;
}
float4 PSDrawOpaque(VertInOut vert_in) : TARGET
{
return float4(image.Sample(def_sampler, vert_in.uv).rgb, 1.0);
@ -48,6 +56,15 @@ technique Draw
}
}
technique DrawD65P3
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawD65P3(vert_in);
}
}
technique DrawOpaque
{
pass