Imported Upstream version 0.13.2+dsfg1

This commit is contained in:
Sebastian Ramacher 2016-02-24 00:16:51 +01:00
commit fb3990e9e5
2036 changed files with 287360 additions and 0 deletions

View file

@ -0,0 +1,139 @@
/*
* bicubic sharper (better for downscaling)
* note - this shader is adapted from the GPL bsnes shader, very good stuff
* there.
*/
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 float2 base_dimension_i;
sampler_state textureSampler {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertData {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertData VSDefault(VertData v_in)
{
VertData vert_out;
vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = v_in.uv;
return vert_out;
}
float weight(float x)
{
float ax = abs(x);
/* Sharper version. May look better in some cases. */
const float B = 0.0;
const float C = 0.75;
if (ax < 1.0)
return (pow(x, 2.0) *
((12.0 - 9.0 * B - 6.0 * C) * ax +
(-18.0 + 12.0 * B + 6.0 * C)) +
(6.0 - 2.0 * B))
/ 6.0;
else if ((ax >= 1.0) && (ax < 2.0))
return (pow(x, 2.0) *
((-B - 6.0 * C) * ax + (6.0 * B + 30.0 * C)) +
(-12.0 * B - 48.0 * C) * ax +
(8.0 * B + 24.0 * C))
/ 6.0;
else
return 0.0;
}
float4 weight4(float x)
{
return float4(
weight(x - 2.0),
weight(x - 1.0),
weight(x),
weight(x + 1.0));
}
float4 pixel(float xpos, float ypos)
{
return image.Sample(textureSampler, float2(xpos, ypos));
}
float4 get_line(float ypos, float4 xpos, float4 linetaps)
{
return
pixel(xpos.r, ypos) * linetaps.r +
pixel(xpos.g, ypos) * linetaps.g +
pixel(xpos.b, ypos) * linetaps.b +
pixel(xpos.a, ypos) * linetaps.a;
}
float4 DrawBicubic(VertData v_in)
{
float2 stepxy = base_dimension_i;
float2 pos = v_in.uv + stepxy * 0.5;
float2 f = frac(pos / stepxy);
float4 rowtaps = weight4(1.0 - f.x);
float4 coltaps = weight4(1.0 - f.y);
/* make sure all taps added together is exactly 1.0, otherwise some
* (very small) distortion can occur */
rowtaps /= rowtaps.r + rowtaps.g + rowtaps.b + rowtaps.a;
coltaps /= coltaps.r + coltaps.g + coltaps.b + coltaps.a;
float2 xystart = (-1.5 - f) * stepxy + pos;
float4 xpos = float4(
xystart.x,
xystart.x + stepxy.x,
xystart.x + stepxy.x * 2.0,
xystart.x + stepxy.x * 3.0
);
return
get_line(xystart.y , xpos, rowtaps) * coltaps.r +
get_line(xystart.y + stepxy.y , xpos, rowtaps) * coltaps.g +
get_line(xystart.y + stepxy.y * 2.0, xpos, rowtaps) * coltaps.b +
get_line(xystart.y + stepxy.y * 3.0, xpos, rowtaps) * coltaps.a;
}
float4 PSDrawBicubicRGBA(VertData v_in) : TARGET
{
return DrawBicubic(v_in);
}
float4 PSDrawBicubicMatrix(VertData v_in) : TARGET
{
float4 rgba = DrawBicubic(v_in);
float4 yuv;
yuv.xyz = clamp(rgba.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
}
technique Draw
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawBicubicRGBA(v_in);
}
}
technique DrawMatrix
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawBicubicMatrix(v_in);
}
}

View file

