forgot to add

This commit is contained in:
zeromus 2014-02-03 06:34:55 +00:00
parent 151b074563
commit 582a3ae58a
2 changed files with 398 additions and 0 deletions

View File

@ -0,0 +1,99 @@
struct tex_coords
{
float2 c00;
float2 c01;
float2 c02;
float2 c10;
float2 c11;
float2 c12;
float2 c20;
float2 c21;
float2 c22;
};
struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
};
void main_vertex
(
float4 position : POSITION,
out float4 oPosition : POSITION,
uniform float4x4 modelViewProj,
float4 color : COLOR,
out float4 oColor : COLOR,
float2 tex : TEXCOORD,
uniform input IN,
out tex_coords coords
)
{
oPosition = mul(modelViewProj, position);
oColor = color;
float2 texsize = IN.texture_size;
float2 delta = 0.5 / texsize;
float dx = delta.x;
float dy = delta.y;
coords = tex_coords (
tex + float2(-dx, -dy),
tex + float2(-dx, 0),
tex + float2(-dx, dy),
tex + float2(0, -dy),
tex + float2(0, 0),
tex + float2(0, dy),
tex + float2(dx, -dy),
tex + float2(dx, 0),
tex + float2(dx, dy)
);
}
const float mx = 0.325; // start smoothing wt.
const float k = -0.250; // wt. decrease factor
const float max_w = 0.25; // max filter weigth
const float min_w = -0.05; // min filter weigth
const float lum_add = 0.25; // effects smoothing
float4 main_fragment (in tex_coords co, uniform sampler2D s0 : TEXUNIT0) : COLOR
{
float3 c00 = tex2D(s0, co.c00).xyz;
float3 c01 = tex2D(s0, co.c01).xyz;
float3 c02 = tex2D(s0, co.c02).xyz;
float3 c10 = tex2D(s0, co.c10).xyz;
float3 c11 = tex2D(s0, co.c11).xyz;
float3 c12 = tex2D(s0, co.c12).xyz;
float3 c20 = tex2D(s0, co.c20).xyz;
float3 c21 = tex2D(s0, co.c21).xyz;
float3 c22 = tex2D(s0, co.c22).xyz;
float3 dt = float3(1.0);
float md1 = dot(abs(c00 - c22), dt);
float md2 = dot(abs(c02 - c20), dt);
float w1 = dot(abs(c22 - c11), dt) * md2;
float w2 = dot(abs(c02 - c11), dt) * md1;
float w3 = dot(abs(c00 - c11), dt) * md2;
float w4 = dot(abs(c20 - c11), dt) * md1;
float t1 = w1 + w3;
float t2 = w2 + w4;
float ww = max(t1, t2) + 0.0001;
c11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);
float lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);
float lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);
w1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);
w2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);
w3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);
w4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);
return float4(w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11, 1.0);
}

View File

