1
0
Эх сурвалжийг харах

libobs: Add P3 shaders for Mac

jpark37 3 жил өмнө
parent
commit
e709797d80

+ 8 - 0
libobs/data/color.effect

@@ -26,6 +26,14 @@ float3 rec709_to_rec2020(float3 v)
 	return float3(r, g, b);
 	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)
 float3 rec2020_to_rec709(float3 v)
 {
 {
 	float r = dot(v, float3(1.6604910021084345, -0.58764113878854951, -0.072849863319884883));
 	float r = dot(v, float3(1.6604910021084345, -0.58764113878854951, -0.072849863319884883));

+ 17 - 0
libobs/data/default_rect.effect

@@ -27,6 +27,14 @@ float4 PSDrawBare(VertInOut vert_in) : TARGET
 	return image.Sample(def_sampler, vert_in.uv);
 	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
 float4 PSDrawOpaque(VertInOut vert_in) : TARGET
 {
 {
 	return float4(image.Sample(def_sampler, vert_in.uv).rgb, 1.0);
 	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
 technique DrawOpaque
 {
 {
 	pass
 	pass