@ -0,0 +1,84 @@
/*
* bilinear low res scaling, samples 9 pixels of a larger image to scale to a
* low resolution image below half size
*/
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 float2 base_dimension_i;
sampler_state textureSampler {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertData {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertData VSDefault(VertData v_in)
{
VertData vert_out;
vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = v_in.uv;
return vert_out;
}
float4 pixel(float2 uv)
{
return image.Sample(textureSampler, uv);
}
float4 DrawLowresBilinear(VertData v_in)
{
float2 stepxy = base_dimension_i;
float4 out_color;
out_color = pixel(v_in.uv);
out_color += pixel(v_in.uv + float2(-stepxy.x, -stepxy.y));
out_color += pixel(v_in.uv + float2(-stepxy.x, 0.0));
out_color += pixel(v_in.uv + float2(-stepxy.x, stepxy.y));
out_color += pixel(v_in.uv + float2( 0.0, -stepxy.y));
out_color += pixel(v_in.uv + float2( 0.0, stepxy.y));
out_color += pixel(v_in.uv + float2( stepxy.x, -stepxy.y));
out_color += pixel(v_in.uv + float2( stepxy.x, 0.0));
out_color += pixel(v_in.uv + float2( stepxy.x, stepxy.y));
return out_color / float4(9.0, 9.0, 9.0, 9.0);
}
float4 PSDrawLowresBilinearRGBA(VertData v_in) : TARGET
{
return DrawLowresBilinear(v_in);
}
float4 PSDrawLowresBilinearMatrix(VertData v_in) : TARGET
{
float4 yuv = DrawLowresBilinear(v_in);
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
}
technique Draw
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawLowresBilinearRGBA(v_in);
}
}
technique DrawMatrix
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawLowresBilinearMatrix(v_in);
}
}

View file

@ -0,0 +1,54 @@
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 {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertInOut {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertInOut VSDefault(VertInOut vert_in)
{
VertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = vert_in.uv;
return vert_out;
}
float4 PSDrawBare(VertInOut vert_in) : TARGET
{
return image.Sample(def_sampler, vert_in.uv);
}
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
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawBare(vert_in);
}
}
technique DrawMatrix
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawMatrix(vert_in);
}
}

View file

@ -0,0 +1,55 @@
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 texture_rect image;
sampler_state def_sampler {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertInOut {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertInOut VSDefault(VertInOut vert_in)
{
VertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = vert_in.uv;
return vert_out;
}
float4 PSDrawBare(VertInOut vert_in) : TARGET
{
return image.Sample(def_sampler, vert_in.uv);
}
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
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawBare(vert_in);
}
}
technique DrawMatrix
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawMatrix(vert_in);
}
}

View file