@ -0,0 +1,299 @@
// GLSL shader autogenerated by cg2glsl.py.
#if defined(VERTEX)
#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif
#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING vec2 VARc22;
COMPAT_VARYING vec2 VARc21;
COMPAT_VARYING vec2 VARc20;
COMPAT_VARYING vec2 VARc12;
COMPAT_VARYING vec2 VARc11;
COMPAT_VARYING vec2 VARc10;
COMPAT_VARYING vec2 VARc02;
COMPAT_VARYING vec2 VARc01;
COMPAT_VARYING vec2 VARc00;
struct tex_coords {
vec2 VARc00;
vec2 VARc01;
vec2 VARc02;
vec2 VARc10;
vec2 VARc11;
vec2 VARc12;
vec2 VARc20;
vec2 VARc21;
vec2 VARc22;
};
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
};
vec4 _oPosition1;
tex_coords _coords1;
input_dummy _IN1;
vec4 _r0012;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_VARYING vec4 COL0;
COMPAT_ATTRIBUTE vec4 TexCoord;
uniform mat4 MVPMatrix;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
vec4 _oColor;
vec2 _delta;
tex_coords _TMP8;
_r0012 = VertexCoord.x*MVPMatrix[0];
_r0012 = _r0012 + VertexCoord.y*MVPMatrix[1];
_r0012 = _r0012 + VertexCoord.z*MVPMatrix[2];
_r0012 = _r0012 + VertexCoord.w*MVPMatrix[3];
_oPosition1 = _r0012;
_oColor = COLOR;
_delta = 5.00000000E-001/TextureSize;
_TMP8.VARc00 = TexCoord.xy + vec2(-_delta.x, -_delta.y);
_TMP8.VARc01 = TexCoord.xy + vec2(-_delta.x, 0.00000000E+000);
_TMP8.VARc02 = TexCoord.xy + vec2(-_delta.x, _delta.y);
_TMP8.VARc10 = TexCoord.xy + vec2(0.00000000E+000, -_delta.y);
_TMP8.VARc12 = TexCoord.xy + vec2(0.00000000E+000, _delta.y);
_TMP8.VARc20 = TexCoord.xy + vec2(_delta.x, -_delta.y);
_TMP8.VARc21 = TexCoord.xy + vec2(_delta.x, 0.00000000E+000);
_TMP8.VARc22 = TexCoord.xy + vec2(_delta.x, _delta.y);
VARc00 = _TMP8.VARc00;
VARc01 = _TMP8.VARc01;
VARc02 = _TMP8.VARc02;
VARc10 = _TMP8.VARc10;
VARc11 = TexCoord.xy;
VARc12 = _TMP8.VARc12;
VARc20 = _TMP8.VARc20;
VARc21 = _TMP8.VARc21;
VARc22 = _TMP8.VARc22;
gl_Position = _r0012;
COL0 = COLOR;
}
#elif defined(FRAGMENT)
#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING vec2 VARc22;
COMPAT_VARYING vec2 VARc21;
COMPAT_VARYING vec2 VARc20;
COMPAT_VARYING vec2 VARc12;
COMPAT_VARYING vec2 VARc11;
COMPAT_VARYING vec2 VARc10;
COMPAT_VARYING vec2 VARc02;
COMPAT_VARYING vec2 VARc01;
COMPAT_VARYING vec2 VARc00;
struct tex_coords {
vec2 VARc00;
vec2 VARc01;
vec2 VARc02;
vec2 VARc10;
vec2 VARc11;
vec2 VARc12;
vec2 VARc20;
vec2 VARc21;
vec2 VARc22;
};
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
};
vec4 _ret_0;
float _TMP29;
float _TMP30;
vec3 _TMP28;
float _TMP27;
vec3 _TMP26;
float _TMP25;
vec3 _TMP24;
float _TMP23;
vec3 _TMP22;
float _TMP21;
float _TMP20;
float _TMP19;
float _TMP18;
vec3 _TMP17;
float _TMP16;
vec3 _TMP15;
float _TMP14;
vec3 _TMP13;
float _TMP12;
vec3 _TMP11;
vec3 _TMP10;
vec3 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
tex_coords _co1;
uniform sampler2D Texture;
vec3 _a0058;
vec3 _a0062;
vec3 _a0066;
vec3 _a0070;
vec3 _a0074;
vec3 _a0078;
vec3 _a0084;
vec3 _a0086;
vec3 _a0088;
float _TMP91;
float _x0092;
vec3 _a0098;
float _TMP101;
float _x0102;
vec3 _a0108;
float _TMP111;
float _x0112;
vec3 _a0118;
float _TMP121;
float _x0122;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
vec3 _c11;
float _md1;
float _md2;
float _w1;
float _w2;
float _w3;
float _w4;
float _t1;
float _t2;
float _ww;
float _lc1;
float _lc2;
vec3 _TMP38;
_TMP0 = COMPAT_TEXTURE(Texture, VARc00);
_TMP1 = COMPAT_TEXTURE(Texture, VARc01);
_TMP2 = COMPAT_TEXTURE(Texture, VARc02);
_TMP3 = COMPAT_TEXTURE(Texture, VARc10);
_TMP4 = COMPAT_TEXTURE(Texture, VARc11);
_TMP5 = COMPAT_TEXTURE(Texture, VARc12);
_TMP6 = COMPAT_TEXTURE(Texture, VARc20);
_TMP7 = COMPAT_TEXTURE(Texture, VARc21);
_TMP8 = COMPAT_TEXTURE(Texture, VARc22);
_a0058 = _TMP0.xyz - _TMP8.xyz;
_TMP9 = abs(_a0058);
_md1 = dot(_TMP9, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_a0062 = _TMP2.xyz - _TMP6.xyz;
_TMP10 = abs(_a0062);
_md2 = dot(_TMP10, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_a0066 = _TMP8.xyz - _TMP4.xyz;
_TMP11 = abs(_a0066);
_TMP12 = dot(_TMP11, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_w1 = _TMP12*_md2;
_a0070 = _TMP2.xyz - _TMP4.xyz;
_TMP13 = abs(_a0070);
_TMP14 = dot(_TMP13, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_w2 = _TMP14*_md1;
_a0074 = _TMP0.xyz - _TMP4.xyz;
_TMP15 = abs(_a0074);
_TMP16 = dot(_TMP15, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_w3 = _TMP16*_md2;
_a0078 = _TMP6.xyz - _TMP4.xyz;
_TMP17 = abs(_a0078);
_TMP18 = dot(_TMP17, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_w4 = _TMP18*_md1;
_t1 = _w1 + _w3;
_t2 = _w2 + _w4;
_TMP19 = max(_t1, _t2);
_ww = _TMP19 + 9.99999975E-005;
_c11 = (_w1*_TMP0.xyz + _w2*_TMP6.xyz + _w3*_TMP8.xyz + _w4*_TMP2.xyz + _ww*_TMP4.xyz)/(_t1 + _t2 + _ww);
_a0084 = _TMP3.xyz + _TMP5.xyz + _c11;
_TMP20 = dot(_a0084, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_lc1 = -2.50000000E-001/(1.19999997E-001*_TMP20 + 2.50000000E-001);
_a0086 = _TMP1.xyz + _TMP7.xyz + _c11;
_TMP21 = dot(_a0086, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_lc2 = -2.50000000E-001/(1.19999997E-001*_TMP21 + 2.50000000E-001);
_a0088 = _c11 - _TMP3.xyz;
_TMP22 = abs(_a0088);
_TMP23 = dot(_TMP22, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_x0092 = _lc1*_TMP23 + 3.24999988E-001;
_TMP30 = min(2.50000000E-001, _x0092);
_TMP91 = max(-5.00000007E-002, _TMP30);
_a0098 = _c11 - _TMP7.xyz;
_TMP24 = abs(_a0098);
_TMP25 = dot(_TMP24, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_x0102 = _lc2*_TMP25 + 3.24999988E-001;
_TMP30 = min(2.50000000E-001, _x0102);
_TMP101 = max(-5.00000007E-002, _TMP30);
_a0108 = _c11 - _TMP5.xyz;
_TMP26 = abs(_a0108);
_TMP27 = dot(_TMP26, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_x0112 = _lc1*_TMP27 + 3.24999988E-001;
_TMP30 = min(2.50000000E-001, _x0112);
_TMP111 = max(-5.00000007E-002, _TMP30);
_a0118 = _c11 - _TMP1.xyz;
_TMP28 = abs(_a0118);
_TMP29 = dot(_TMP28, vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_x0122 = _lc2*_TMP29 + 3.24999988E-001;
_TMP30 = min(2.50000000E-001, _x0122);
_TMP121 = max(-5.00000007E-002, _TMP30);
_TMP38 = _TMP91*_TMP3.xyz + _TMP101*_TMP7.xyz + _TMP111*_TMP5.xyz + _TMP121*_TMP1.xyz + ((((1.00000000E+000 - _TMP91) - _TMP101) - _TMP111) - _TMP121)*_c11;
_ret_0 = vec4(_TMP38.x, _TMP38.y, _TMP38.z, 1.00000000E+000);
FragColor = _ret_0;
return;
}
#endif