libobs: Remove need for DrawMatrix technique in effects
(Note: This commit also modifies obs-filters and text-freetype2) This simplifies writing of effects. DrawMatrix is no longer necessary because there are no sources that require drawing with a color matrix other than async sources, and async sources are automatically processed and don't defer their initial render stage to filters.
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@@ -44,19 +41,6 @@ float4 PSAddImageRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSAddImageMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.rgb = saturate(rgba.rgb + targetRGB.rgb);
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -65,12 +49,3 @@ technique Draw
|
||||
pixel_shader = PSAddImageRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSAddImageMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@@ -44,19 +41,6 @@ float4 PSMuliplyImageRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSMuliplyImageMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.rgb = saturate(rgba.rgb * targetRGB.rgb);
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -65,12 +49,3 @@ technique Draw
|
||||
pixel_shader = PSMuliplyImageRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSMuliplyImageMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@@ -44,19 +41,6 @@ float4 PSSubtractImageRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSSubtractImageMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.rgb = saturate(rgba.rgb - targetRGB.rgb);
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -65,12 +49,3 @@ technique Draw
|
||||
pixel_shader = PSSubtractImageRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSSubtractImageMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix = {1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0};
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform float4x4 yuv_mat = { 0.182586, 0.614231, 0.062007, 0.062745,
|
||||
-0.100644, -0.338572, 0.439216, 0.501961,
|
||||
@@ -107,12 +101,6 @@ float4 PSChromaKeyRGBA(VertData v_in) : TARGET
|
||||
return ProcessChromaKey(rgba, v_in, false);
|
||||
}
|
||||
|
||||
float4 PSChromaKeyMatrix(VertData v_in) : TARGET
|
||||
{
|
||||
float4 rgba = SampleYUVToRGB(v_in.uv) * color;
|
||||
return ProcessChromaKey(rgba, v_in, true);
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -121,12 +109,3 @@ technique Draw
|
||||
pixel_shader = PSChromaKeyRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSChromaKeyMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform float4 color;
|
||||
uniform float contrast;
|
||||
@@ -39,15 +36,6 @@ float4 PSColorFilterRGBA(VertData v_in) : TARGET
|
||||
return CalcColor(rgba);
|
||||
}
|
||||
|
||||
float4 PSColorFilterMatrix(VertData v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) * color;
|
||||
|
||||
return CalcColor(rgba);
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -56,12 +44,3 @@ technique Draw
|
||||
pixel_shader = PSColorFilterRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSColorFilterMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix = {1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0};
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform float4 color;
|
||||
uniform float contrast;
|
||||
@@ -67,12 +61,6 @@ float4 PSColorKeyRGBA(VertData v_in) : TARGET
|
||||
return ProcessColorKey(rgba, v_in);
|
||||
}
|
||||
|
||||
float4 PSColorKeyMatrix(VertData v_in) : TARGET
|
||||
{
|
||||
float4 rgba = SampleYUVToRGB(v_in.uv) * color;
|
||||
return ProcessColorKey(rgba, v_in);
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -81,12 +69,3 @@ technique Draw
|
||||
pixel_shader = PSColorKeyRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSColorKeyMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@@ -44,19 +41,6 @@ float4 PSAlphaMaskRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSAlphaMaskMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.a = targetRGB.a;
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -65,12 +49,3 @@ technique Draw
|
||||
pixel_shader = PSAlphaMaskRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSAlphaMaskMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@@ -44,19 +41,6 @@ float4 PSColorMaskRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSColorMaskMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.a = (targetRGB.r + targetRGB.g + targetRGB.b) / 3.0;
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -66,11 +50,3 @@ technique Draw
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSColorMaskMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@@ -3,9 +3,6 @@
|
||||
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color = {1.0, 1.0, 1.0, 1.0};
|
||||
@@ -74,31 +71,6 @@ float4 PSDrawBare(VertOut vert_in) : TARGET
|
||||
return colorx;
|
||||
}
|
||||
|
||||
float4 PSDrawMatrix(VertOut vert_in) : TARGET
|
||||
{
|
||||
float4 E = image.Sample(def_sampler, vert_in.uv);
|
||||
|
||||
float4 colorx = 8*E;
|
||||
float4 B = image.Sample(def_sampler, vert_in.t1.yw);
|
||||
float4 D = image.Sample(def_sampler, vert_in.t2.xw);
|
||||
float4 F = image.Sample(def_sampler, vert_in.t2.zw);
|
||||
float4 H = image.Sample(def_sampler, vert_in.t3.yw);
|
||||
colorx -= image.Sample(def_sampler, vert_in.t1.xw);
|
||||
colorx -= B;
|
||||
colorx -= image.Sample(def_sampler, vert_in.t1.zw);
|
||||
colorx -= D;
|
||||
colorx -= F;
|
||||
colorx -= image.Sample(def_sampler, vert_in.t3.xw);
|
||||
colorx -= H;
|
||||
colorx -= image.Sample(def_sampler, vert_in.t3.zw);
|
||||
|
||||
colorx = ((E!=F && E!=D) || (E!=B && E!=H)) ? saturate(E + colorx*sharpness) : E;
|
||||
|
||||
float4 yuv = colorx;
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -107,12 +79,3 @@ technique Draw
|
||||
pixel_shader = PSDrawBare(vert_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(vert_in);
|
||||
pixel_shader = PSDrawMatrix(vert_in);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,4 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
uniform texture2d image;
|
||||
|
||||
sampler_state def_sampler {
|
||||
@@ -30,13 +27,6 @@ float4 PSDrawBare(VertInOut vert_in) : TARGET
|
||||
return image.Sample(def_sampler, vert_in.uv) * vert_in.col;
|
||||
}
|
||||
|
||||
float4 PSDrawMatrix(VertInOut vert_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(def_sampler, vert_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@@ -45,12 +35,3 @@ technique Draw
|
||||
pixel_shader = PSDrawBare(vert_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(vert_in);
|
||||
pixel_shader = PSDrawMatrix(vert_in);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user