@ -0,0 +1,380 @@
/******************************************************************************
Copyright (C) 2014 by Hugh Bailey <obs.jim@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
//#define DEBUGGING
uniform float4x4 ViewProj;
uniform float u_plane_offset;
uniform float v_plane_offset;
uniform float width;
uniform float height;
uniform float width_i;
uniform float height_i;
uniform float width_d2;
uniform float height_d2;
uniform float width_d2_i;
uniform float height_d2_i;
uniform float input_width;
uniform float input_height;
uniform float input_width_i;
uniform float input_height_i;
uniform float input_width_i_d2;
uniform float input_height_i_d2;
uniform texture2d image;
sampler_state def_sampler {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertInOut {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertInOut VSDefault(VertInOut vert_in)
{
VertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = vert_in.uv;
return vert_out;
}
/* used to prevent internal GPU precision issues width fmod in particular */
#define PRECISION_OFFSET 0.2
float4 PSNV12(VertInOut vert_in) : TARGET
{
float v_mul = floor(vert_in.uv.y * input_height);
float byte_offset = floor((v_mul + vert_in.uv.x) * width) * 4.0;
byte_offset += PRECISION_OFFSET;
float2 sample_pos[4];
if (byte_offset < u_plane_offset) {
#ifdef DEBUGGING
return float4(1.0, 1.0, 1.0, 1.0);
#endif
float lum_u = floor(fmod(byte_offset, width)) * width_i;
float lum_v = floor(byte_offset * width_i) * height_i;
/* move to texel centers to sample the 4 pixels properly */
lum_u += width_i * 0.5;
lum_v += height_i * 0.5;
sample_pos[0] = float2(lum_u, lum_v);
sample_pos[1] = float2(lum_u += width_i, lum_v);
sample_pos[2] = float2(lum_u += width_i, lum_v);
sample_pos[3] = float2(lum_u + width_i, lum_v);
float4x4 out_val = float4x4(
image.Sample(def_sampler, sample_pos[0]),
image.Sample(def_sampler, sample_pos[1]),
image.Sample(def_sampler, sample_pos[2]),
image.Sample(def_sampler, sample_pos[3])
);
return transpose(out_val)[1];
} else {
#ifdef DEBUGGING
return float4(0.5, 0.2, 0.5, 0.2);
#endif
float new_offset = byte_offset - u_plane_offset;
float ch_u = floor(fmod(new_offset, width)) * width_i;
float ch_v = floor(new_offset * width_i) * height_d2_i;
float width_i2 = width_i*2.0;
/* move to the borders of each set of 4 pixels to force it
* to do bilinear averaging */
ch_u += width_i;
ch_v += height_i;
sample_pos[0] = float2(ch_u, ch_v);
sample_pos[1] = float2(ch_u + width_i2, ch_v);
return float4(
image.Sample(def_sampler, sample_pos[0]).rb,
image.Sample(def_sampler, sample_pos[1]).rb
);
}
}
float4 PSPlanar420(VertInOut vert_in) : TARGET
{
float v_mul = floor(vert_in.uv.y * input_height);
float byte_offset = floor((v_mul + vert_in.uv.x) * width) * 4.0;
byte_offset += PRECISION_OFFSET;
float2 sample_pos[4];
if (byte_offset < u_plane_offset) {
#ifdef DEBUGGING
return float4(1.0, 1.0, 1.0, 1.0);
#endif
float lum_u = floor(fmod(byte_offset, width)) * width_i;
float lum_v = floor(byte_offset * width_i) * height_i;
/* move to texel centers to sample the 4 pixels properly */
lum_u += width_i * 0.5;
lum_v += height_i * 0.5;
sample_pos[0] = float2(lum_u, lum_v);
sample_pos[1] = float2(lum_u += width_i, lum_v);
sample_pos[2] = float2(lum_u += width_i, lum_v);
sample_pos[3] = float2(lum_u + width_i, lum_v);
} else {
#ifdef DEBUGGING
return ((byte_offset < v_plane_offset) ?
float4(0.5, 0.5, 0.5, 0.5) :
float4(0.2, 0.2, 0.2, 0.2));
#endif
float new_offset = byte_offset -
((byte_offset < v_plane_offset) ?
u_plane_offset : v_plane_offset);
float ch_u = floor(fmod(new_offset, width_d2)) * width_d2_i;
float ch_v = floor(new_offset * width_d2_i) * height_d2_i;
float width_i2 = width_i*2.0;
/* move to the borders of each set of 4 pixels to force it
* to do bilinear averaging */
ch_u += width_i;
ch_v += height_i;
sample_pos[0] = float2(ch_u, ch_v);
sample_pos[1] = float2(ch_u += width_i2, ch_v);
sample_pos[2] = float2(ch_u += width_i2, ch_v);
sample_pos[3] = float2(ch_u + width_i2, ch_v);
}
float4x4 out_val = float4x4(
image.Sample(def_sampler, sample_pos[0]),
image.Sample(def_sampler, sample_pos[1]),
image.Sample(def_sampler, sample_pos[2]),
image.Sample(def_sampler, sample_pos[3])
);
out_val = transpose(out_val);
if (byte_offset < u_plane_offset)
return out_val[1];
else if (byte_offset < v_plane_offset)
return out_val[0];
else
return out_val[2];
}
float4 PSPlanar444(VertInOut vert_in) : TARGET
{
float v_mul = floor(vert_in.uv.y * input_height);
float byte_offset = floor((v_mul + vert_in.uv.x) * width) * 4.0;
byte_offset += PRECISION_OFFSET;
float new_byte_offset = byte_offset;
if (byte_offset >= v_plane_offset)
new_byte_offset -= v_plane_offset;
else if (byte_offset >= u_plane_offset)
new_byte_offset -= u_plane_offset;
float2 sample_pos[4];
float u_val = floor(fmod(new_byte_offset, width)) * width_i;
float v_val = floor(new_byte_offset * width_i) * height_i;
/* move to texel centers to sample the 4 pixels properly */
u_val += width_i * 0.5;
v_val += height_i * 0.5;
sample_pos[0] = float2(u_val, v_val);
sample_pos[1] = float2(u_val += width_i, v_val);
sample_pos[2] = float2(u_val += width_i, v_val);
sample_pos[3] = float2(u_val + width_i, v_val);
float4x4 out_val = float4x4(
image.Sample(def_sampler, sample_pos[0]),
image.Sample(def_sampler, sample_pos[1]),
image.Sample(def_sampler, sample_pos[2]),
image.Sample(def_sampler, sample_pos[3])
);
out_val = transpose(out_val);
if (byte_offset < u_plane_offset)
return out_val[1];
else if (byte_offset < v_plane_offset)
return out_val[0];
else
return out_val[2];
}
float4 PSPacked422_Reverse(VertInOut vert_in, int u_pos, int v_pos,
int y0_pos, int y1_pos) : TARGET
{
float y = vert_in.uv.y;
float odd = floor(fmod(width * vert_in.uv.x + PRECISION_OFFSET, 2.0));
float x = floor(width_d2 * vert_in.uv.x + PRECISION_OFFSET) *
width_d2_i;
x += input_width_i_d2;
float4 texel = image.Sample(def_sampler, float2(x, y));
return float4(odd > 0.5 ? texel[y1_pos] : texel[y0_pos],
texel[u_pos], texel[v_pos], 1.0);
}
float GetOffsetColor(float offset)
{
float2 uv;
offset += PRECISION_OFFSET;
uv.x = floor(fmod(offset, input_width)) * input_width_i;
uv.y = floor(offset * input_width_i) * input_height_i;
uv.xy += float2(input_width_i_d2, input_height_i_d2);
return image.Sample(def_sampler, uv).r;
}
float4 PSPlanar420_Reverse(VertInOut vert_in) : TARGET
{
float x = vert_in.uv.x;
float y = vert_in.uv.y;
float x_offset = floor(x * width + PRECISION_OFFSET);
float y_offset = floor(y * height + PRECISION_OFFSET);
float lum_offset = y_offset * width + x_offset + PRECISION_OFFSET;
lum_offset = floor(lum_offset);
float ch_offset = floor(y_offset * 0.5 + PRECISION_OFFSET) * width_d2 +
(x_offset * 0.5) + PRECISION_OFFSET;
ch_offset = floor(ch_offset);
return float4(
GetOffsetColor(lum_offset),
GetOffsetColor(u_plane_offset + ch_offset),
GetOffsetColor(v_plane_offset + ch_offset),
1.0
);
}
float4 PSNV12_Reverse(VertInOut vert_in) : TARGET
{
float x = vert_in.uv.x;
float y = vert_in.uv.y;
float x_offset = floor(x * width + PRECISION_OFFSET);
float y_offset = floor(y * height + PRECISION_OFFSET);
float lum_offset = y_offset * width + x_offset + PRECISION_OFFSET;
lum_offset = floor(lum_offset);
float ch_offset = floor(y_offset * 0.5 + PRECISION_OFFSET) * width_d2 +
(x_offset * 0.5);
ch_offset = floor(ch_offset * 2.0 + PRECISION_OFFSET);
return float4(
GetOffsetColor(lum_offset),
GetOffsetColor(u_plane_offset + ch_offset),
GetOffsetColor(u_plane_offset + ch_offset + 1.0),
1.0
);
}
technique Planar420
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSPlanar420(vert_in);
}
}
technique Planar444
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSPlanar444(vert_in);
}
}
technique NV12
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSNV12(vert_in);
}
}
technique UYVY_Reverse
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSPacked422_Reverse(vert_in, 2, 0, 1, 3);
}
}
technique YUY2_Reverse
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSPacked422_Reverse(vert_in, 1, 3, 2, 0);
}
}
technique YVYU_Reverse
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSPacked422_Reverse(vert_in, 3, 1, 2, 0);
}
}
technique I420_Reverse
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSPlanar420_Reverse(vert_in);
}
}
technique NV12_Reverse
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSNV12_Reverse(vert_in);
}
}

View file

@ -0,0 +1,139 @@
/*
* lanczos sharper
* note - this shader is adapted from the GPL bsnes shader, very good stuff
* there.
*/
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 float2 base_dimension_i;
sampler_state textureSampler
{
AddressU = Clamp;
AddressV = Clamp;
Filter = Linear;
};
struct VertData {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertData VSDefault(VertData v_in)
{
VertData vert_out;
vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = v_in.uv;
return vert_out;
}
float sinc(float x)
{
const float PIval = 3.1415926535897932384626433832795;
return sin(x * PIval) / (x * PIval);
}
float weight(float x, float radius)
{
float ax = abs(x);
if (x == 0.0)
return 1.0;
else if (ax < radius)
return sinc(x) * sinc(x / radius);
else
return 0.0;
}
float3 weight3(float x)
{
return float3(
weight(x * 2.0 + 0.0 * 2.0 - 3.0, 3.0),
weight(x * 2.0 + 1.0 * 2.0 - 3.0, 3.0),
weight(x * 2.0 + 2.0 * 2.0 - 3.0, 3.0));
}
float4 pixel(float xpos, float ypos)
{
return image.Sample(textureSampler, float2(xpos, ypos));
}
float4 get_line(float ypos, float3 xpos1, float3 xpos2, float3 rowtap1,
float3 rowtap2)
{
return
pixel(xpos1.r, ypos) * rowtap1.r +
pixel(xpos1.g, ypos) * rowtap2.r +
pixel(xpos1.b, ypos) * rowtap1.g +
pixel(xpos2.r, ypos) * rowtap2.g +
pixel(xpos2.g, ypos) * rowtap1.b +
pixel(xpos2.b, ypos) * rowtap2.b;
}
float4 DrawLanczos(VertData v_in)
{
float2 stepxy = base_dimension_i;
float2 pos = v_in.uv + stepxy * 0.5;
float2 f = frac(pos / stepxy);
float3 rowtap1 = weight3((1.0 - f.x) / 2.0);
float3 rowtap2 = weight3((1.0 - f.x) / 2.0 + 0.5);
float3 coltap1 = weight3((1.0 - f.y) / 2.0);
float3 coltap2 = weight3((1.0 - f.y) / 2.0 + 0.5);
/* make sure all taps added together is exactly 1.0, otherwise some
* (very small) distortion can occur */
float suml = rowtap1.r + rowtap1.g + rowtap1.b + rowtap2.r + rowtap2.g + rowtap2.b;
float sumc = coltap1.r + coltap1.g + coltap1.b + coltap2.r + coltap2.g + coltap2.b;
rowtap1 /= suml;
rowtap2 /= suml;
coltap1 /= sumc;
coltap2 /= sumc;
float2 xystart = (-2.5 - f) * stepxy + pos;
float3 xpos1 = float3(xystart.x , xystart.x + stepxy.x , xystart.x + stepxy.x * 2.0);
float3 xpos2 = float3(xystart.x + stepxy.x * 3.0, xystart.x + stepxy.x * 4.0, xystart.x + stepxy.x * 5.0);
return
get_line(xystart.y , xpos1, xpos2, rowtap1, rowtap2) * coltap1.r +
get_line(xystart.y + stepxy.y , xpos1, xpos2, rowtap1, rowtap2) * coltap2.r +
get_line(xystart.y + stepxy.y * 2.0, xpos1, xpos2, rowtap1, rowtap2) * coltap1.g +
get_line(xystart.y + stepxy.y * 3.0, xpos1, xpos2, rowtap1, rowtap2) * coltap2.g +
get_line(xystart.y + stepxy.y * 4.0, xpos1, xpos2, rowtap1, rowtap2) * coltap1.b +
get_line(xystart.y + stepxy.y * 5.0, xpos1, xpos2, rowtap1, rowtap2) * coltap2.b;
}
float4 PSDrawLanczosRGBA(VertData v_in) : TARGET
{
return DrawLanczos(v_in);
}
float4 PSDrawLanczosMatrix(VertData v_in) : TARGET
{
float4 rgba = DrawLanczos(v_in);
float4 yuv;
yuv.xyz = clamp(rgba.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
}
technique Draw
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawLanczosRGBA(v_in);
}
}
technique DrawMatrix
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawLanczosMatrix(v_in);
}
}

35
libobs/data/opaque.effect Normal file
View file

@ -0,0 +1,35 @@
uniform float4x4 ViewProj;
uniform texture2d image;
sampler_state def_sampler {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertInOut {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertInOut VSDefault(VertInOut vert_in)
{
VertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = vert_in.uv;
return vert_out;
}
float4 PSDraw(VertInOut vert_in) : TARGET
{
return float4(image.Sample(def_sampler, vert_in.uv).rgb, 1.0);
}
technique Draw
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDraw(vert_in);
}
}

54
libobs/data/solid.effect Normal file
View file

@ -0,0 +1,54 @@
uniform float4x4 ViewProj;
uniform float4 color = {1.0, 1.0, 1.0, 1.0};
struct SolidVertInOut {
float4 pos : POSITION;
};
SolidVertInOut VSSolid(SolidVertInOut vert_in)
{
SolidVertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
return vert_out;
}
float4 PSSolid(SolidVertInOut vert_in) : TARGET
{
return color;
}
struct SolidColoredVertInOut {
float4 pos : POSITION;
float4 color : COLOR;
};
SolidColoredVertInOut VSSolidColored(SolidColoredVertInOut vert_in)
{
SolidColoredVertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
vert_out.color = vert_in.color;
return vert_out;
}
float4 PSSolidColored(SolidColoredVertInOut vert_in) : TARGET
{
return vert_in.color * color;
}
technique Solid
{
pass
{
vertex_shader = VSSolid(vert_in);
pixel_shader = PSSolid(vert_in);
}
}
technique SolidColored
{
pass
{
vertex_shader = VSSolidColored(vert_in);
pixel_shader = PSSolidColored(vert_in);
}
}